Ejemplo n.º 1
0
        private static async Task <bool> CanEnqueueDownload(CatalogItem item, DownloadableNamedUri media, BatchApiParams parameters)
        {
            Logger.Debug($"Parameters are valid {parameters.AreValid}");
            var local = await AppContext.LocalScraper.GetAsync(item.GroupName, item.KindName, item.Name);

            if (local == null || local.Media.Local.All(x =>
                                                       string.Compare(x.Name, media.GetFileName(), StringComparison.OrdinalIgnoreCase) != 0))
            {
                return(true);
            }
            Logger.Debug("Skipping " + item.Name + " already in local");
            return(false);
        }
Ejemplo n.º 2
0
 public static string GetFileName(this DownloadableNamedUri downloadableUri, string extension = ".mp4")
 {
     return((downloadableUri.Name + extension).ToSafeName());
 }
Ejemplo n.º 3
0
        private static async Task <bool> EnqueueDownload(BatchApiParams apiParams, CatalogItem tvshow, DownloadableNamedUri item)
        {
            Logger.Debug("Getting media urls of " + item.Name);
            var mediaUrl = (await apiParams.Scraper.GetMediaUrlsAsync(item.Url)).FirstOrDefault();

            if (mediaUrl == null)
            {
                return(false);
            }
            var downloadUrl = await apiParams.Scraper.GetMediaDownloadUrlAsync(mediaUrl.Url);

            var file = tvshow.GetMediaPath(item.GetFileName());

            Logger.Debug("Enqueuing download: " + item.GetFileName());
            AppContext.FileDownloader.Enqueue(item.UId, file, new Uri(downloadUrl), Web.CookieContainer);
            return(true);
        }