Beispiel #1
0
        public void LoadData(Pivot TvPivot, int tvShowId, int seasonNum)
        {
            var xbmc = Xbmc.Xbmc.instance();

            xbmc.GetTvSeasons(tvShowId, (rows) =>
            {
                if (rows != null)
                {
                    foreach (var row in rows)
                    {
                        var num = (int)row["season"];
                        var season = new TvSeasonItem()
                        {
                            Title = String.Format("Season {0}", num),
                            Season = num
                        };

                        this.Seasons.Add(season);

                        xbmc.GetTvEpisodes(tvShowId, num, (rows2) =>
                        {
                            LoadSeason(xbmc, season, rows2);
                        });
                    }
                }
            });
        }
Beispiel #2
0
 private void LoadSeason(Xbmc.Xbmc xbmc, TvSeasonItem season, JToken rows)
 {
     if (rows != null)
     {
         foreach (var row in rows)
         {
             var episodeId = (int)row["episodeid"];
             var item = new TvEpisodeItem()
             {
                 Id = episodeId,
                 Title = (string)row["title"],
                 Subtitle = (string)row["showtitle"],
                 SortKey = (string)row["firstaired"],
                 Play = new PlayCommand((e) =>
                 {
                     xbmc.PlayEpisode(episodeId);
                 })
             };
             item.SetThumbnail(xbmc.GetVfsUri((string)row["thumbnail"]));
             if (Background == null)
             {
                 SetBackground(xbmc.GetVfsUri((string)row["fanart"]));
             }
             Debug.WriteLine(String.Format("S{0}E{1}", item.Season, item.Id));
             season.Episodes.Add(item);
         }
         NotifyPropertyChanged("Seasons");
     }
 }