Esempio n. 1
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();
        }
Esempio n. 2
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();
        }
Esempio n. 3
0
        public void readAndParse()
        {
            // Local Subs
            if (localMode == 1 || localMode == 2)
            {
                String[]      dengus      = File.ReadAllLines(Settings.Default.Path + "localsubs");
                List <string> newVidsList = new List <string>();

                for (int i = 0; i < dengus.Length; i++)
                {
                    while (true)
                    {
                        try
                        {
                            XmlReader reader = XmlReader.Create("https://gdata.youtube.com/feeds/api/users/" + dengus[i] + "/uploads?max-results=" + Settings.Default.DownloadQueue);
                            newVids = SyndicationFeed.Load(reader);
                            reader.Close();
                        }
                        catch (WebException e)
                        {
                            writeToLog(e.ToString());
                            continue;
                        }
                        break;
                    }

                    foreach (var item in newVids.Items)
                    {
                        newVidsList.Add(item.Title.Text);
                    }
                }

                ids    = new String[newVidsList.Count];
                names  = new String[newVidsList.Count];
                titles = new String[newVidsList.Count];

                newVidsList.CopyTo(titles);

                int i2 = 0;

                for (int i = 0; i < dengus.Length; i++)
                {
                    XmlReader reader = XmlReader.Create("https://gdata.youtube.com/feeds/api/users/" + dengus[i] + "/uploads?max-results=" + Settings.Default.DownloadQueue);
                    newVids = SyndicationFeed.Load(reader);
                    reader.Close();

                    foreach (var item in newVids.Items)
                    {
                        ids[i2] = item.Id.ToString();
                        ids[i2] = ids[i2].Remove(0, (ids[i2].LastIndexOf("/") + 1));

                        foreach (var author in item.Authors)
                        {
                            if (author.Name.StartsWith("UC"))
                            {
                                names[i2] = author.Name.Substring(2);
                            }
                            else
                            {
                                names[i2] = author.Name;
                            }
                        }

                        i2++;
                    }
                }

                window.set_list_text(newVidsList);
            }

            // Normal Subs
            if (localMode == 0 || localMode == 2)
            {
                // getQueue() doesn't support localsubs yet
                window.set_list_text(getQueue());
            }
        }