示例#1
0
 public void RevokeAccounts(IYoutubeAccountContainer container, IEnumerable <IYoutubeAccount> accounts)
 {
     foreach (var account in accounts)
     {
         RevokeAccount(container, account);
     }
 }
示例#2
0
        public void RevokeAccount(IYoutubeAccountContainer container, IYoutubeAccount account)
        {
            LOGGER.Info($"Revoking connecgtion to account with id: {account.Id} and title: '{account.Title}'");

            YoutubeAccountService.RevokeAccessOfAccount(account);
            container.UnregisterAccount(account);
        }
示例#3
0
        public static IReadOnlyList <ILanguage> LoadLanguages(IYoutubeAccountContainer container)
        {
            if (!loaded)
            {
                var communicator = new YoutubeAccountCommunicator();
                if (container.RegisteredAccounts.Count > 0)
                {
                    var account = container.RegisteredAccounts.First();

                    LOGGER.Info($"Loading languages for account with id: '{account.Id}', title: '{account.Title}'");

                    languages = GetLanguages(account.GetActiveToken()).ToList();
                }
                else
                {
                    LOGGER.Info($"No accounts registered => using fallback languages");

                    // Fallback
                    foreach (var lang in StandardLanguages.Languages)
                    {
                        LOGGER.Info($"Adding language with id: {lang.Id}, hl: {lang.Hl} and title: '{lang.Name}'");

                        languages.Add(lang);
                    }
                }

                loaded = true;
            }
            else
            {
                LOGGER.Info($"Languages were already loaded");
            }

            return(languages.AsReadOnly());
        }
示例#4
0
        public AccountPersistor(IYoutubeAccountContainer container, string path, IYoutubeClientContainer clients)
        {
            LOGGER.Debug($"Creating account persistor for path '{path}'");

            Path      = path;
            Container = container;
            Clients   = clients;
        }
示例#5
0
        public PathForm(IPathContainer pathContainer, ITemplateContainer templateContainer, IYoutubeJobContainer queueContainer, IYoutubeJobContainer archiveContainer, IYoutubeAccountContainer accountContainer)
        {
            LOGGER.Info($"Initializing new instance of PathForm");

            InitializeComponent();

            this.pathContainer     = pathContainer;
            this.templateContainer = templateContainer;

            this.queueContainer   = queueContainer;
            this.archiveContainer = archiveContainer;
            this.accountContainer = accountContainer;
        }
        public static IReadOnlyList <ICategory> LoadCategories(IYoutubeAccountContainer container)
        {
            if (!loaded)
            {
                var communicator = new YoutubeAccountCommunicator();
                if (container.RegisteredAccounts.Count > 0)
                {
                    var account = container.RegisteredAccounts.First();

                    var region = account.Region;
                    if (account.Region == null)
                    {
                        region = "de";
                    }

                    LOGGER.Info($"Loading categores for account with id: '{account.Id}', title: '{account.Title}' and region: {region}");

                    categories = GetVideoCategories(region, account.GetActiveToken()).ToList();
                }
                else
                {
                    LOGGER.Info($"No accounts registered => using fallback categories");

                    // Fallback
                    foreach (var cat in StandardCategories.Categories)
                    {
                        LOGGER.Info($"Adding category with id: {cat.Id} and title: '{cat.Title}'");

                        categories.Add(cat);
                    }
                }

                loaded = true;
            }
            else
            {
                LOGGER.Info($"Categories were already loaded");
            }

            return(categories.AsReadOnly());
        }
示例#7
0
        public void MarkAllFilesAsRead(IPath path, IYoutubeJobContainer queueContainer, IYoutubeJobContainer archiveContainer, IYoutubeAccountContainer accountContainer)
        {
            LOGGER.Info($"Marking all files from path '{path.Fullname}' as read");

            this.archiveContainer = archiveContainer;
            this.accountContainer = accountContainer;
            this.queueContainer   = queueContainer;

            FileSearcher searcher = new FileSearcher();

            searcher.FileFound += SearcherFileFound;

            searcher.SearchFilesAsync(path.Fullname, path.Filter, path.SearchRecursively, path.SearchHidden, path.SearchOrder);

            while (searcher.State != RunningState.NotRunning)
            {
                Thread.Sleep(5);
            }

            LOGGER.Info($"Finished marking all files from path '{path.Fullname}' as read");
        }
		public LanguageCategoryLoader(IYoutubeAccountContainer container)
		{
			Container = container;
		}