Beispiel #1
0
 // bool initServers = false
 public static DownloadAutomateManagerCreator GetDownloadAutomateManagerCreator(NamedValues<ZValue> parameters, bool test)
 {
     //if (initServers)
     //    InitServers();
     DownloadAutomateManagerCreator downloadAutomateManagerCreator = new DownloadAutomateManagerCreator();
     downloadAutomateManagerCreator.Init(GetDownloadAutomateManagerConfig(test), XmlConfig.CurrentConfig);
     if (parameters != null)
         downloadAutomateManagerCreator.SetParameters(parameters);
     return downloadAutomateManagerCreator;
 }
Beispiel #2
0
        // bool initServers = false
        public static DownloadAutomateManagerCreator GetDownloadAutomateManagerCreator(NamedValues <ZValue> parameters, bool test)
        {
            //if (initServers)
            //    InitServers();
            DownloadAutomateManagerCreator downloadAutomateManagerCreator = new DownloadAutomateManagerCreator();

            downloadAutomateManagerCreator.Init(GetDownloadAutomateManagerConfig(test), XmlConfig.CurrentConfig);
            if (parameters != null)
            {
                downloadAutomateManagerCreator.SetParameters(parameters);
            }
            return(downloadAutomateManagerCreator);
        }
Beispiel #3
0
        public static DownloadAutomateManager CreateDownloadAutomateManagerWithServers(string parameters = null)
        {
            //NamedValues<ZValue> parameters2 = NamedValues.ParseValues(parameters);
            NamedValues <ZValue> parameters2 = ParseParameters(parameters);
            bool test = WebData.GetTestValue(parameters2);
            DownloadAutomateManagerCreator downloadAutomateManagerCreator = GetDownloadAutomateManagerCreator(parameters2, test);
            DownloadAutomateManager        downloadAutomateManager        = downloadAutomateManagerCreator.Create();

            //InitServers(test);
            InitServers_v2(test);
            downloadAutomateManager.AddServerManagers(downloadAutomateManagerCreator.CreateServerManagers());
            return(downloadAutomateManager);
        }
Beispiel #4
0
        public static void DownloadFile(string url, string directory = null, bool startNow = false, string parameters = null)
        {
            //NamedValues<ZValue> parameters2 = NamedValues.ParseValues(parameters);
            NamedValues <ZValue>      parameters2           = ParseParameters(parameters);
            DownloadManagerClientBase downloadManagerClient = DownloadAutomateManagerCreator.CreateDownloadManagerClient(GetDownloadAutomateManagerConfig(GetTestValue(parameters2)));
            Debrider debrider = DownloadAutomateManagerCreator.CreateDebrider(XmlConfig.CurrentConfig);

            url = debrider.DebridLink(url);
            Uri    uri  = new Uri(url);
            string file = uri.Segments[uri.Segments.Length - 1];

            if (directory != null)
            {
                file = zPath.Combine(directory, file);
            }
            downloadManagerClient.AddDownload(url, file, startNow: startNow);
        }
Beispiel #5
0
        public static PrintFileManager_v2 CreatePrintFileManager_v2(UncompressQueueManager uncompressManager = null, bool simulate = false, bool moveFiles = false, bool moveInfoFiles = false)
        {
            DownloadAutomateManagerCreator downloadAutomateManagerCreator = GetDownloadAutomateManagerCreator();

            if (uncompressManager == null)
            {
                uncompressManager = downloadAutomateManagerCreator.CreateUncompressManager();
            }
            RegexValuesList     bonusDirectories = new RegexValuesList(XmlConfig.CurrentConfig.GetConfig("PrintList2Config").GetElements("BonusDirectories/Directory"), compileRegex: true);
            PrintFileManager_v2 printFileManager = new PrintFileManager_v2();

            printFileManager.Simulate          = simulate;
            printFileManager.MoveFiles         = moveFiles;
            printFileManager.MoveInfoFiles     = moveInfoFiles;
            printFileManager.UncompressManager = uncompressManager;
            printFileManager.BonusDirectories  = bonusDirectories;
            return(printFileManager);
        }
Beispiel #6
0
 public static DownloadManagerClientBase CreateDownloadManagerClient(string parameters = null, bool useTestManager = false)
 {
     return(DownloadAutomateManagerCreator.CreateDownloadManagerClient(GetDownloadAutomateManagerConfig(GetTestValue(ParseParameters(parameters))), useTestManager));
 }
Beispiel #7
0
        // add an item to mongoQueueDownloadFile
        public static void QueueDownloadFile(string[] filePartLinks, string directory = null, string filename = null, string parameters = null)
        {
            //NamedValues<ZValue> parameters2 = NamedValues.ParseValues(parameters);
            NamedValues <ZValue> parameters2 = ParseParameters(parameters);
            MongoCollectionManager <QueueDownloadFile> mongoQueueDownloadFileManager = DownloadAutomateManagerCreator.CreateMongoQueueDownloadFileManager(GetDownloadAutomateManagerConfig(GetTestValue(parameters2)));

            QueueDownloadFile(mongoQueueDownloadFileManager, filePartLinks, directory, filename);
        }
Beispiel #8
0
        public static void QueueDownloadFiles(string[] fileLinks, string directory = null, string parameters = null)
        {
            //NamedValues<ZValue> parameters2 = NamedValues.ParseValues(parameters);
            NamedValues <ZValue> parameters2 = ParseParameters(parameters);
            MongoCollectionManager <QueueDownloadFile> mongoQueueDownloadFileManager = DownloadAutomateManagerCreator.CreateMongoQueueDownloadFileManager(GetDownloadAutomateManagerConfig(GetTestValue(parameters2)));

            foreach (string fileLink in fileLinks)
            {
                QueueDownloadFile(mongoQueueDownloadFileManager, new string[] { fileLink }, directory: directory);
            }
        }