Ejemplo n.º 1
0
        public Collection <ApiTvSeason> GetTvSeasons()
        {
            var          seasons = new Collection <ApiTvSeason>();
            const string req     = "SELECT idShow, COUNT(idShow), c12, strPath,strTitle FROM episodeview GROUP BY idShow,c12";

            var showHashes = new Hashtable();

            var dblines = _parent.DBCommand("video", req);

            if (dblines == null)
            {
                return(seasons);
            }
            foreach (var dbline in dblines)
            {
                if (dbline.Length < 4)
                {
                    _parent.Log("Invalid request DATA : " + dbline);
                    continue;
                }
                var season = new ApiTvSeason
                {
                    EpisodeCount = Xbmc.StringToNumber(dbline[1]),
                    IdShow       = Xbmc.StringToNumber(dbline[0]),
                    SeasonNumber = Xbmc.StringToNumber(dbline[2]),
                    Show         = dbline[4]
                };

                var temp = dbline[3];
                season.Fanart = @"special://profile/Thumbnails/Video/Fanart/" + Xbmc.Hash(temp) + ".tbn";
                char[] charsToTrim = { '/' };
                temp = temp.TrimEnd(charsToTrim);
                var hash = Xbmc.Hash("season" + temp);
                season.Thumb = @"special://profile/Thumbnails/Video/" + hash[0] + "/" + hash + ".tbn";
                season.Hash  = temp;
                seasons.Add(season);
            }

            foreach (var season in seasons)
            {
                if (!showHashes.ContainsKey(season.IdShow))
                {
                    showHashes.Add(season.IdShow, season.Show);
                }
            }

            return(seasons);
        }
Ejemplo n.º 2
0
        public Collection <ApiAudioGenre> GetGenres()
        {
            var genres  = new Collection <ApiAudioGenre>();
            var dblines = _parent.DBCommand("music", "SELECT idGenre,strGenre,COUNT(DISTINCT strAlbum) AS albumCount FROM albumview GROUP BY idGenre");

            if (dblines == null)
            {
                return(genres);
            }
            foreach (var dbline in dblines)
            {
                if (dbline.Length < 3)
                {
                    _parent.Log("Invalid request DATA : " + dbline);
                    continue;
                }
                var genre = new ApiAudioGenre {
                    IdGenre = Xbmc.StringToNumber(dbline[0]), Name = dbline[1], AlbumCount = Xbmc.StringToNumber(dbline[2])
                };
                genres.Add(genre);
            }
            return(genres);
        }