Example #1
0
        private void Start(IList <PublishTimeCalculator> infos)
        {
            LOGGER.Info($"Starting auto uploader");
            if (Account == null || Uploader == null)
            {
                LOGGER.Error($"Either the account or the uploader were not set - can't start auto uploader!");
                return;
            }

            State = RunningState.Running;

            WatchedProcesses.ProcessesCompleted += OnProcessesCompleted;

            VideoCreator = new TemplateVideoCreator(infos, PscContainer);

            Uploader.PropertyChanged    += UploaderPropertyChanged;
            Searcher.PropertyChanged    += SearcherPropertyChanged;
            Uploader.StopAfterCompleting = false;

            Searcher.FileFound         += OnFileToUploadOccured;
            DirectoryWatcher.FileAdded += OnFileToUploadOccured;

            foreach (var config in Configuration.Where(c => !c.IgnorePath && Directory.Exists(c.PathInfo.Fullname)))
            {
                LOGGER.Info($"Starting file searcher and directory watcher for configuration for template '{config.Template.Name}' and path '{config.PathInfo.Fullname}'");

                var pathInfo = config.PathInfo;
                Searcher.SearchFilesAsync(pathInfo.Fullname, pathInfo.Filter, pathInfo.SearchRecursively, pathInfo.SearchHidden, pathInfo.SearchOrder);
                DirectoryWatcher.AddWatcher(pathInfo.Fullname, pathInfo.Filter, pathInfo.SearchRecursively);
            }

            LOGGER.Info($"Starting youtube uploader");
            Uploader.StartUploader();

            LOGGER.Info($"Auto uploader was started successfully");
        }