コード例 #1
0
        public static void AssertTVShowInformationStructure(TVShowInfo tvShow)
        {
            Assert.IsTrue(tvShow.Id > 0);
            Assert.IsFalse(string.IsNullOrEmpty(tvShow.Name));

            AssertGenres(tvShow.GenreIds, tvShow.Genres);
        }
コード例 #2
0
ファイル: FileServer.cs プロジェクト: AlexAkulov/simpleDLNA
 internal void UpdateTVCache(TVShowInfo tvinfo)
 {
     if (tvStore != null)
     {
         tvStore.Insert(tvinfo);
     }
 }
コード例 #3
0
        private async Task <NeoModels.TVShow> apiSeason(string searchQuery, int season)
        {
            ApiSearchResponse <TVShowInfo> response = await seasonAPI.SearchByNameAsync(searchQuery);

            TVShowInfo info = response.Results[0];
            ApiQueryResponse <DM.MovieApi.MovieDb.TV.TVShow> metadata = await seasonAPI.FindByIdAsync(info.Id);


            NeoModels.TVShow tvshow = new NeoModels.TVShow(metadata.Item, season);

            String        plot       = tvshow.Overview;
            String        poster     = "http://image.tmdb.org/t/p/w342/" + tvshow.Seasons[0].Path;
            string        titleWhole = tvshow.Name + " Season " + season;
            StorageFolder folder     = ApplicationData.Current.LocalFolder;
            string        appPath    = folder.Path;

            appPath += "\\";
            appPath += titleWhole;
            appPath += ".jpg";

            await downloadImage(new Uri(poster), appPath);

            tvshow.Seasons[0].Path = appPath;
            tvshow.PosterPath      = appPath;

            if (seasonList.Instance.existsInList(tvshow))
            {
                already   = true;
                addSeason = tvshow.Seasons[0];
            }

            return(tvshow);
        }
コード例 #4
0
        public async Task SearchByNameAsync_GameOfThrones_Returns_PopulatedGenres()
        {
            const string query = "Game of Thrones";

            ApiSearchResponse <TVShowInfo> response = await _api.SearchByNameAsync(query);

            ApiResponseUtil.AssertErrorIsNull(response);

            TVShowInfo gameOfThrones = response.Results.Single();

            Genre[] expGenres =
            {
                GenreFactory.SciFiAndFantasy(),
                GenreFactory.ActionAndAdventure(),
                GenreFactory.Drama(),
            };

            CollectionAssert.AreEquivalent(expGenres, gameOfThrones.Genres.ToArray());
        }
コード例 #5
0
        private void AssertTheNanny(ApiSearchResponse <TVShowInfo> response, string theNanny)
        {
            const int    theNannyId   = 2352;
            const string us           = "US";
            const string lang         = "en";
            var          firstAirDate = new DateTime(1993, 11, 03);

            Assert.IsTrue(response.TotalResults > 0);
            Assert.IsTrue(response.Results.Count > 0);

            TVShowInfo show = response.Results.Single(x => x.Id == theNannyId);

            Assert.AreEqual(theNanny, show.Name);

            Assert.AreEqual(1, show.OriginCountry.Count);

            string country = show.OriginCountry.Single();

            Assert.AreEqual(us, country);

            Assert.AreEqual(lang, show.OriginalLanguage);

            Assert.AreEqual(firstAirDate.Date, show.FirstAirDate.Date);
        }
コード例 #6
0
ファイル: VideoFile.cs プロジェクト: Hawkynt/simpleDLNA
    private void FetchTV() {

      var movieInfo= NFOFileReader.ReadMovieOrDefault(this.Item);
      if (movieInfo != null) {
        this.title = movieInfo.Title;
        this.description=movieInfo.Plot;
        this.duration = movieInfo.Duration;
        this.actors=movieInfo.Actors;
        this.director=movieInfo.Director;
        this.genre=movieInfo.Genres?.FirstOrDefault();
        this.isSeries = false;
        this._MarkMetaDataInitialized();
        return;
      }

      var episodeInfo = NFOFileReader.ReadEpisodeOrDefault(this.Item);
      if (episodeInfo != null) {
        var showInfo = NFOFileReader.ReadShowOrDefault(this.Item.Directory) ?? NFOFileReader.ReadShowOrDefault(this.Item.Directory?.Parent) ?? NFOFileReader.ReadShowOrDefault(this.Item.Directory?.Parent?.Parent);

        this.title = episodeInfo.Title;
        this.description = episodeInfo.Plot;
        this.duration = episodeInfo.Duration;
        this.actors = showInfo.Actors;
        this.director = episodeInfo.Director;
        this.genre = showInfo.Genres?.FirstOrDefault();
        this.episode = episodeInfo.Episode;
        this.season = episodeInfo.Season;
        this.seriesname = showInfo.Title?? episodeInfo.ShowTitle;
        this.isSeries = true;
        this._MarkMetaDataInitialized();
        return;
      }
      
      try {
        if (this.tvshowid == null || this.tvshowid == -1)
          this.tvshowid = TheTVDB.GetTVShowID(this.Path);

        var name = Directory.GetParent(this.Path).Name.GetNiceNameOrNull();
        if (name == null || name is Formatting.NiceSeriesName seriesName && seriesName.Episode == 0)
          name = base.Title.GetNiceNameOrNull();

        if (name == null)
          name = this.Item.Name.GetNiceNameOrNull();

        TVShowInfo tvinfo = null;

        if (this.tvshowid != null && this.tvshowid > 0) {
          tvinfo = TheTVDB.GetTVShowDetails(this.tvshowid.Value);
          this.Server.UpdateTVCache(tvinfo);
          this.seriesname = tvinfo.Name;
          this.isSeries = true;
        }

        switch (name) {
          case Formatting.NiceSeriesName showName: {
            this.isSeries = true;
            if (string.IsNullOrEmpty(this.seriesname))
              this.seriesname = showName.Name;

            if (showName.Episode > 0) {
              this.title =
                tvinfo != null
                ? tvinfo.Find(showName.Season, showName.Episode)
                : $"s{showName.Season}e{showName.Episode}"
                ;

              this.season = showName.Season;
              this.episode = showName.Episode;
            } else {
              this.title = base.Title;
            }

            if (!string.IsNullOrEmpty(name.Releaser))
              this.title = $"{this.title} ({name.Resolution},{name.Releaser})";

            break;
          }

          case Formatting.MovieName movieName: {
            this.seriesname = $"{movieName.Name} ({movieName.Year})";
            break;
          }

          default:
            this.seriesname = Directory.GetParent(this.Path).Name;
            break;
        }
      } catch (Exception exn) {
        if (exn is ArgumentNullException) { } else {
          this.tvshowid = TheTVDB.GetTVShowID(this.Path);
        }
      }
    }
コード例 #7
0
ファイル: VideoFile.cs プロジェクト: dmusz/simpleDLNA
        private void FetchTV()
        {
            try
            {
                if (tvshowid == null || tvshowid == -1)
                {
                    this.tvshowid = TheTVDB.GetTVShowID(this.Path);
                }
                var steszt = (System.IO.Directory.GetParent(base.Path).Name).TryGetName();
                if (steszt == null || (steszt is Formatting.NiceSeriesName && (steszt as Formatting.NiceSeriesName).Episode == 0))
                {
                    steszt = base.Title.TryGetName();
                }
                if (steszt == null)
                {
                    steszt = base.Item.Name.TryGetName();
                }
                TVShowInfo tvinfo = null;

                if (tvshowid != null && tvshowid > 0)
                {
                    tvinfo = TheTVDB.GetTVShowDetails(this.tvshowid.Value);
                    Server.UpdateTVCache(tvinfo);
                    this.seriesname = tvinfo.Name;
                    isSeries        = true;
                }

                if (steszt is Utilities.Formatting.NiceSeriesName)
                {
                    isSeries = true;
                    var steszt2 = steszt as Utilities.Formatting.NiceSeriesName;
                    if (String.IsNullOrEmpty(this.seriesname))
                    {
                        this.seriesname = steszt2.Name;
                    }

                    if (/*steszt2.Season > 0 &&*/ steszt2.Episode > 0)
                    {
                        if (tvinfo != null)
                        {
                            this.title = tvinfo.Find(steszt2.Season, steszt2.Episode);
                        }
                        else
                        {
                            this.title = String.Format("{0}x{1}", steszt2.Season, steszt2.Episode);
                        }
                        this.season  = steszt2.Season;
                        this.episode = steszt2.Episode;
                    }
                    else
                    {
                        this.title = base.Title;
                    }

                    if (!String.IsNullOrEmpty(steszt.Releaser))
                    {
                        this.title = String.Format("{0} ({1},{2})", this.title, steszt.Resolution, steszt.Releaser);
                    }
                }
                else if (steszt is Formatting.MovieName)
                {
                    var n = steszt as Formatting.MovieName;
                    this.seriesname = String.Format("{0} ({1})", n.Name, n.Year);
                }
                else
                {
                    this.seriesname = System.IO.Directory.GetParent(this.Path).Name;
                }
            }
            catch (Exception exn)
            {
                if (exn is System.ArgumentNullException)
                {
                }
                else
                {
                    this.tvshowid = TheTVDB.GetTVShowID(this.Path);
                }
            }
        }