Ejemplo n.º 1
0
        private void browseBox_DoubleClick(object sender, EventArgs e)
        {
            if (browseBox.SelectedIndex == -1)
            {
                return;
            }
            else if (browseBox.SelectedItem is string && browseBox.SelectedItem.ToString() == LOADMORE)
            {
                browseBox.Items.Remove(LOADMORE);
                currentPage++;
                NextBrowse();
                browseBox.Items.Add(LOADMORE);
            }
            else
            {
                System.Console.WriteLine(browseBox.SelectedItem.GetType());
                ContentSeriesInfo link   = ((SeriesInfoBinding)browseBox.SelectedItem).Show;
                BaseCDNModule     module = moduleCombo.SelectedItem as BaseCDNModule;

                titleLabel.Text = link.Name;
                //Load cover image
                Stream stream = client.OpenRead(link.ImgLink);
                coverPicture.Image = new Bitmap(stream);
                stream.Close();
                //change listings
                ChangeListing(module.GetContentList(link.Link));
            }
        }
Ejemplo n.º 2
0
        private void manualButton_Click(object sender, EventArgs e)
        {
            BaseCDNModule module = moduleCombo.SelectedItem as BaseCDNModule;
            ContentSeries show   = module.GetContentList(manualBox.Text);

            ChangeListing(show);
        }
Ejemplo n.º 3
0
        private void NextBrowse()
        {
            BaseCDNModule module = moduleCombo.SelectedItem as BaseCDNModule;

            ContentSeriesInfo[] links = module.Browse(searchBox.Text, currentPage);
            foreach (ContentSeriesInfo link in links)
            {
                browseBox.Items.Add(new SeriesInfoBinding(link));
            }
        }
Ejemplo n.º 4
0
        private void listingBox_DoubleClick(object sender, EventArgs e)
        {
            if (listingBox.SelectedIndex == -1)
            {
                return;
            }
            BaseCDNModule     module = moduleCombo.SelectedItem as BaseCDNModule;
            SeriesInstallment ep     = ((InstallmentBinding)listingBox.SelectedItem).Episode;

            ContentResource[] links = module.GetContentLink(ep.SiteLink);

            mediaTitleLabel.Text = ep.Name;
            linkBox.Items.Clear();
            foreach (ContentResource link in links)
            {
                linkBox.Items.Add(link);
            }
            pics = new Bitmap[links.Length];
            tabControl1.SelectedIndex = 1;
        }
Ejemplo n.º 5
0
        public string Request(string path, NameValueCollection query)
        {
            string[] pathing     = path.Split('/');
            string   requestPath = string.Join("/", pathing, 1, pathing.Length - 1);
            string   result      = "";

            string moduleName = pathing[0];

            if (Modules.ContainsKey(moduleName))
            {
                BaseCDNModule module = Modules[moduleName];
                switch (requestPath)
                {
                case "browse":
                    string queryString        = query["query"];
                    int    page               = Convert.ToInt32(query["page"]);
                    ContentSeriesInfo[] infos = module.Browse(queryString, page);
                    result = string.Join("\n", (object[])infos);
                    break;

                case "get_list":
                    string        listPath = query["path"];
                    ContentSeries series   = module.GetContentList(listPath);
                    result = series.Name + "\n" + string.Join("\n", (object[])series.Installments);
                    break;

                case "get_link":
                    string linkPath = query["path"];
                    result = string.Join("\n", (object[])module.GetContentLink(linkPath));
                    break;

                default:
                    Console.WriteLine("-> Bad request: " + requestPath);
                    break;
                }
            }

            return(result);
        }
Ejemplo n.º 6
0
        static void OldMain(string[] args)
        {
            Dictionary <string, BaseCDNModule> modules = new Dictionary <string, BaseCDNModule>();

            modules.Add("dailymotion", new DailymotionModule("dailymotion"));

            modules.Add("youtube", new YoutubeModule("youtube"));

            if (Directory.Exists(".\\Modules\\"))
            {
                foreach (string file in Directory.GetFiles(".\\Modules\\"))
                {
                    string name = Path.GetFileNameWithoutExtension(file);
                    modules.Add(name, new ScriptedProvider(name, file));
                    Console.WriteLine("Loaded Module: " + name);
                }
            }

            client          = new WebClient();
            client.Encoding = Encoding.UTF8;
            HttpListener listener = new HttpListener();

            listener.Prefixes.Add("http://*:6672/");

            listener.Start();

            char[] pathSplit = { '/' };
            while (listener.IsListening)
            {
                HttpListenerContext webContext = listener.GetContext();
                webContext.Response.ContentEncoding = Encoding.UTF8;

                string[] pathing = webContext.Request.Url.LocalPath.Split(pathSplit, StringSplitOptions.RemoveEmptyEntries);
                //string requestType = string.Join("/", pathing, 1, pathing.Length - 1);
                string requestPath = string.Join("/", pathing);
                string moduleName  = pathing[0];
                Console.WriteLine("{0} - {1}: {2}", DateTime.Now, webContext.Request.RemoteEndPoint.Address, requestPath);
                bool sucess = false;

                if (modules.ContainsKey(moduleName))
                {
                    requestPath = string.Join("/", pathing, 1, pathing.Length - 1);
                    BaseCDNModule module = modules[moduleName];
                    Console.WriteLine("-> Module " + moduleName);
                    string result = null;// module.Request(requestPath, webContext.Request.QueryString);
                    switch (requestPath)
                    {
                    case "browse":
                        string query = webContext.Request.QueryString["query"];
                        int    page  = Convert.ToInt32(webContext.Request.QueryString["page"]);
                        ContentSeriesInfo[] infos = module.Browse(query, page);
                        result = string.Join("\n", (object[])infos);
                        break;

                    case "get_list":
                        string        listPath = webContext.Request.QueryString["path"];
                        ContentSeries series   = module.GetContentList(listPath);
                        result = series.Name + "\n" + string.Join("\n", (object[])series.Installments);
                        break;

                    case "get_link":
                        string linkPath = webContext.Request.QueryString["path"];
                        result = string.Join("\n", (object[])module.GetContentLink(linkPath));
                        break;

                    default:
                        Console.WriteLine("-> Bad request: " + requestPath);
                        break;
                    }
                    if (result != null)
                    {
                        byte[] data = Encoding.UTF8.GetBytes(result);
                        sucess = WriteToOutputStream(data, webContext);
                    }
                }
                webContext.Response.OutputStream.Close();
            }
        }