public void RevokeAccounts(IYoutubeAccountContainer container, IEnumerable <IYoutubeAccount> accounts) { foreach (var account in accounts) { RevokeAccount(container, account); } }
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); }
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()); }
public AccountPersistor(IYoutubeAccountContainer container, string path, IYoutubeClientContainer clients) { LOGGER.Debug($"Creating account persistor for path '{path}'"); Path = path; Container = container; Clients = clients; }
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()); }
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; }