Skip to content

Commit

Permalink
Added basic project files
Browse files Browse the repository at this point in the history
Added files for a basic working copy of the app. Accepts an address and
downloads audio.
  • Loading branch information
MiguelAlho committed Jun 15, 2014
1 parent f13cf22 commit 409f793
Show file tree
Hide file tree
Showing 15 changed files with 559 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ Icon
# Files that might appear on external disk
.Spotlight-V100
.Trashes

*.suo
YoutubeGetter/bin/Debug/Newtonsoft.Json.dll
Expand Down
22 changes: 22 additions & 0 deletions YoutubeGetter.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YoutubeGetter", "YoutubeGetter\YoutubeGetter.csproj", "{435EE054-7D14-4913-9B68-0A9579DE62A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{435EE054-7D14-4913-9B68-0A9579DE62A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{435EE054-7D14-4913-9B68-0A9579DE62A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{435EE054-7D14-4913-9B68-0A9579DE62A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{435EE054-7D14-4913-9B68-0A9579DE62A9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions YoutubeGetter/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
8 changes: 8 additions & 0 deletions YoutubeGetter/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Application x:Class="YoutubeGetter.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions YoutubeGetter/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace YoutubeGetter
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
31 changes: 31 additions & 0 deletions YoutubeGetter/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Window x:Class="YoutubeGetter.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Youtube Getter" Height="350" Width="600">
<Grid Margin="0,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="199*"/>
</Grid.ColumnDefinitions>
<StatusBar HorizontalAlignment="Left" Height="32" Margin="0,289,-0.4,-0.2" VerticalAlignment="Top" Width="594"/>
<Menu HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Width="594" Margin="0,0,-0.4,0">
<Menu Height="231" Width="259" Name="FileMenu">
<MenuItem Name="File" Header="File" ></MenuItem>
<MenuItem Name="Settings" Header="Settings"></MenuItem>
<MenuItem Name="About" Header="About"></MenuItem>
</Menu>
</Menu>
<Grid HorizontalAlignment="Left" Height="245" Margin="0,39,-0.4,0" VerticalAlignment="Top" Width="594">
<TextBox x:Name="YoutubeLink" HorizontalAlignment="Left" Height="37" Margin="10,0,0,0" TextWrapping="Wrap" Text="place youtube link here" VerticalAlignment="Top" Width="449" FontSize="18"/>
<Button Content="Add to Queue" Margin="471,0,3,209" VerticalAlignment="Bottom" Height="36" Click="Button_Click" RenderTransformOrigin="0.5,0.5">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform AngleX="-1.754"/>
<RotateTransform/>
<TranslateTransform X="0.566"/>
</TransformGroup>
</Button.RenderTransform>
</Button>
</Grid>
</Grid>
</Window>
72 changes: 72 additions & 0 deletions YoutubeGetter/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using YoutubeExtractor;

namespace YoutubeGetter
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
string savepath = @"C:\Download\";

public MainWindow()
{
if (!Directory.Exists(savepath))
Directory.CreateDirectory(savepath);
}

private void Button_Click(object formsender, RoutedEventArgs e)
{
// Our test youtube link
string link = YoutubeLink.Text;

/*
* Get the available video formats.
* We'll work with them in the video and audio download examples.
*/
IEnumerable<VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(link);

/*
* We want the first extractable video with the highest audio quality.
*/
VideoInfo video = videoInfos
.Where(info => info.CanExtractAudio)
.OrderByDescending(info => info.AudioBitrate)
.First();

/*
* Create the audio downloader.
* The first argument is the video where the audio should be extracted from.
* The second argument is the path to save the audio file.
*/
var audioDownloader = new AudioDownloader(video, System.IO.Path.Combine(savepath, video.Title + video.AudioExtension));

// Register the progress events. We treat the download progress as 85% of the progress and the extraction progress only as 15% of the progress,
// because the download will take much longer than the audio extraction.
audioDownloader.DownloadProgressChanged += (sender, args) => Console.WriteLine(args.ProgressPercentage * 0.85);
audioDownloader.AudioExtractionProgressChanged += (sender, args) => Console.WriteLine(85 + args.ProgressPercentage * 0.15);

/*
* Execute the audio downloader.
* For GUI applications note, that this method runs synchronously.
*/
audioDownloader.Execute();

}
}
}
55 changes: 55 additions & 0 deletions YoutubeGetter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("YoutubeGetter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("YoutubeGetter")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.

//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]


[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]


// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
71 changes: 71 additions & 0 deletions YoutubeGetter/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 409f793

Please sign in to comment.