Пример #1
0
        static void SaveVideo_Step2(DownloadList saveItems, List <String> urls, bool?enque)
        {
            Helpers.UriUtils.RemoveInvalidUrls(urls);

            // if no valid urls were returned show error msg
            if (urls == null || urls.Count == 0)
            {
                ServiceRegistration.Get <IDialogManager>().ShowDialog("[OnlineVideos.Error]", "[OnlineVideos.UnableToDownloadVideo]", DialogType.OkDialog, false, DialogButtonType.Ok);
                return;
            }

            // create download list if more than one url
            if (urls.Count > 1)
            {
                saveItems.DownloadItems = new List <DownloadInfo>();
                foreach (string url in urls)
                {
                    VideoInfo vi      = saveItems.CurrentItem.VideoInfo.CloneForPlaylist(url, url == urls[0]);
                    string    url_new = url;
                    if (url == urls[0])
                    {
                        url_new = saveItems.CurrentItem.Util.GetPlaylistItemVideoUrl(vi, string.Empty);
                    }
                    DownloadInfo pli = DownloadInfo.Create(vi, saveItems.CurrentItem.Category, saveItems.CurrentItem.Util);
                    pli.Title            = string.Format("{0} - {1} / {2}", vi.Title, (saveItems.DownloadItems.Count + 1).ToString(), urls.Count);
                    pli.Url              = url_new;
                    pli.OverrideFolder   = saveItems.CurrentItem.OverrideFolder;
                    pli.OverrideFileName = saveItems.CurrentItem.OverrideFileName;
                    saveItems.DownloadItems.Add(pli);
                }
                // make the first item the current to be saved now
                saveItems.CurrentItem = saveItems.DownloadItems[0];
                urls = new List <string>(new string[] { saveItems.CurrentItem.Url });
            }
            // show selection dialog for playback options
            VideoViewModel tempVi = new VideoViewModel(saveItems.CurrentItem.VideoInfo, saveItems.CurrentItem.Category, saveItems.CurrentItem.Util.Settings.Name, saveItems.CurrentItem.Util.Settings.UtilName, false);

            tempVi.ChoosePlaybackOptions(urls[0], (url) => { SaveVideo_Step3(saveItems, url, enque); }, enque == null);             // skip dialog when downloading an item of a queue
        }
Пример #2
0
 void DownloadQueued()
 {
     ServiceRegistration.Get <IScreenManager>().CloseTopmostDialog();
     SaveVideo_Step1(DownloadList.Create(DownloadInfo.Create(VideoInfo, Category, OnlineVideoSettings.Instance.SiteUtilsList[SiteName])), true);
 }