Esempio n. 1
0
        private static void DownloadPlayList(DjuQBoxPlayList djuQBoxPlayList)
        {
            CreateFolder(djuQBoxPlayList);

            //fYoutubeDL.Options.FilesystemOptions.Output = Path.Combine(MP3_PATH, MPD_LIBRARY_DJUQBOX_ROOT_PATH, djuQBoxPlayList.PlaylistId) ;

            int ind = 1;

            foreach (var item in djuQBoxPlayList.Videos)
            {
                fYoutubeDL.VideoUrl = "https://www.youtube.com/watch?v=" + item.VideoId;
                fYoutubeDL.Options.FilesystemOptions.Output =
                    Path.Combine(MP3_PATH, MPD_LIBRARY_DJUQBOX_ROOT_PATH, djuQBoxPlayList.PlaylistId, ind++.ToString("000") + " - %(title)s-%(id)s.%(ext)s");
                var s = fYoutubeDL.PrepareDownload();//giati janakatebasei to idio xwris auto!

                fYoutubeDL.Download();
            }



            //string commandToRun = fYoutubeDL.PrepareDownload();
            //Console.WriteLine(commandToRun);
            //https://gitlab.com/BrianAllred/NYoutubeDL
            //.\youtube-dl.exe -v -x -i --proxy "http://localhost:3128" --audio-format mp3 --prefer-ffmpeg  --ffmpeg-location "C:\DjQbox\youtube-dl\ffmpeg-20170425-b4330a0-win64-static\bin" https://www.youtube.com/watch?v=7WFk23_6yos
        }
Esempio n. 2
0
        private static DjuQBoxPlayList GetYoutubePlayListInfo(string aPlayList)
        {
            var youtubeService = new YouTubeService(new BaseClientService.Initializer()
            {
                ApiKey          = GOOGLE_API_KEY,
                ApplicationName = "DjuQBox.Net.Server"
            });

            var playlistSearch = youtubeService.Playlists.List("snippet,contentDetails");

            playlistSearch.Id = aPlayList;
            var playlist = playlistSearch.Execute();



            DjuQBoxPlayList list = new DjuQBoxPlayList();

            list.PlaylistId = aPlayList;
            list.Title      = playlist.Items?[0].Snippet.ChannelTitle + " - " + playlist.Items?[0].Snippet.Title;
            var _th = playlist.Items?[0].Snippet.Thumbnails.High; //an kenh>???

            list.ThumbnailUrl = _th.Url;

            list.SongCount = (int)playlist.Items?[0].ContentDetails?.ItemCount;


            var listSearch = youtubeService.PlaylistItems.List("snippet");

            listSearch.PlaylistId = aPlayList;
            listSearch.MaxResults = 50; // max value!!!!

            var nextPageToken = "";

            while (nextPageToken != null)
            {
                listSearch.PageToken = nextPageToken;
                var listSearchRes = listSearch.Execute();

                foreach (var listItem in listSearchRes.Items)
                {
                    list.Videos.Add(new DjuQBoxSong(listItem.Snippet.Title, listItem.Snippet.ResourceId.VideoId, listItem.Snippet.Thumbnails?.High?.Url));
                }

                nextPageToken = listSearchRes.NextPageToken;
            }


            return(list);
        }
Esempio n. 3
0
        private static void CreateFolder(DjuQBoxPlayList djuQBoxPlayList)
        {
            String _path = Path.Combine(MP3_PATH, MPD_LIBRARY_DJUQBOX_ROOT_PATH, djuQBoxPlayList.PlaylistId);

            if (Directory.Exists(_path))
            {
                //yparxei
            }
            else
            {
                Directory.CreateDirectory(_path);
            }

            WebClient wc = new WebClient();

            wc.DownloadFile(djuQBoxPlayList.ThumbnailUrl, Path.Combine(_path, "thumbnail.jpg"));
        }