Exemplo n.º 1
0
        private async Task AddTheUriToAria2Async(Movie getMovies)
        {
            await DownloadMediaFilesAsync(getMovies);


            var getMovieLink = getMovies.TranscoddedFiles
                               .Where(q => q.Resolution == HelperFunctions.FindMovieRes(getMovies.TranscoddedFiles))
                               .First();

            string saveToDir = GetDirPath(getMovies, getMovieLink);

            var url = getMovieLink.VideoUrl.ToString();

            Console.WriteLine(url);
            var downloadInstant = _aria2Client.AddUri(url, 1, null, 1, saveToDir, 100);

            Console.WriteLine("MOVIE ADDED TO THE QUEUE");
            Console.WriteLine(getMovies.Id);
            Console.WriteLine(getMovies.Nb);
            Console.WriteLine(getMovies.ArTitle);


            foreach (var item in await _aria2Client.TellActive())
            {
                Console.WriteLine(item.Files[0].Path);
            }


            getMovies.DownloadStatus    = CinemaMaxFeeder.Database.Model.MovieDownloadStatus.Started;
            getMovieLink.DownloadStatus = CinemaMaxFeeder.Database.Model.MovieDownloadStatus.Started;
            getMovieLink.DownloadRetry  = +1;

            getMovieLink.DownloadId = downloadInstant.Result;
            Console.WriteLine("ARIA ID: " + downloadInstant.Result);
            getMovieLink.StartDownloadAt = DateTime.Now;
            getMovies.StartDownloadAt    = DateTime.Now;
            getMovies.DownloadRetry      = +1;
            getMovies.DownloadId         = downloadInstant.Result;


            _movieContextDownloadQueue.SaveChanges();
        }
Exemplo n.º 2
0
 public static async Task <string> UriDownload(Aria2Client client)
 {
     return(await client.AddUri("https://speed.hetzner.de/1GB.bin"));
 }