diff --git a/.vs/youtube-downloader/v16/.suo b/.vs/youtube-downloader/v16/.suo index 27d99a1..eaa872b 100644 Binary files a/.vs/youtube-downloader/v16/.suo and b/.vs/youtube-downloader/v16/.suo differ diff --git a/Program.cs b/Program.cs index 2d68c71..1b94aac 100644 --- a/Program.cs +++ b/Program.cs @@ -52,6 +52,10 @@ namespace youtube_downloader } static void Main(string[] args) { + Thread t = new Thread(new ThreadStart(() => { + Server.Functions.Downloader.DL.DownloadThread().GetAwaiter().GetResult(); + })); + t.Start(); // we need to get our app name so that // we can create unique names for our mutex and our pipe do @@ -149,37 +153,41 @@ namespace youtube_downloader } static void WriteVideoInfo(StringBuilder b,SavedVideo v,bool description) { - //v.AuthorChannelId - //v.AuthorTitle - //v.Dislikes - //v.Duration - //v.Id - //v.Keywords - //v.Likes - //v.Title - //v.UploadDate - //v.Views - //v.Description - - b.AppendLine($"Title: {v.Title}"); - b.AppendLine($"AuthorName: {v.AuthorTitle}"); - b.AppendLine($"AuthorID: {v.AuthorChannelId}"); - b.AppendLine($"Duration: {TimeSpan.FromSeconds(v.Duration).ToString()}"); - b.AppendLine($"Id: {v.Id}"); - b.AppendLine($"UploadDate: {v.UploadDate}"); - b.AppendLine($"Views: {v.Views}, Likes: {v.Likes}, Dislikes: {v.Dislikes}"); - b.AppendLine("Keywords:"); - foreach(var kw in v.Keywords) + if (v != null) { - b.AppendLine($"\t{kw}"); - } + //v.AuthorChannelId + //v.AuthorTitle + //v.Dislikes + //v.Duration + //v.Id + //v.Keywords + //v.Likes + //v.Title + //v.UploadDate + //v.Views + //v.Description - if (description) - { - b.AppendLine("Description:"); - b.AppendLine(v.Description); + b.AppendLine($"Title: {v.Title}"); + b.AppendLine($"AuthorName: {v.AuthorTitle}"); + b.AppendLine($"AuthorID: {v.AuthorChannelId}"); + b.AppendLine($"Duration: {TimeSpan.FromSeconds(v.Duration).ToString()}"); + b.AppendLine($"Id: {v.Id}"); + b.AppendLine($"UploadDate: {v.UploadDate}"); + b.AppendLine($"Views: {v.Views}, Likes: {v.Likes}, Dislikes: {v.Dislikes}"); + b.AppendLine("Keywords:"); + foreach (var kw in v.Keywords) + { + b.AppendLine($"\t{kw}"); + } + + if (description) + { + b.AppendLine("Description:"); + b.AppendLine(v.Description); + } } } + private static int RunInfo(Info opts) { //if ( != null) @@ -195,6 +203,8 @@ namespace youtube_downloader else { var s=Server.Functions.Downloader.GetProgress(); + if (s != null) + { StringBuilder sb = new StringBuilder(); sb.AppendLine("=======Progress======="); sb.AppendLine($"Progress: {s.Progress}%"); @@ -203,7 +213,7 @@ namespace youtube_downloader sb.AppendLine("=======Video Info======="); WriteVideoInfo(sb, s.Saved, false); Console.WriteLine(sb.ToString()); - + } } break; case "queue": @@ -213,10 +223,12 @@ namespace youtube_downloader Console.WriteLine(jsonData); } else + { + try { var s = Server.Functions.Downloader.GetQueueItems(); StringBuilder sb = new StringBuilder(); - foreach(var item in s) + foreach (var item in s) { WriteVideoInfo(sb, item.Video, false); sb.AppendLine(); @@ -224,7 +236,10 @@ namespace youtube_downloader Console.WriteLine(sb.ToString()); + } catch (Exception ex) + { + } } break; case "location": diff --git a/Server/Functions/Downloader.cs b/Server/Functions/Downloader.cs index 7f28c45..1777d1b 100644 --- a/Server/Functions/Downloader.cs +++ b/Server/Functions/Downloader.cs @@ -19,6 +19,11 @@ namespace youtube_downloader.Server.Functions { public class Downloader { + public Downloader() + { + // TessesYoutubeDownloader.Server.Functions.Downloader.DL.DownloadThread().GetAwaiter().GetResult(); + + } public static YoutubeClient CreateYoutubeClient() { diff --git a/bin/Debug/Info/il9nqWw9W3Y.json b/bin/Debug/Info/il9nqWw9W3Y.json new file mode 100644 index 0000000..7c06d5f --- /dev/null +++ b/bin/Debug/Info/il9nqWw9W3Y.json @@ -0,0 +1 @@ +{"Title":"Demi Lovato - Cool for the Summer (Official Video)","UploadDate":"7/23/2015 12:00:00 AM -07:00","Keywords":["demi lovato","cool for the summer","demi lovato cool for the summer","summer","demi lovato summer","demi lovato songs","demi","summer demi lovato","cool for the summer demi lovato","cool summer"],"Id":"il9nqWw9W3Y","AuthorTitle":"DemiLovatoVEVO","AuthorChannelId":"UCnyB9MYKRkSFK3IIB32CoVw","Description":"'Dancing With The Devil... The Art Of Starting Over': https://demilovato.lnk.to/DWTDTAOSO\nShop: shop.demilovato.com \nWatch the Demi Lovato: Dancing With The Devil documentary: http://yt.be/DemiDWTD\n\nConnect with Demi: \nSubscribe https://www.youtube.com/channel/UCZkURf9tDolFOeuw_4RD7XQ\nInstagram http://instagram.com/ddlovato\nTwitter http://twitter.com/ddlovato\nFacebook http://facebook.com/demilovato\nOfficial site http://demilovato.com\nJoin their mailing list to stay up to date http://www.demilovato.com/#mailing-list\n\nhttp://vevo.ly/b4JQfI","Duration":228.0,"Views":377251090,"Likes":2624522,"Dislikes":108978} \ No newline at end of file diff --git a/bin/Debug/youtube-downloader.exe b/bin/Debug/youtube-downloader.exe index 564d287..e06ceef 100644 Binary files a/bin/Debug/youtube-downloader.exe and b/bin/Debug/youtube-downloader.exe differ diff --git a/bin/Debug/youtube-downloader.pdb b/bin/Debug/youtube-downloader.pdb index 8f6e2f1..f3a1777 100644 Binary files a/bin/Debug/youtube-downloader.pdb and b/bin/Debug/youtube-downloader.pdb differ diff --git a/obj/Debug/youtube-downloader.exe b/obj/Debug/youtube-downloader.exe index 564d287..e06ceef 100644 Binary files a/obj/Debug/youtube-downloader.exe and b/obj/Debug/youtube-downloader.exe differ diff --git a/obj/Debug/youtube-downloader.pdb b/obj/Debug/youtube-downloader.pdb index 8f6e2f1..f3a1777 100644 Binary files a/obj/Debug/youtube-downloader.pdb and b/obj/Debug/youtube-downloader.pdb differ