Example #1
0
        private void setVars(String username1, String password1, String context, Main ui)
        {
            username = username1;
            password = password1;
            whichapp = context;
            window = ui;

            if (Settings.Default.SubscriptionType==1)
            {
                localMode = 1;
            }

            if (Settings.Default.SubscriptionType==2)
            {
                localMode = 2;
            }
        }
Example #2
0
        public void SubSync(String user, String pass, Main ui)
        {
            String[] localsubs = File.Exists(Settings.Default.Path + "localsubs") ? File.ReadAllLines(Settings.Default.Path + "localsubs") : new String[1];
            String newsubs = "";

            ui.set_statusbar_text("Syncing subscriptions");

            if(request == null)
            {
                login(user, pass);
            }

            Feed<Subscription> videofeed;
            Uri requesturi = new Uri("https://gdata.youtube.com/feeds/api/users/default/subscriptions?max-results=50");
            videofeed = request.Get<Subscription>(requesturi);

            int pages = (videofeed.TotalResults / 50) + 1;
            int page = 0;

            for (int i = 0; i < pages; i++)
            {
                if(i > 0)
                {
                    requesturi = new Uri("https://gdata.youtube.com/feeds/api/users/default/subscriptions?max-results=50&start-index=" + page);
                    videofeed = request.Get<Subscription>(requesturi);
                }

                foreach (var item in videofeed.Entries)
                {
                    if (!localsubs.Contains<String>(item.UserName))
                    {
                        newsubs += item.UserName + "\n";
                    }
                }

                if (page == 951)
                {
                    break;
                }

                page += 50;
            }

            foreach (var sub in localsubs)
            {
                newsubs += sub + "\n";
            }

            File.WriteAllText(Settings.Default.Path + "localsubs", newsubs);

            MessageBox.Show("Sync Completed!");
            ui.set_statusbar_text("Idle");
        }
Example #3
0
        public void watch(String username1, String password1, String context, Main ui, int fromSelf)
        {
            if (fromSelf != 1)
            {
                writeToLog("Started Watching.");
                ui.EnableButton(false);
                ui.set_button1_text("Watching...");
                setVars(username1, password1, context, ui);
                login(username, password);
            }

            readAndParse();
            downloadVids();
            ui.set_statusbar_text("Waiting " + Settings.Default.Delay.ToString() + " minute(s)...");
            ui.set_list_text(new List<string>());

            if ((Settings.Default.Async) && (currentlyDownloading.Count > 0))
            {
                window.set_statusbar_text("Downloading " + currentlyDownloading.Count + " video(s).");
            }

            Thread.Sleep(Convert.ToInt32(Settings.Default.Delay * 1000) * 60);
            ui.newThread();
        }
Example #4
0
        public void setQueueDownloaded(String username1, String password1, String context, Main ui)
        {
            String databasepath = Settings.Default.Path + "downloaded";
            String[] dungus = File.ReadAllLines(databasepath);
            setVars(username1, password1, context, ui);
            getQueue();

            foreach (var video in ids)
            {
                if (!dungus.Contains<string>(video))
                {
                    System.IO.File.AppendAllText(databasepath, video + "\n");
                }
            }
        }