Пример #1
0
        private static void Download()
        {
            try
            {
                while (_isStarted)
                {
                    try
                    {
                        DbFile dbf = Db.FileToDownload();
                        if (dbf == null)
                        {
                            Task.Delay(WAIT).Wait();
                            continue;
                        }
                        DownloadLink dl = DownloadLink.Parse(dbf.DownloadLink);
                        if (dl == null)
                        {
                            Logger.Warn(LOGNAME, "Cannot parse DownloadLink: " + dbf.Id);
                            continue;
                        }

                        //ne pas faire de savoir pr ne pas ecraser le fichier Database
                        if (DownloadProcess(dl, Utilities.FolderDownload) == true)
                        {
                            //todo a revoir
                        }
                        else
                        {
                            //todo a revoir
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.Error(LOGNAME, ex.Message, ex);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error(LOGNAME, ex.Message, ex);
            }
        }
Пример #2
0
 private static void ModeDownload(string dlLink, string outputDir)
 {
     try
     {
         if (string.IsNullOrEmpty(outputDir))
         {
             outputDir = Utilities.FolderDownload;
         }
         DownloadLink dl = DownloadLink.Parse(dlLink);
         if (dl == null)
         {
             Console.WriteLine("Invalid Link");
             return;
         }
         FileDownloader.DownloadSingleFile(dl, outputDir);
     }
     catch (Exception ex)
     {
         Logger.Error(LOGNAME, ex.Message, ex);
     }
 }
Пример #3
0
 private static void ModeConvert(string dlLink, string outputDir)
 {
     try
     {
         DownloadLink dl = DownloadLink.Parse(dlLink);
         if (dl == null)
         {
             Console.WriteLine("Invalid Link");
             return;
         }
         if (dl.ToNzb(outputDir) == true)
         {
             Console.WriteLine("Nzb successfully generated");
         }
         else
         {
             Console.WriteLine("An error occured processing Nzb");
         }
     }
     catch (Exception ex)
     {
         Logger.Error(LOGNAME, ex.Message, ex);
     }
 }