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);
        }
示例#2
0
        public TVShowView(TVShow tvshow, Season season)
        {
            Id               = tvshow.Id;
            BackdropPath     = tvshow.BackdropPath;
            FirstAirDate     = tvshow.FirstAirDate;
            Homepage         = tvshow.Homepage;
            InProduction     = tvshow.InProduction;
            LastAirDate      = tvshow.LastAirDate;
            Name             = tvshow.Name + " Season " + season.SeasonNumber;
            NumberOfEpisodes = tvshow.NumberOfEpisodes;
            NumberOfEpisodes = tvshow.NumberOfSeasons;
            OriginalLanguage = tvshow.OriginalLanguage;
            OriginalName     = tvshow.OriginalName;
            Overview         = tvshow.Overview;
            Popularity       = tvshow.Popularity;

            Path = tvshow.Path;

            Seasons = new List <Season>();
            Seasons.Add(season);
            AirDate      = season.AirDate;
            EpisodeCount = season.EpisodeCount;
            SeasonNumber = season.SeasonNumber;
            PosterPath   = season.Path;

            Genres = new List <Genre>();
            foreach (Genre element in tvshow.Genres)
            {
                Genres.Add(element);
            }

            CreatedBy = new List <TVShowCreator>();
            foreach (TVShowCreator element in tvshow.CreatedBy)
            {
                CreatedBy.Add(element);
            }

            Networks = new List <Network>();
            foreach (Network element in tvshow.Networks)
            {
                Networks.Add(element);
            }

            EpisodeRunTime = tvshow.EpisodeRunTime;
        }
        private async void btnMedatada_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtSeries.Text))
            {
                return;
            }

            String series = txtSeries.Text;
            int    season = cmbSeason.SelectedIndex + 1;

            ProgressMeter.Visibility = Visibility.Visible;
            ProgressMeter.IsActive   = true;

            try
            {
                show = await apiSeason(series, season);

                lblAlert.Text = "";
            }
            catch (Exception)
            {
                lblAlert.Text            = "Metadata not found, check your title!";
                ProgressMeter.Visibility = Visibility.Collapsed;
                ProgressMeter.IsActive   = false;
                return;
            }

            txtSeries.Text  = show.Name;
            txtYear.Text    = show.FirstAirDate.Year.ToString();
            txtRuntime.Text = show.EpisodeRunTime.ToString();
            txtGenres.Text  = String.Join(",", show.Genres);
            txtWriters.Text = String.Join(",", show.CreatedBy);
            txtNeworks.Text = String.Join(",", show.Networks);
            txtPlot.Text    = show.Overview;

            Uri         imageUri    = new Uri(show.PosterPath, UriKind.Absolute);
            BitmapImage imageBitmap = new BitmapImage(imageUri);

            imgPoster.Source = imageBitmap;

            btnPath.IsEnabled = true;

            ProgressMeter.Visibility = Visibility.Collapsed;
            ProgressMeter.IsActive   = false;
        }
示例#4
0
 public NeoTvShow(TVShow tvshow)
 {
     Id               = tvshow.Id;
     BackdropPath     = tvshow.BackdropPath;
     FirstAirDate     = ((DateTimeOffset)tvshow.FirstAirDate).ToUnixTimeSeconds();
     Homepage         = tvshow.Homepage;
     InProduction     = tvshow.InProduction;
     LastAirDate      = ((DateTimeOffset)tvshow.LastAirDate).ToUnixTimeSeconds();
     Name             = tvshow.Name;
     NumberOfEpisodes = tvshow.NumberOfEpisodes;
     NumberOfEpisodes = tvshow.NumberOfSeasons;
     OriginalLanguage = tvshow.OriginalLanguage;
     OriginalName     = tvshow.OriginalName;
     Overview         = tvshow.Overview;
     Popularity       = tvshow.Popularity;
     PosterPath       = tvshow.PosterPath;
     Path             = tvshow.Path;
     EpisodeRunTime   = tvshow.EpisodeRunTime;
 }