Пример #1
0
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

            res.FolderType = 1;
            string url = string.Format("http://gdata.youtube.com/feeds/api/playlists/{0}", entry.GetValue("id"));

            if (!string.IsNullOrEmpty(entry.GetValue("url")))
            {
                url = entry.GetValue("url");
            }
            YouTubeQuery query = new YouTubeQuery(url);

            query.NumberToRetrieve = 50;
            do
            {
                YouTubeFeed videos = Youtube2MP.service.Query(query);
                res.Title = videos.Title.Text;
                foreach (YouTubeEntry youTubeEntry in videos.Entries)
                {
                    res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(youTubeEntry));
                }
                query.StartIndex += 50;
                if (videos.TotalResults < query.StartIndex + 50)
                {
                    break;
                }
            } while (true);
            res.ItemType = ItemType.Video;
            return(res);
        }
        public void SetEntry(SiteItemEntry entry)
        {
            loading = true;
              _entry = entry;
              cmb_time.Items.Clear();
              cmb_standardfeed.Items.Clear();
              cmb_region.Items.Clear();
              cmb_time.Items.Add("");
              foreach (string s in Youtube2MP._settings.TimeList)
              {
            cmb_time.Items.Add(s);
              }

              cmb_standardfeed.Items.AddRange(Youtube2MP._settings.Cats.ToArray());
              cmb_standardfeed.SelectedIndex = 0;

              cmb_region.Items.Add("");
              foreach (KeyValuePair<string, string> valuePair in Youtube2MP._settings.Regions)
              {
            cmb_region.Items.Add(valuePair.Key);
              }

              _entry.PharseSettings(entry.ConfigString);
              txt_title.Text = _entry.GetValue("title");
              cmb_region.SelectedItem = _entry.GetValue("region");
              cmb_time.SelectedItem = _entry.GetValue("time");
              cmb_standardfeed.SelectedItem = _entry.GetValue("feed");
              loading = false;
        }
        public void SetEntry(SiteItemEntry entry)
        {
            loading = true;
            _entry  = entry;
            int i = 0;

            int.TryParse(_entry.GetValue("items"), out i);
            numericUpDown1.Value = i;
            if (numericUpDown1.Value < 2)
            {
                numericUpDown1.Value = 2;
            }
            if (_entry.GetValue("flat") == "true")
            {
                checkBox1.Checked = true;
            }
            else
            {
                checkBox1.Checked = false;
            }

            txt_title.Text = _entry.GetValue("title");
            loading        = false;
            if (string.IsNullOrEmpty(txt_title.Text))
            {
                txt_title.Text = "Search History";
            }
        }
Пример #4
0
        public void SetEntry(SiteItemEntry entry)
        {
            loading = true;
            _entry  = entry;
            cmb_time.Items.Clear();
            cmb_standardfeed.Items.Clear();
            cmb_region.Items.Clear();
            cmb_time.Items.Add("");
            foreach (string s in Youtube2MP._settings.TimeList)
            {
                cmb_time.Items.Add(s);
            }

            cmb_standardfeed.Items.AddRange(Youtube2MP._settings.Cats.ToArray());
            cmb_standardfeed.SelectedIndex = 0;

            cmb_region.Items.Add("");
            foreach (KeyValuePair <string, string> valuePair in Youtube2MP._settings.Regions)
            {
                cmb_region.Items.Add(valuePair.Key);
            }

            _entry.PharseSettings(entry.ConfigString);
            txt_title.Text                = _entry.GetValue("title");
            cmb_region.SelectedItem       = _entry.GetValue("region");
            cmb_time.SelectedItem         = _entry.GetValue("time");
            cmb_standardfeed.SelectedItem = _entry.GetValue("feed");
            loading = false;
        }
        public void SetEntry(SiteItemEntry entry)
        {
            loading = true;
              _entry = entry;

              txt_title.Text = _entry.GetValue("title");
              txt_id.Text = _entry.GetValue("id");
              loading = false;
        }
Пример #6
0
        public void SetEntry(SiteItemEntry entry)
        {
            loading = true;
            _entry  = entry;

            txt_title.Text = _entry.GetValue("title");
            txt_user.Text  = _entry.GetValue("id");
            loading        = false;
        }
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

            if (entry.GetValue("all") == "true" && entry.GetValue("level") != "false")
            {
                res.Title = entry.Title;
                foreach (KeyValuePair <string, string> keyValuePair in Feeds)
                {
                    SiteItemEntry newentry  = new SiteItemEntry();
                    BillboardItem videoItem = new BillboardItem();
                    newentry.Provider = videoItem.Name;
                    newentry.Title    = keyValuePair.Key;
                    newentry.SetValue("feed", keyValuePair.Key);
                    res.Items.Add(new GenericListItem()
                    {
                        IsFolder = false,
                        Title    = newentry.Title,
                        Tag      = newentry
                    });
                }
            }
            else
            {
                string rssurl = Feeds[entry.GetValue("feed")];
                res.ItemType = ItemType.Video;
                Uri        uri          = new Uri(rssurl);
                RssChannel myRssChannel = new RssChannel(uri);
                res.Title = myRssChannel.Title;
                foreach (RssItem item in myRssChannel.Items)
                {
                    SiteItemEntry newentry  = new SiteItemEntry();
                    VideoItem     videoItem = new VideoItem();
                    newentry.Provider = videoItem.Name;
                    newentry.Title    = item.Title;
                    newentry.SetValue("level", "false");
                    string[] title = item.Title.Split(',');
                    newentry.SetValue("search", title[1].Trim() + " - " + title[0].Split(':')[1]);
                    res.Items.Add(new GenericListItem()
                    {
                        IsFolder     = false,
                        Title        = newentry.Title,
                        Tag          = newentry,
                        LogoUrl      = ArtistManager.Instance.GetArtistsImgUrl(GetArtistName(title[1])),
                        DefaultImage = "defaultArtistBig.png"
                    });
                }
            }
            return(res);
        }
 public GenericListItemCollections GetList(SiteItemEntry entry)
 {
     GenericListItemCollections res = new GenericListItemCollections();
       if (entry.GetValue("all") == "true" && entry.GetValue("level") != "false")
       {
     res.Title = entry.Title;
     foreach (KeyValuePair<string, string> keyValuePair in Feeds)
     {
       SiteItemEntry newentry = new SiteItemEntry();
       BillboardItem videoItem = new BillboardItem();
       newentry.Provider = videoItem.Name;
       newentry.Title = keyValuePair.Key;
       newentry.SetValue("feed", keyValuePair.Key);
       res.Items.Add(new GenericListItem()
       {
     IsFolder = false,
     Title = newentry.Title,
     Tag = newentry
       });
     }
       }
       else
       {
     string rssurl = Feeds[entry.GetValue("feed")];
     res.ItemType = ItemType.Video;
     Uri uri = new Uri(rssurl);
     RssChannel myRssChannel = new RssChannel(uri);
     res.Title = myRssChannel.Title;
     foreach (RssItem item in myRssChannel.Items)
     {
       SiteItemEntry newentry = new SiteItemEntry();
       VideoItem videoItem = new VideoItem();
       newentry.Provider = videoItem.Name;
       newentry.Title = item.Title;
       newentry.SetValue("level", "false");
       string[] title = item.Title.Split(',');
       newentry.SetValue("search", title[1].Trim() + " - " + title[0].Split(':')[1]);
       res.Items.Add(new GenericListItem()
                   {
                     IsFolder = false,
                     Title = newentry.Title,
                     Tag = newentry,
                     LogoUrl = ArtistManager.Instance.GetArtistsImgUrl(GetArtistName(title[1])),
                     DefaultImage = "defaultArtistBig.png"
                   });
     }
       }
       return res;
 }
        public void SetEntry(SiteItemEntry entry,string[] entries)
        {
            loading = true;
              _entry = entry;

              cmb_standardfeed.Items.Clear();

              cmb_standardfeed.Items.AddRange(entries);
              cmb_standardfeed.SelectedIndex = 0;

              _entry.PharseSettings(entry.ConfigString);
              txt_title.Text = _entry.GetValue("title");
              cmb_standardfeed.SelectedItem = _entry.GetValue("feed");
              chk_all.Checked = _entry.GetValue("all") == "true";
              loading = false;
        }
Пример #10
0
        public void SetEntry(SiteItemEntry entry, string[] entries)
        {
            loading = true;
            _entry  = entry;

            cmb_standardfeed.Items.Clear();

            cmb_standardfeed.Items.AddRange(entries);
            cmb_standardfeed.SelectedIndex = 0;

            _entry.PharseSettings(entry.ConfigString);
            txt_title.Text = _entry.GetValue("title");
            cmb_standardfeed.SelectedItem = _entry.GetValue("feed");
            chk_all.Checked = _entry.GetValue("all") == "true";
            loading         = false;
        }
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

            res.Title = entry.Title;
            Country country = new Country(entry.GetValue("country"), Youtube2MP.LastFmProfile.Session);

            TopTrack[] tracks = country.GetTopTracks();
            foreach (TopTrack topTrack in tracks)
            {
                SiteItemEntry newentry  = new SiteItemEntry();
                VideoItem     videoItem = new VideoItem();
                newentry.Provider = videoItem.Name;
                newentry.Title    = topTrack.Item.ToString();
                res.Items.Add(new GenericListItem()
                {
                    IsFolder     = false,
                    Title        = newentry.Title,
                    Tag          = newentry,
                    LogoUrl      = ArtistManager.Instance.GetArtistsImgUrl(topTrack.Item.Artist.Name),
                    DefaultImage = "defaultArtistBig.png"
                });
            }
            res.ItemType = ItemType.Video;
            return(res);
        }
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

            res.FolderType = 1;
            string user = entry.GetValue("user");

            user = string.IsNullOrEmpty(user) ? "default" : user;
            YouTubeQuery query =
                new YouTubeQuery(string.Format("http://gdata.youtube.com/feeds/api/users/{0}/favorites", user));

            query.NumberToRetrieve = Youtube2MP.ITEM_IN_LIST;
            query.StartIndex       = entry.StartItem;
            if (entry.StartItem > 1)
            {
                res.Paged = true;
            }
            YouTubeFeed videos = Youtube2MP.service.Query(query);

            res.Title = videos.Title.Text;
            foreach (YouTubeEntry youTubeEntry in videos.Entries)
            {
                res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(youTubeEntry));
            }
            res.Add(Youtube2MP.GetPager(entry, videos));
            res.ItemType = ItemType.Video;
            return(res);
        }
Пример #13
0
        public GenericListItemCollections HomeGetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

            string       feedUrl = "http://gdata.youtube.com/feeds/api/users/" + entry.GetValue("id");
            ProfileEntry profile = (ProfileEntry)Youtube2MP.service.Get(feedUrl);

            string img = "";

            try
            {
                foreach (IExtensionElementFactory factory in profile.ExtensionElements)
                {
                    if (factory.XmlName == "thumbnail")
                    {
                        img = ((Google.GData.Extensions.XmlExtension)factory).Node.Attributes[0].Value;
                    }
                }
            }
            catch
            {
            }
            entry.SetValue("imgurl", img);
            GenericListItem listItem = new GenericListItem()
            {
                Title    = entry.Title,
                IsFolder = true,
                LogoUrl  = img,
                Tag      = entry
            };

            res.Items.Add(listItem);
            return(res);
        }
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

            res.Title = entry.Title;
            int count = 0;
            int ii    = 0;

            int.TryParse(entry.GetValue("items"), out ii);

            for (int i = Youtube2MP._settings.SearchHistory.Count; i > 0; i--)
            {
                count++;
                SiteItemEntry newentry    = new SiteItemEntry();
                SearchVideo   searchVideo = new SearchVideo();
                newentry.Provider = searchVideo.Name;
                newentry.SetValue("term", Youtube2MP._settings.SearchHistory[i - 1]);
                GenericListItem listItem = new GenericListItem()
                {
                    Title    = "Search result for :" + Youtube2MP._settings.SearchHistory[i - 1],
                    IsFolder = true,
                    //LogoUrl = YoutubeGUIBase.GetBestUrl(youTubeEntry.Media.Thumbnails),
                    Tag = newentry
                };
                res.Items.Add(listItem);
                if (count > ii)
                {
                    break;
                }
            }
            return(res);
        }
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();
              res.Title = entry.Title;
              int count = 0;
              int ii = 0;
              int.TryParse(entry.GetValue("items"), out ii);

              for (int i = Youtube2MP._settings.SearchHistory.Count; i > 0; i--)
              {
            count++;
            SiteItemEntry newentry = new SiteItemEntry();
            SearchVideo searchVideo = new SearchVideo();
            newentry.Provider = searchVideo.Name;
            newentry.SetValue("term", Youtube2MP._settings.SearchHistory[i - 1]);
            GenericListItem listItem = new GenericListItem()
                                     {
                                       Title = "Search result for :" + Youtube2MP._settings.SearchHistory[i - 1],
                                       IsFolder = true,
                                       //LogoUrl = YoutubeGUIBase.GetBestUrl(youTubeEntry.Media.Thumbnails),
                                       Tag = newentry
                                     };
            res.Items.Add(listItem);
            if (count > ii)
              break;
              }
              return res;
        }
        public GenericListItemCollections HomeGetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

              string feedUrl = "http://gdata.youtube.com/feeds/api/users/"+entry.GetValue("id");
              ProfileEntry profile = (ProfileEntry)Youtube2MP.service.Get(feedUrl);

              string img = "";
              try
              {
            foreach (IExtensionElementFactory factory in profile.ExtensionElements)
            {
              if (factory.XmlName == "thumbnail")
            img = ((Google.GData.Extensions.XmlExtension)factory).Node.Attributes[0].Value;
            }
              }
              catch
              {
              }
              entry.SetValue("imgurl", img);
              GenericListItem listItem = new GenericListItem()
              {
            Title = entry.Title,
            IsFolder = true,
            LogoUrl = img,
            Tag = entry
              };
              res.Items.Add(listItem);
              return res;
        }
Пример #17
0
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

            res.Title = entry.Title;
            YouTubeQuery query =
                new YouTubeQuery(string.Format("http://gdata.youtube.com/feeds/api/users/{0}/uploads", entry.GetValue("id")));

            if (string.IsNullOrEmpty(entry.GetValue("id")))
            {
                query =
                    new YouTubeQuery(string.Format("http://gdata.youtube.com/feeds/api/users/default/uploads"));
            }
            query.NumberToRetrieve = Youtube2MP.ITEM_IN_LIST;
            query.StartIndex       = entry.StartItem;
            if (entry.StartItem > 1)
            {
                res.Paged = true;
            }
            YouTubeFeed videos = Youtube2MP.service.Query(query);

            res.Title = "Uploads by :" + videos.Authors[0].Name;
            foreach (YouTubeEntry youTubeEntry in videos.Entries)
            {
                res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(youTubeEntry));
            }
            res.Add(Youtube2MP.GetPager(entry, videos));
            res.ItemType = ItemType.Video;
            return(res);
        }
        public void SetEntry(SiteItemEntry entry)
        {
            loading = true;
              _entry = entry;

              txt_title.Text = _entry.GetValue("title");
              cmb_type.SelectedItem = entry.GetValue("type");
              loading = false;
        }
Пример #19
0
 private void txt_title_TextChanged(object sender, EventArgs e)
 {
     if (!loading)
     {
         _entry.SetValue("title", txt_title.Text);
         _entry.Title        = _entry.GetValue("title");
         _entry.ConfigString = _entry.GetConfigString();
     }
 }
Пример #20
0
        public void SetEntry(SiteItemEntry entry)
        {
            loading = true;
            _entry  = entry;

            txt_title.Text           = _entry.GetValue("title");
            cmb_country.SelectedItem = entry.GetValue("country");
            loading = false;
        }
Пример #21
0
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

            res.Title = entry.Title;
            User user = new User(Youtube2MP._settings.LastFmUser, Youtube2MP.LastFmProfile.Session);

            switch (entry.GetValue("type"))
            {
            case "TopTracks":
            {
                TopTrack[] tracks = user.GetTopTracks();
                //user.GetRecentTracks()
                foreach (TopTrack topTrack in tracks)
                {
                    SiteItemEntry newentry  = new SiteItemEntry();
                    VideoItem     videoItem = new VideoItem();
                    newentry.Provider = videoItem.Name;
                    newentry.Title    = topTrack.Item.ToString();
                    res.Items.Add(new GenericListItem()
                        {
                            IsFolder     = false,
                            Title        = newentry.Title,
                            Tag          = newentry,
                            LogoUrl      = ArtistManager.Instance.GetArtistsImgUrl(topTrack.Item.Artist.Name),
                            DefaultImage = "defaultArtistBig.png"
                        });
                }
            }
            break;

            case "RecentTracks":
            {
                Track[] tracks = user.GetRecentTracks(40);
                //user.GetRecentTracks()
                foreach (Track topTrack in tracks)
                {
                    SiteItemEntry newentry  = new SiteItemEntry();
                    VideoItem     videoItem = new VideoItem();
                    newentry.Provider = videoItem.Name;
                    newentry.Title    = topTrack.ToString();
                    res.Items.Add(new GenericListItem()
                        {
                            IsFolder     = false,
                            Title        = newentry.Title,
                            Tag          = newentry,
                            LogoUrl      = ArtistManager.Instance.GetArtistsImgUrl(topTrack.Artist.Name),
                            DefaultImage = "defaultArtistBig.png"
                        });
                }
            }
            break;
            }
            res.ItemType = ItemType.Video;
            return(res);
        }
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

            res.Title = entry.Title;
            if (string.IsNullOrEmpty(entry.GetValue("level")))
            {
                for (int i = 0; i < stats.Count; i++)
                {
                    SiteItemEntry newentry   = new SiteItemEntry();
                    Statistics    statistics = new Statistics();
                    newentry.Provider = statistics.Name;
                    newentry.Title    = stats[i];
                    newentry.SetValue("level", i.ToString());
                    res.Items.Add(new GenericListItem()
                    {
                        IsFolder = true,
                        Title    = newentry.Title,
                        Tag      = newentry,
                        //LogoUrl = ArtistManager.Instance.GetArtistsImgUrl(GetArtistName(title[1]))
                    });
                }
            }
            if (entry.GetValue("level") == "0")//Recently played videos
            {
                res          = DatabaseProvider.InstanInstance.GetRecentlyPlayed();
                res.Title    = Name + "/" + stats[0];
                res.ItemType = ItemType.Video;
            }
            if (entry.GetValue("level") == "1")//Recently played videos
            {
                res          = DatabaseProvider.InstanInstance.GetTopPlayed();
                res.Title    = Name + "/" + stats[1];
                res.ItemType = ItemType.Video;
            }
            if (entry.GetValue("level") == "2")//Recently played videos
            {
                res          = DatabaseProvider.InstanInstance.GetRandom();
                res.Title    = Name + "/" + stats[2];
                res.ItemType = ItemType.Video;
            }
            return(res);
        }
        public void SetEntry(SiteItemEntry entry)
        {
            loading = true;
              _entry = entry;
              int i = 0;
              int.TryParse(_entry.GetValue("items"), out i);
              numericUpDown1.Value = i;
              if (numericUpDown1.Value < 2)
            numericUpDown1.Value = 2;
              if (_entry.GetValue("flat") == "true")
            checkBox1.Checked = true;
              else
            checkBox1.Checked = false;

              txt_title.Text = _entry.GetValue("title");
              loading = false;
              if (string.IsNullOrEmpty(txt_title.Text))
            txt_title.Text = "Search History";
        }
 public GenericListItemCollections GetList(SiteItemEntry entry)
 {
     GenericListItemCollections res = new GenericListItemCollections();
       res.Title = entry.Title;
       if (string.IsNullOrEmpty(entry.GetValue("level")))
       {
     for (int i = 0; i < stats.Count; i++)
     {
       SiteItemEntry newentry = new SiteItemEntry();
       Statistics statistics = new Statistics();
       newentry.Provider = statistics.Name;
       newentry.Title = stats[i];
       newentry.SetValue("level", i.ToString());
       res.Items.Add(new GenericListItem()
                   {
                     IsFolder = true,
                     Title = newentry.Title,
                     Tag = newentry,
                     //LogoUrl = ArtistManager.Instance.GetArtistsImgUrl(GetArtistName(title[1]))
                   });
     }
       }
       if (entry.GetValue("level") == "0")//Recently played videos
       {
     res = DatabaseProvider.InstanInstance.GetRecentlyPlayed();
     res.Title = Name + "/" + stats[0];
     res.ItemType = ItemType.Video;
       }
       if (entry.GetValue("level") == "1")//Recently played videos
       {
     res = DatabaseProvider.InstanInstance.GetTopPlayed();
     res.Title = Name + "/" + stats[1];
     res.ItemType = ItemType.Video;
       }
       if (entry.GetValue("level") == "2")//Recently played videos
       {
     res =  DatabaseProvider.InstanInstance.GetRandom();
     res.Title = Name + "/" + stats[2];
     res.ItemType = ItemType.Video;
       }
       return res;
 }
Пример #25
0
 private void txt_title_TextChanged(object sender, EventArgs e)
 {
     if (!loading)
     {
         _entry.SetValue("title", txt_title.Text);
         _entry.SetValue("feed", (string)cmb_standardfeed.SelectedItem);
         _entry.SetValue("feedint", cmb_standardfeed.SelectedIndex.ToString());
         _entry.Title        = _entry.GetValue("title");
         _entry.ConfigString = _entry.GetConfigString();
     }
 }
        public void SetEntry(SiteItemEntry entry)
        {
            loading = true;
              _entry = entry;
              cmb_time.Items.Clear();
              cmb_time.Items.Add("");
              foreach (string s in Youtube2MP._settings.TimeList)
              {
            cmb_time.Items.Add(s);
              }

              txt_title.Text = _entry.GetValue("title");
              txt_term.Text = _entry.GetValue("term");
              cmb_time.SelectedItem = _entry.GetValue("time");

              int i = 0;
              int.TryParse(_entry.GetValue("sortint"), out i);
              cmb_sort.SelectedIndex = i;
              loading = false;
        }
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();
              res.Title = entry.Title;
              User user = new User(Youtube2MP._settings.LastFmUser, Youtube2MP.LastFmProfile.Session);
              switch (entry.GetValue("type"))
              {
            case "TopTracks":
              {
            TopTrack[] tracks = user.GetTopTracks();
            //user.GetRecentTracks()
            foreach (TopTrack topTrack in tracks)
            {
              SiteItemEntry newentry = new SiteItemEntry();
              VideoItem videoItem = new VideoItem();
              newentry.Provider = videoItem.Name;
              newentry.Title = topTrack.Item.ToString();
              res.Items.Add(new GenericListItem()
              {
                IsFolder = false,
                Title = newentry.Title,
                Tag = newentry,
                LogoUrl = ArtistManager.Instance.GetArtistsImgUrl(topTrack.Item.Artist.Name),
                DefaultImage = "defaultArtistBig.png"
              });
            }
              }
              break;
            case "RecentTracks":
              {
            Track[] tracks = user.GetRecentTracks(40);
            //user.GetRecentTracks()
            foreach (Track topTrack in tracks)
            {
              SiteItemEntry newentry = new SiteItemEntry();
              VideoItem videoItem = new VideoItem();
              newentry.Provider = videoItem.Name;
              newentry.Title = topTrack.ToString();
              res.Items.Add(new GenericListItem()
              {
                IsFolder = false,
                Title = newentry.Title,
                Tag = newentry,
                LogoUrl = ArtistManager.Instance.GetArtistsImgUrl(topTrack.Artist.Name),
                DefaultImage = "defaultArtistBig.png"

              });
            }
              }
              break;
              }
              res.ItemType = ItemType.Video;
              return res;
        }
        public void OnDownloadTimedEvent()
        {
            if (!Client.IsBusy && downloaQueue.Count > 0)
            {
                curentDownlodingFile = (DownloadFileObject)downloaQueue.Dequeue();
                try
                {
                    if (curentDownlodingFile.ListItem != null)
                    {
                        SiteItemEntry siteItemEntry = curentDownlodingFile.ListItem.MusicTag as SiteItemEntry;
                        if (siteItemEntry != null && !string.IsNullOrEmpty(siteItemEntry.GetValue("id")))
                        {
                            ArtistItem artistItem = ArtistManager.Instance.GetArtistsById(siteItemEntry.GetValue("id"));
                            if (string.IsNullOrEmpty(curentDownlodingFile.Url) || curentDownlodingFile.Url.Contains("@") ||
                                curentDownlodingFile.Url.Contains("ytimg.com"))
                            {
                                try
                                {
                                    Artist artist = new Artist(artistItem.Name, Youtube2MP.LastFmProfile.Session);
                                    artistItem.Img_url = artist.GetImageURL(ImageSize.Huge);
                                    ArtistManager.Instance.Save(artistItem);
                                    curentDownlodingFile.Url      = artistItem.Img_url;
                                    curentDownlodingFile.FileName = Youtube2MP.GetLocalImageFileName(curentDownlodingFile.Url);
                                }
                                catch
                                {
                                }
                            }
                        }
                    }

                    if (!string.IsNullOrEmpty(curentDownlodingFile.FileName) && !File.Exists(curentDownlodingFile.FileName))
                    {
                        try
                        {
                            Client.DownloadFileAsync(new Uri(curentDownlodingFile.Url), Path.GetTempPath() + @"\station.png");
                        }
                        catch
                        {
                            downloaQueue.Enqueue(curentDownlodingFile);
                        }
                    }
                    else
                    {
                        OnDownloadTimedEvent(null, null);
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                }
            }
        }
Пример #29
0
        public void SetEntry(SiteItemEntry entry)
        {
            loading = true;
            _entry  = entry;
            cmb_time.Items.Clear();
            cmb_time.Items.Add("");
            foreach (string s in Youtube2MP._settings.TimeList)
            {
                cmb_time.Items.Add(s);
            }

            txt_title.Text        = _entry.GetValue("title");
            txt_term.Text         = _entry.GetValue("term");
            cmb_time.SelectedItem = _entry.GetValue("time");

            int i = 0;

            int.TryParse(_entry.GetValue("sortint"), out i);
            cmb_sort.SelectedIndex = i;
            loading = false;
        }
        private void txt_title_TextChanged(object sender, EventArgs e)
        {
            if (!loading)
            {
                _entry.SetValue("title", txt_title.Text);
                _entry.SetValue("items", numericUpDown1.Value.ToString());
                _entry.SetValue("flat", checkBox1.Checked ? "true" : "false");

                _entry.Title        = _entry.GetValue("title");
                _entry.ConfigString = _entry.GetConfigString();
            }
        }
 public void SetEntry(SiteItemEntry entry)
 {
     loading = true;
       _entry = entry;
       cmb_region.Items.Clear();
       cmb_region.Items.Add("");
       foreach (KeyValuePair<string, string> valuePair in Youtube2MP._settings.Regions)
       {
     cmb_region.Items.Add(valuePair.Key);
       }
       cmb_region.SelectedItem = _entry.GetValue("region");
       loading = false;
 }
Пример #32
0
 public void SetEntry(SiteItemEntry entry)
 {
     loading = true;
     _entry  = entry;
     cmb_region.Items.Clear();
     cmb_region.Items.Add("");
     foreach (KeyValuePair <string, string> valuePair in Youtube2MP._settings.Regions)
     {
         cmb_region.Items.Add(valuePair.Key);
     }
     cmb_region.SelectedItem = _entry.GetValue("region");
     loading = false;
 }
Пример #33
0
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

            res.Title = entry.Title;
            {
                SiteItemEntry itemEntry = new SiteItemEntry();
                itemEntry.Provider = new UserPlaylists().Name;
                itemEntry.SetValue("id", entry.GetValue("id"));
                string          title    = "Playlist";
                GenericListItem listItem = new GenericListItem()
                {
                    Title    = title,
                    IsFolder = false,
                    LogoUrl  = entry.GetValue("imgurl"),
                    //DefaultImage = "defaultArtistBig.png",
                    Tag = itemEntry
                };
                res.Add(listItem);
            }
            {
                SiteItemEntry itemEntry = new SiteItemEntry();
                itemEntry.Provider = new UserVideos().Name;
                itemEntry.SetValue("id", entry.GetValue("id"));
                string          title    = "Uploads";
                GenericListItem listItem = new GenericListItem()
                {
                    Title    = title,
                    IsFolder = false,
                    LogoUrl  = entry.GetValue("imgurl"),
                    //DefaultImage = "defaultArtistBig.png",
                    Tag = itemEntry
                };
                res.Add(listItem);
            }
            res.ItemType = ItemType.Item;
            return(res);
        }
 public GenericListItemCollections GetList(SiteItemEntry entry)
 {
     GenericListItemCollections res = new GenericListItemCollections();
       res.Title = entry.Title;
       YouTubeQuery query =
     new YouTubeQuery(string.Format("http://gdata.youtube.com/feeds/api/users/{0}/uploads", entry.GetValue("id")));
       if (string.IsNullOrEmpty(entry.GetValue("id")))
     query =
       new YouTubeQuery(string.Format("http://gdata.youtube.com/feeds/api/users/default/uploads"));
       query.NumberToRetrieve = Youtube2MP.ITEM_IN_LIST;
       query.StartIndex = entry.StartItem;
       if (entry.StartItem > 1)
     res.Paged = true;
       YouTubeFeed videos = Youtube2MP.service.Query(query);
       res.Title = "Uploads by :" + videos.Authors[0].Name;
       foreach (YouTubeEntry youTubeEntry in videos.Entries)
       {
     res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(youTubeEntry));
       }
       res.Add(Youtube2MP.GetPager(entry, videos));
       res.ItemType = ItemType.Video;
       return res;
 }
 public GenericListItemCollections GetList(SiteItemEntry entry)
 {
     GenericListItemCollections res = new GenericListItemCollections();
       res.Title = entry.Title;
       {
     SiteItemEntry itemEntry = new SiteItemEntry();
     itemEntry.Provider = new UserPlaylists().Name;
     itemEntry.SetValue("id", entry.GetValue("id"));
     string title = "Playlist";
     GenericListItem listItem = new GenericListItem()
     {
       Title = title,
       IsFolder = false,
       LogoUrl = entry.GetValue("imgurl"),
       //DefaultImage = "defaultArtistBig.png",
       Tag = itemEntry
     };
     res.Add(listItem);
       }
       {
     SiteItemEntry itemEntry = new SiteItemEntry();
     itemEntry.Provider = new UserVideos().Name;
     itemEntry.SetValue("id", entry.GetValue("id"));
     string title = "Uploads";
     GenericListItem listItem = new GenericListItem()
     {
       Title = title,
       IsFolder = false,
       LogoUrl = entry.GetValue("imgurl"),
       //DefaultImage = "defaultArtistBig.png",
       Tag = itemEntry
     };
     res.Add(listItem);
       }
       res.ItemType = ItemType.Item;
       return res;
 }
 public GenericListItemCollections GetList(SiteItemEntry entry)
 {
     GenericListItemCollections res = new GenericListItemCollections();
       res.FolderType = 1;
       string url = string.Format("http://gdata.youtube.com/feeds/api/playlists/{0}", entry.GetValue("id"));
       if (!string.IsNullOrEmpty(entry.GetValue("url")))
     url = entry.GetValue("url");
       YouTubeQuery query = new YouTubeQuery(url);
       query.NumberToRetrieve = 50;
       do
       {
     YouTubeFeed videos = Youtube2MP.service.Query(query);
     res.Title = videos.Title.Text;
     foreach (YouTubeEntry youTubeEntry in videos.Entries)
     {
       res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(youTubeEntry));
     }
     query.StartIndex += 50;
     if (videos.TotalResults < query.StartIndex + 50)
       break;
       } while (true);
       res.ItemType = ItemType.Video;
       return res;
 }
 public GenericListItemCollections GetList(SiteItemEntry entry)
 {
     GenericListItemCollections res = new GenericListItemCollections();
       res.FolderType = 1;
       string user = entry.GetValue("user");
       user = string.IsNullOrEmpty(user) ? "default" : user;
       YouTubeQuery query =
     new YouTubeQuery(string.Format("http://gdata.youtube.com/feeds/api/users/{0}/favorites",user));
       query.NumberToRetrieve = Youtube2MP.ITEM_IN_LIST;
       query.StartIndex = entry.StartItem;
       if (entry.StartItem > 1)
     res.Paged = true;
       YouTubeFeed videos = Youtube2MP.service.Query(query);
       res.Title = videos.Title.Text;
       foreach (YouTubeEntry youTubeEntry in videos.Entries)
       {
     res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(youTubeEntry));
       }
       res.Add(Youtube2MP.GetPager(entry, videos));
       res.ItemType = ItemType.Video;
       return res;
 }
Пример #38
0
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();
            YouTubeQuery query             = new YouTubeQuery(YouTubeQuery.DefaultVideoUri);

            query.Query = string.IsNullOrEmpty(entry.GetValue("search")) ? entry.Title : entry.GetValue("search");

            query.NumberToRetrieve = 1;
            query.OrderBy          = "relevance";

            if (Youtube2MP._settings.MusicFilter)
            {
                query.Categories.Add(new QueryCategory("Music", QueryCategoryOperator.AND));
            }

            YouTubeFeed videos = Youtube2MP.service.Query(query);

            foreach (YouTubeEntry youTubeEntry in videos.Entries)
            {
                res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(youTubeEntry));
            }
            res.FolderType = 1;
            return(res);
        }
Пример #39
0
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

            if (entry.GetValue("letter") == "")
            {
                {
                    res.Title = "Artists";
                    SiteItemEntry newentry1 = new SiteItemEntry();
                    newentry1.Provider = this.Name;
                    newentry1.SetValue("letter", "true");
                    newentry1.SetValue("special", "1");
                    newentry1.Title = Translation.PlayedArtists;
                    GenericListItem listItem1 = new GenericListItem()
                    {
                        Title    = Translation.PlayedArtists,
                        IsFolder = true,
                        Tag      = newentry1
                    };
                    res.Items.Add(listItem1);
                }

                {
                    res.Title = "Artists";
                    SiteItemEntry newentry1 = new SiteItemEntry();
                    newentry1.Provider = this.Name;
                    newentry1.SetValue("letter", "true");
                    newentry1.SetValue("special", "2");
                    newentry1.Title = Translation.ByTags;
                    GenericListItem listItem1 = new GenericListItem()
                    {
                        Title    = Translation.ByTags,
                        IsFolder = true,
                        Tag      = newentry1
                    };
                    res.Items.Add(listItem1);
                }

                foreach (string letter in ArtistManager.Instance.GetArtistsLetters())
                {
                    SiteItemEntry newentry = new SiteItemEntry();
                    newentry.Provider = this.Name;
                    newentry.SetValue("letter", "true");
                    newentry.SetValue("special", "false");
                    newentry.Title = letter;
                    GenericListItem listItem = new GenericListItem()
                    {
                        Title    = letter,
                        IsFolder = true,
                        Tag      = newentry
                    };
                    res.Items.Add(listItem);
                }
            }
            if (entry.GetValue("letter") == "true" && entry.GetValue("special") == "false")
            {
                res.Title = "Artists/Letter/" + entry.Title;
                List <ArtistItem> list = ArtistManager.Instance.GetArtists(entry.Title);
                if (list.Count > 500)
                {
                    foreach (string letter in ArtistManager.Instance.GetArtistsLetters(entry.Title))
                    {
                        SiteItemEntry newentry = new SiteItemEntry();
                        newentry.Provider = this.Name;
                        newentry.SetValue("letter", "true");
                        newentry.SetValue("special", "false");
                        newentry.Title = letter;
                        GenericListItem listItem = new GenericListItem()
                        {
                            Title    = letter,
                            IsFolder = true,
                            Tag      = newentry
                        };
                        res.Items.Add(listItem);
                    }
                }
                else
                {
                    foreach (ArtistItem artistItem in list)
                    {
                        SiteItemEntry newentry = new SiteItemEntry();
                        newentry.Provider = this.Name;
                        newentry.SetValue("letter", "false");
                        newentry.SetValue("id", artistItem.Id);
                        newentry.SetValue("name", artistItem.Name);
                        res.ItemType = ItemType.Artist;
                        GenericListItem listItem = new GenericListItem()
                        {
                            Title   = artistItem.Name,
                            LogoUrl =
                                string.IsNullOrEmpty(artistItem.Img_url.Trim()) ? "@" : artistItem.Img_url,
                            IsFolder     = true,
                            DefaultImage = "defaultArtistBig.png",
                            Tag          = newentry
                        };
                        res.Items.Add(listItem);
                    }
                }
            }
            if (entry.GetValue("special") == "1")
            {
                res.Title = "Artists/" + Translation.PlayedArtists;
                foreach (
                    ArtistItem artistItem in
                    ArtistManager.Instance.GetArtistsByIds(DatabaseProvider.InstanInstance.GetPlayedArtistIds(1)))
                {
                    SiteItemEntry newentry = new SiteItemEntry();
                    newentry.Provider = this.Name;
                    newentry.SetValue("letter", "false");
                    newentry.SetValue("id", artistItem.Id);
                    newentry.SetValue("name", artistItem.Name);
                    res.ItemType = ItemType.Artist;
                    GenericListItem listItem = new GenericListItem()
                    {
                        Title   = artistItem.Name,
                        LogoUrl =
                            string.IsNullOrEmpty(artistItem.Img_url.Trim()) ? "@" : artistItem.Img_url,
                        IsFolder     = true,
                        DefaultImage = "defaultArtistBig.png",
                        Tag          = newentry
                    };
                    res.Items.Add(listItem);
                }
            }

            if (entry.GetValue("special") == "2")
            {
                res.Title = "Artists/" + Translation.ByTags;
                foreach (string[] strings in ArtistManager.Instance.GetTags())
                {
                    SiteItemEntry newentry = new SiteItemEntry();
                    newentry.Provider = this.Name;
                    newentry.SetValue("letter", "true");
                    newentry.SetValue("special", "3");
                    newentry.SetValue("tag", strings[0]);
                    res.ItemType = ItemType.Item;
                    GenericListItem listItem = new GenericListItem()
                    {
                        Title    = strings[0],
                        IsFolder = true,
                        Title2   = strings[1],
                        Tag      = newentry
                    };
                    res.Items.Add(listItem);
                }
            }

            if (entry.GetValue("special") == "3")
            {
                res.Title = "Artists/" + Translation.ByTags + "/" + entry.Title;
                foreach (ArtistItem artistItem in ArtistManager.Instance.GetArtistsByTag(entry.GetValue("tag")))
                {
                    SiteItemEntry newentry = new SiteItemEntry();
                    newentry.Provider = this.Name;
                    newentry.SetValue("letter", "false");
                    newentry.SetValue("id", artistItem.Id);
                    newentry.SetValue("name", artistItem.Name);
                    res.ItemType = ItemType.Artist;
                    GenericListItem listItem = new GenericListItem()
                    {
                        Title   = artistItem.Name,
                        LogoUrl =
                            string.IsNullOrEmpty(artistItem.Img_url.Trim()) ? "@" : artistItem.Img_url,
                        IsFolder     = true,
                        DefaultImage = "defaultArtistBig.png",
                        Tag          = newentry
                    };
                    res.Items.Add(listItem);
                }
            }


            if (entry.GetValue("letter") == "false")
            {
                //res = ArtistManager.Instance.Grabber.GetArtistVideosIds(entry.GetValue("id"));
                res.ItemType = ItemType.Video;
                string user = ArtistManager.Instance.Grabber.GetArtistUser(entry.GetValue("id"));
                GenericListItemCollections resart = ArtistManager.Instance.Grabber.GetArtistVideosIds(entry.GetValue("name"));
                YouTubeFeed videos = null;
                try
                {
                    if (!string.IsNullOrEmpty(user))
                    {
                        YouTubeQuery query =
                            new YouTubeQuery(string.Format("http://gdata.youtube.com/feeds/api/users/{0}/uploads", user));
                        query.NumberToRetrieve = 50;
                        videos = Youtube2MP.service.Query(query);
                    }
                }
                catch (Exception exception)
                {
                    Log.Error(exception);
                }
                foreach (GenericListItem genericListItem in resart.Items)
                {
                    YouTubeEntry tubeEntry   = genericListItem.Tag as YouTubeEntry;
                    YouTubeEntry searchEntry = GetVideFromFeed(Youtube2MP.GetVideoId(tubeEntry), videos);
                    if (searchEntry != null)
                    {
                        searchEntry.Title.Text = tubeEntry.Title.Text;
                        res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(searchEntry));
                    }
                    else
                    {
                        res.Items.Add(genericListItem);
                    }
                }
                res.FolderType = 1;
                res.Title      = "Artists/" + ArtistManager.Instance.GetArtistsById(entry.GetValue("id")).Name;
            }
            return(res);
        }
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();
              if (entry.GetValue("letter") == "")
              {
            {
              res.Title = "Artists";
              SiteItemEntry newentry1 = new SiteItemEntry();
              newentry1.Provider = this.Name;
              newentry1.SetValue("letter", "true");
              newentry1.SetValue("special", "1");
              newentry1.Title = Translation.PlayedArtists;
              GenericListItem listItem1 = new GenericListItem()
                                        {
                                          Title = Translation.PlayedArtists,
                                          IsFolder = true,
                                          Tag = newentry1
                                        };
              res.Items.Add(listItem1);
            }

            {
              res.Title = "Artists";
              SiteItemEntry newentry1 = new SiteItemEntry();
              newentry1.Provider = this.Name;
              newentry1.SetValue("letter", "true");
              newentry1.SetValue("special", "2");
              newentry1.Title = Translation.ByTags;
              GenericListItem listItem1 = new GenericListItem()
              {
            Title = Translation.ByTags,
            IsFolder = true,
            Tag = newentry1
              };
              res.Items.Add(listItem1);
            }

            foreach (string letter in ArtistManager.Instance.GetArtistsLetters())
            {
              SiteItemEntry newentry = new SiteItemEntry();
              newentry.Provider = this.Name;
              newentry.SetValue("letter", "true");
              newentry.SetValue("special", "false");
              newentry.Title = letter;
              GenericListItem listItem = new GenericListItem()
                                       {
                                         Title = letter,
                                         IsFolder = true,
                                         Tag = newentry
                                       };
              res.Items.Add(listItem);
            }
              }
              if (entry.GetValue("letter") == "true" && entry.GetValue("special") == "false")
              {
            res.Title = "Artists/Letter/" + entry.Title;
            List<ArtistItem> list = ArtistManager.Instance.GetArtists(entry.Title);
            if (list.Count > 500)
            {
              foreach (string letter in ArtistManager.Instance.GetArtistsLetters(entry.Title))
              {
            SiteItemEntry newentry = new SiteItemEntry();
            newentry.Provider = this.Name;
            newentry.SetValue("letter", "true");
            newentry.SetValue("special", "false");
            newentry.Title = letter;
            GenericListItem listItem = new GenericListItem()
            {
              Title = letter,
              IsFolder = true,
              Tag = newentry
            };
            res.Items.Add(listItem);
              }
            }
            else
            {
              foreach (ArtistItem artistItem in list)
              {
            SiteItemEntry newentry = new SiteItemEntry();
            newentry.Provider = this.Name;
            newentry.SetValue("letter", "false");
            newentry.SetValue("id", artistItem.Id);
            newentry.SetValue("name", artistItem.Name);
            res.ItemType = ItemType.Artist;
            GenericListItem listItem = new GenericListItem()
                                         {
                                           Title = artistItem.Name,
                                           LogoUrl =
                                             string.IsNullOrEmpty(artistItem.Img_url.Trim()) ? "@" : artistItem.Img_url,
                                           IsFolder = true,
                                           DefaultImage = "defaultArtistBig.png",
                                           Tag = newentry
                                         };
            res.Items.Add(listItem);
              }
            }
              }
              if (entry.GetValue("special") == "1")
              {
            res.Title = "Artists/" + Translation.PlayedArtists;
            foreach (
              ArtistItem artistItem in
            ArtistManager.Instance.GetArtistsByIds(DatabaseProvider.InstanInstance.GetPlayedArtistIds(1)))
            {
              SiteItemEntry newentry = new SiteItemEntry();
              newentry.Provider = this.Name;
              newentry.SetValue("letter", "false");
              newentry.SetValue("id", artistItem.Id);
              newentry.SetValue("name", artistItem.Name);
              res.ItemType = ItemType.Artist;
              GenericListItem listItem = new GenericListItem()
                                       {
                                         Title = artistItem.Name,
                                         LogoUrl =
                                           string.IsNullOrEmpty(artistItem.Img_url.Trim()) ? "@" : artistItem.Img_url,
                                         IsFolder = true,
                                         DefaultImage = "defaultArtistBig.png",
                                         Tag = newentry
                                       };
              res.Items.Add(listItem);
            }
              }

              if (entry.GetValue("special") == "2")
              {
            res.Title = "Artists/" + Translation.ByTags;
            foreach (string[] strings in ArtistManager.Instance.GetTags())
            {
              SiteItemEntry newentry = new SiteItemEntry();
              newentry.Provider = this.Name;
              newentry.SetValue("letter", "true");
              newentry.SetValue("special", "3");
              newentry.SetValue("tag",strings[0]);
              res.ItemType = ItemType.Item;
              GenericListItem listItem = new GenericListItem()
              {
            Title = strings[0],
            IsFolder = true,
            Title2 = strings[1],
            Tag = newentry
              };
              res.Items.Add(listItem);
            }
              }

              if (entry.GetValue("special") == "3")
              {
            res.Title = "Artists/" + Translation.ByTags + "/" + entry.Title;
            foreach (ArtistItem artistItem in ArtistManager.Instance.GetArtistsByTag(entry.GetValue("tag")))
            {
              SiteItemEntry newentry = new SiteItemEntry();
              newentry.Provider = this.Name;
              newentry.SetValue("letter", "false");
              newentry.SetValue("id", artistItem.Id);
              newentry.SetValue("name", artistItem.Name);
              res.ItemType = ItemType.Artist;
              GenericListItem listItem = new GenericListItem()
              {
            Title = artistItem.Name,
            LogoUrl =
              string.IsNullOrEmpty(artistItem.Img_url.Trim()) ? "@" : artistItem.Img_url,
            IsFolder = true,
            DefaultImage = "defaultArtistBig.png",
            Tag = newentry
              };
              res.Items.Add(listItem);
            }
              }

              if (entry.GetValue("letter") == "false")
              {
            //res = ArtistManager.Instance.Grabber.GetArtistVideosIds(entry.GetValue("id"));
            res.ItemType = ItemType.Video;
            string user = ArtistManager.Instance.Grabber.GetArtistUser(entry.GetValue("id"));
            GenericListItemCollections resart = ArtistManager.Instance.Grabber.GetArtistVideosIds(entry.GetValue("name"));
            YouTubeFeed videos = null;
            try
            {
              if (!string.IsNullOrEmpty(user))
              {
            YouTubeQuery query =
              new YouTubeQuery(string.Format("http://gdata.youtube.com/feeds/api/users/{0}/uploads", user));
            query.NumberToRetrieve = 50;
            videos = Youtube2MP.service.Query(query);
              }
            }
            catch (Exception exception)
            {
              Log.Error(exception);
            }
            foreach (GenericListItem genericListItem in resart.Items)
            {
              YouTubeEntry tubeEntry = genericListItem.Tag as YouTubeEntry;
              YouTubeEntry searchEntry = GetVideFromFeed(Youtube2MP.GetVideoId(tubeEntry), videos);
              if (searchEntry != null)
              {
            searchEntry.Title.Text = tubeEntry.Title.Text;
            res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(searchEntry));
              }
              else
              {
            res.Items.Add(genericListItem);
              }
            }
            res.FolderType = 1;
            res.Title = "Artists/" + ArtistManager.Instance.GetArtistsById(entry.GetValue("id")).Name;
              }
              return res;
        }
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

            res.Title = entry.Title;
            YouTubeQuery  query         = new YouTubeQuery(YouTubeQuery.CreatePlaylistsUri(entry.GetValue("id")));
            PlaylistsFeed userPlaylists = Youtube2MP.service.GetPlaylists(query);

            res.Title = userPlaylists.Title.Text;
            foreach (PlaylistsEntry playlistsEntry in userPlaylists.Entries)
            {
                Google.GData.Extensions.XmlExtension e = playlistsEntry.FindExtension("group", "http://search.yahoo.com/mrss/") as Google.GData.Extensions.XmlExtension;

                string img = "http://i2.ytimg.com/vi/hqdefault.jpg";
                try
                {
                    img = e.Node.FirstChild.Attributes["url"].Value;
                }
                catch
                {
                }

                PlayList playList = new PlayList();

                SiteItemEntry itemEntry = new SiteItemEntry();
                itemEntry.Provider = playList.Name;
                itemEntry.SetValue("url", playlistsEntry.Content.AbsoluteUri);
                string          title    = playlistsEntry.Title.Text;
                GenericListItem listItem = new GenericListItem()
                {
                    Title    = title,
                    IsFolder = false,
                    LogoUrl  = img.Replace("default", "hqdefault"),
                    //DefaultImage = "defaultArtistBig.png",
                    Tag = itemEntry
                };
                res.Add(listItem);
            }
            res.ItemType = ItemType.Item;
            return(res);
        }
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();
              string query = YouTubeQuery.TopRatedVideo;
              bool usetime = true;
              res.Title = entry.Title;
              switch (Convert.ToInt32(entry.GetValue("feedint")))
              {
            case 0:
              query = YouTubeQuery.MostViewedVideo;
              break;
            case 1:
              query = YouTubeQuery.TopRatedVideo;
              break;
            case 2:
              query = YouTubeQuery.RecentlyFeaturedVideo;
              break;
            case 3:
              query = YouTubeQuery.MostDiscussedVideo;
              break;
            case 4:
              query = YouTubeQuery.FavoritesVideo;
              break;
            case 5:
              usetime = false;
              query = YouTubeQuery.MostLinkedVideo;
              break;
            case 6:
              usetime = false;
              query = YouTubeQuery.MostRespondedVideo;
              break;
            case 7:
              usetime = false;
              query = YouTubeQuery.MostRecentVideo;
              break;
            case 8:
              usetime = false;
              query = YouTubeQuery.StandardFeeds + "most_shared";
              break;
            case 9:
              usetime = false;
              query = YouTubeQuery.StandardFeeds + "on_the_web";
              break;

              }

              if (!string.IsNullOrEmpty(entry.GetValue("region")))
              {
            string reg = Youtube2MP._settings.Regions[entry.GetValue("region")];
            if (!string.IsNullOrEmpty(reg))
              query = query.Replace("standardfeeds", "standardfeeds/" + reg);
              }

              if (Youtube2MP._settings.MusicFilter)
            query += "_Music";

              YouTubeQuery tubeQuery = new YouTubeQuery(query);
              tubeQuery.NumberToRetrieve = Youtube2MP.ITEM_IN_LIST;
              tubeQuery.StartIndex = entry.StartItem;
              tubeQuery.SafeSearch = YouTubeQuery.SafeSearchValues.None;
              if (!string.IsNullOrEmpty(entry.GetValue("hd")) && entry.GetValue("hd") == "true")
              {
            tubeQuery.ExtraParameters = "hd=true";
              }

              if (usetime)
              {
            if (entry.GetValue("time") == "Today")
              tubeQuery.Time = YouTubeQuery.UploadTime.Today;
            if (entry.GetValue("time") == "This Week")
              tubeQuery.Time = YouTubeQuery.UploadTime.ThisWeek;
            if (entry.GetValue("time") == "This Month")
              tubeQuery.Time = YouTubeQuery.UploadTime.ThisMonth;
              }
              if (entry.StartItem > 1)
            res.Paged = true;
              YouTubeFeed videos = Youtube2MP.service.Query(tubeQuery);
              foreach (YouTubeEntry youTubeEntry in videos.Entries)
              {
            res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(youTubeEntry));
              }

              res.Add(Youtube2MP.GetPager(entry, videos));
              res.FolderType = 1;
              res.ItemType = ItemType.Video;
              return res;
        }
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();
            string query   = YouTubeQuery.TopRatedVideo;
            bool   usetime = true;

            res.Title = entry.Title;
            switch (Convert.ToInt32(entry.GetValue("feedint")))
            {
            case 0:
                query = YouTubeQuery.MostViewedVideo;
                break;

            case 1:
                query = YouTubeQuery.TopRatedVideo;
                break;

            case 2:
                query = YouTubeQuery.RecentlyFeaturedVideo;
                break;

            case 3:
                query = YouTubeQuery.MostDiscussedVideo;
                break;

            case 4:
                query = YouTubeQuery.FavoritesVideo;
                break;

            case 5:
                usetime = false;
                query   = YouTubeQuery.MostLinkedVideo;
                break;

            case 6:
                usetime = false;
                query   = YouTubeQuery.MostRespondedVideo;
                break;

            case 7:
                usetime = false;
                query   = YouTubeQuery.MostRecentVideo;
                break;

            case 8:
                usetime = false;
                query   = YouTubeQuery.StandardFeeds + "most_shared";
                break;

            case 9:
                usetime = false;
                query   = YouTubeQuery.StandardFeeds + "on_the_web";
                break;
            }

            if (!string.IsNullOrEmpty(entry.GetValue("region")))
            {
                string reg = Youtube2MP._settings.Regions[entry.GetValue("region")];
                if (!string.IsNullOrEmpty(reg))
                {
                    query = query.Replace("standardfeeds", "standardfeeds/" + reg);
                }
            }

            if (Youtube2MP._settings.MusicFilter)
            {
                query += "_Music";
            }

            YouTubeQuery tubeQuery = new YouTubeQuery(query);

            tubeQuery.NumberToRetrieve = Youtube2MP.ITEM_IN_LIST;
            tubeQuery.StartIndex       = entry.StartItem;
            tubeQuery.SafeSearch       = YouTubeQuery.SafeSearchValues.None;
            if (!string.IsNullOrEmpty(entry.GetValue("hd")) && entry.GetValue("hd") == "true")
            {
                tubeQuery.ExtraParameters = "hd=true";
            }

            if (usetime)
            {
                if (entry.GetValue("time") == "Today")
                {
                    tubeQuery.Time = YouTubeQuery.UploadTime.Today;
                }
                if (entry.GetValue("time") == "This Week")
                {
                    tubeQuery.Time = YouTubeQuery.UploadTime.ThisWeek;
                }
                if (entry.GetValue("time") == "This Month")
                {
                    tubeQuery.Time = YouTubeQuery.UploadTime.ThisMonth;
                }
            }
            if (entry.StartItem > 1)
            {
                res.Paged = true;
            }
            YouTubeFeed videos = Youtube2MP.service.Query(tubeQuery);

            foreach (YouTubeEntry youTubeEntry in videos.Entries)
            {
                res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(youTubeEntry));
            }

            res.Add(Youtube2MP.GetPager(entry, videos));
            res.FolderType = 1;
            res.ItemType   = ItemType.Video;
            return(res);
        }
Пример #44
0
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();
            YouTubeQuery query             = new YouTubeQuery(YouTubeQuery.DefaultVideoUri);

            query.Query            = entry.GetValue("term");
            query.NumberToRetrieve = Youtube2MP.ITEM_IN_LIST;
            query.StartIndex       = entry.StartItem;
            if (entry.StartItem > 1)
            {
                res.Paged = true;
            }
            query.OrderBy = "relevance";

            if (Youtube2MP._settings.MusicFilter)
            {
                query.Categories.Add(new QueryCategory("Music", QueryCategoryOperator.AND));
            }

            if (!string.IsNullOrEmpty(entry.GetValue("sortint")))
            {
                switch (Convert.ToInt32(entry.GetValue("sortint")))
                {
                case 0:
                    query.OrderBy = "relevance";
                    break;

                case 1:
                    query.OrderBy = "published";
                    break;

                case 2:
                    query.OrderBy = "viewCount";
                    break;

                case 3:
                    query.OrderBy = "rating";
                    break;
                }
            }

            if (entry.GetValue("time") == "Today")
            {
                query.Time = YouTubeQuery.UploadTime.Today;
            }
            if (entry.GetValue("time") == "This Week")
            {
                query.Time = YouTubeQuery.UploadTime.ThisWeek;
            }
            if (entry.GetValue("time") == "This Month")
            {
                query.Time = YouTubeQuery.UploadTime.ThisMonth;
            }

            YouTubeFeed videos = Youtube2MP.service.Query(query);

            res.Title = Translation.Search + "/" + entry.GetValue("term");
            foreach (YouTubeEntry youTubeEntry in videos.Entries)
            {
                res.Items.Add(Youtube2MP.YouTubeEntry2ListItem(youTubeEntry));
            }
            res.FolderType = 1;
            res.ItemType   = ItemType.Video;
            res.Add(Youtube2MP.GetPager(entry, videos));
            return(res);
        }
Пример #45
0
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();

            res.Title = entry.Title;
            if (string.IsNullOrEmpty(entry.GetValue("level")))
            {
                foreach (KeyValuePair <string, string> keyValuePair in _settings.Regions)
                {
                    SiteItemEntry newentry = new SiteItemEntry();
                    newentry.Provider = this.Name;
                    newentry.SetValue("region", keyValuePair.Key);
                    newentry.SetValue("level", "1");
                    newentry.Title = keyValuePair.Key;
                    GenericListItem listItem = new GenericListItem()
                    {
                        Title    = keyValuePair.Key,
                        IsFolder = true,
                        Tag      = newentry
                    };
                    res.Items.Add(listItem);
                }
            }
            else if (entry.GetValue("level") == "1")
            {
                {
                    SiteItemEntry newentry = new SiteItemEntry();
                    newentry.Provider = this.Name;
                    newentry.SetValue("region", entry.GetValue("region"));
                    newentry.SetValue("level", "2");
                    newentry.SetValue("hd", "false");
                    newentry.Title = entry.Title + "/" + "All";
                    GenericListItem listItem = new GenericListItem()
                    {
                        Title    = "All",
                        IsFolder = true,
                        Tag      = newentry
                    };
                    res.Items.Add(listItem);
                }
                {
                    SiteItemEntry newentry = new SiteItemEntry();
                    newentry.Provider = this.Name;
                    newentry.SetValue("region", entry.GetValue("region"));
                    newentry.SetValue("level", "2");
                    newentry.SetValue("hd", "true");
                    newentry.Title = entry.Title + "/" + "HD";
                    GenericListItem listItem = new GenericListItem()
                    {
                        Title    = "HD",
                        IsFolder = true,
                        Tag      = newentry
                    };
                    res.Items.Add(listItem);
                }
            }
            else if (entry.GetValue("level") == "2")
            {
                for (int i = 0; i < _settings.Cats.Count; i++)
                {
                    SiteItemEntry newentry = new SiteItemEntry();
                    newentry.Provider = i > 4 ? "Standard feed" : this.Name;
                    newentry.SetValue("region", entry.GetValue("region"));
                    newentry.SetValue("hd", entry.GetValue("hd"));
                    newentry.SetValue("level", "3");
                    newentry.SetValue("feedint", i.ToString());
                    newentry.Title = entry.Title + "/" + _settings.Cats[i];
                    GenericListItem listItem = new GenericListItem()
                    {
                        Title    = _settings.Cats[i],
                        IsFolder = true,
                        Tag      = newentry
                    };
                    res.Items.Add(listItem);
                }
            }
            else if (entry.GetValue("level") == "3")
            {
                for (int i = 0; i < _settings.TimeList.Count; i++)
                {
                    SiteItemEntry newentry = new SiteItemEntry();
                    newentry.Provider = "Standard feed";
                    newentry.SetValue("region", entry.GetValue("region"));
                    newentry.SetValue("hd", entry.GetValue("hd"));
                    newentry.SetValue("level", "4");
                    newentry.SetValue("feedint", entry.GetValue("feedint"));
                    newentry.SetValue("time", _settings.TimeList[i]);
                    newentry.Title = entry.Title + "/" + _settings.TimeList[i];
                    GenericListItem listItem = new GenericListItem()
                    {
                        Title    = _settings.TimeList[i],
                        IsFolder = true,
                        Tag      = newentry
                    };
                    res.Items.Add(listItem);
                }
            }
            return(res);
        }
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();
              res.Title = entry.Title;
              if (string.IsNullOrEmpty(entry.GetValue("level")))
              {
            foreach (KeyValuePair<string, string> keyValuePair in _settings.Regions)
            {
              SiteItemEntry newentry = new SiteItemEntry();
              newentry.Provider = this.Name;
              newentry.SetValue("region", keyValuePair.Key);
              newentry.SetValue("level", "1");
              newentry.Title = keyValuePair.Key;
              GenericListItem listItem = new GenericListItem()
                                       {
                                         Title = keyValuePair.Key,
                                         IsFolder = true,
                                         Tag = newentry
                                       };
              res.Items.Add(listItem);
            }
              }
              else if (entry.GetValue("level") == "1")
              {
            {
              SiteItemEntry newentry = new SiteItemEntry();
              newentry.Provider =this.Name;
              newentry.SetValue("region", entry.GetValue("region"));
              newentry.SetValue("level", "2");
              newentry.SetValue("hd", "false");
              newentry.Title = entry.Title + "/" + "All";
              GenericListItem listItem = new GenericListItem()
              {
            Title = "All",
            IsFolder = true,
            Tag = newentry
              };
              res.Items.Add(listItem);
            }
            {
              SiteItemEntry newentry = new SiteItemEntry();
              newentry.Provider = this.Name;
              newentry.SetValue("region", entry.GetValue("region"));
              newentry.SetValue("level", "2");
              newentry.SetValue("hd", "true");
              newentry.Title = entry.Title + "/" + "HD";
              GenericListItem listItem = new GenericListItem()
              {
            Title = "HD",
            IsFolder = true,
            Tag = newentry
              };
              res.Items.Add(listItem);
            }

              }
              else if (entry.GetValue("level") == "2")
              {
            for (int i = 0; i < _settings.Cats.Count; i++)
            {
              SiteItemEntry newentry = new SiteItemEntry();
              newentry.Provider = i > 4 ? "Standard feed" : this.Name;
              newentry.SetValue("region", entry.GetValue("region"));
              newentry.SetValue("hd", entry.GetValue("hd"));
              newentry.SetValue("level", "3");
              newentry.SetValue("feedint", i.ToString());
              newentry.Title = entry.Title + "/" + _settings.Cats[i];
              GenericListItem listItem = new GenericListItem()
              {
            Title = _settings.Cats[i],
            IsFolder = true,
            Tag = newentry
              };
              res.Items.Add(listItem);
            }
              }
              else if (entry.GetValue("level") == "3")
              {
            for (int i = 0; i < _settings.TimeList.Count; i++)
            {
              SiteItemEntry newentry = new SiteItemEntry();
              newentry.Provider = "Standard feed";
              newentry.SetValue("region", entry.GetValue("region"));
              newentry.SetValue("hd", entry.GetValue("hd"));
              newentry.SetValue("level", "4");
              newentry.SetValue("feedint", entry.GetValue("feedint"));
              newentry.SetValue("time", _settings.TimeList[i]);
              newentry.Title = entry.Title + "/" + _settings.TimeList[i];
              GenericListItem listItem = new GenericListItem()
              {
            Title = _settings.TimeList[i],
            IsFolder = true,
            Tag = newentry
              };
              res.Items.Add(listItem);
            }
              }
              return res;
        }
Пример #47
0
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            if (items.Items.Count > 0)
            {
                return(items);
            }
            Dictionary <string, GenericListItem> list1 = new Dictionary <string, GenericListItem>();

            GenericListItemCollections res = new GenericListItemCollections();
            string query = YouTubeQuery.MostViewedVideo;

            res.Title = entry.Title;
            if (!string.IsNullOrEmpty(entry.GetValue("region")))
            {
                string reg = Youtube2MP._settings.Regions[entry.GetValue("region")];
                if (!string.IsNullOrEmpty(reg))
                {
                    query = query.Replace("standardfeeds", "standardfeeds/" + reg);
                }
            }
            else
            {
                if (Youtube2MP._settings.Regions.ContainsValue(Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper()))
                {
                    query = query.Replace("standardfeeds", "standardfeeds/" + Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper());
                }
            }
            query += "_Music";
            YouTubeQuery tubeQuery = new YouTubeQuery(query);

            tubeQuery.NumberToRetrieve = 50;
            tubeQuery.SafeSearch       = YouTubeQuery.SafeSearchValues.None;

            YouTubeFeed videos = Youtube2MP.service.Query(tubeQuery);

            foreach (YouTubeEntry youTubeEntry in videos.Entries)
            {
                list1.Add(Youtube2MP.GetVideoId(youTubeEntry), Youtube2MP.YouTubeEntry2ListItem(youTubeEntry));
            }
            GenericListItemCollections popular = DatabaseProvider.InstanInstance.GetTopPlayed(2);

            foreach (GenericListItem genericListItem in popular.Items)
            {
                YouTubeEntry youTubeEntry = genericListItem.Tag as YouTubeEntry;
                if (youTubeEntry != null && !list1.ContainsKey(Youtube2MP.GetVideoId(youTubeEntry)))
                {
                    list1.Add(Youtube2MP.GetVideoId(youTubeEntry), genericListItem);
                }
            }
            Random random = new Random();

            foreach (GenericListItem genericListItem in list1.Values)
            {
                if (res.Items.Count == 0)
                {
                    res.Items.Add(genericListItem);
                }
                else
                {
                    res.Items.Insert(random.Next(res.Items.Count - 1), genericListItem);
                }
            }
            items        = res;
            res.ItemType = ItemType.Video;
            return(res);
        }