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

            Path      = path;
            Container = container;
            Clients   = clients;
        }
Exemplo n.º 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;
        }
Exemplo n.º 6
0
        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());
        }
Exemplo n.º 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");
        }
Exemplo n.º 8
0
		public LanguageCategoryLoader(IYoutubeAccountContainer container)
		{
			Container = container;
		}