コード例 #1
0
ファイル: MainForm.cs プロジェクト: Vinzz/WhatsThisFilm
        private void SnipFiche()
        {
            pictureBox1.Image = null;
            lblYear.Text      = "----";

            if (ListeFilms.SelectedIndex != -1)
            {
                lblTitle.Text = "---- (" + TitleManipulator.HexIt(ListeFilms.SelectedItem.ToString()) + ")";
            }
            else
            {
                lblTitle.Text = "----";
            }

            lblDirector.Text = "-";
            lblResume.Text   = "-";
            lblDuree.Text    = "-";
            lnklblFiche.Text = "-";
            maxIndex         = 0;
            lblGenres.Text   = "-";
            lblTotal.Text    = "0";
            lblPresse.Text   = "-";

            if (ListeFilms.SelectedIndex != -1)
            {
                if (!_cache.doesnotContainsFilmInfo(ListeFilms.SelectedItem.ToString()))
                {
                    _cache.ResetFilmInfo(ListeFilms.SelectedItem.ToString());
                }
            }
        }
コード例 #2
0
        public static FilmInfo GetFromTitle(string title, int index)
        {
            FilmInfo ans        = new FilmInfo();
            string   hexedTitle = TitleManipulator.HexIt(title);

            ans.HexedTitle = hexedTitle;
            ans.Key        = title;


            ans.titre      = currMovie.Title;
            ans.orig_titre = currMovie.OriginalTitle;
            ans.year       = currMovie.ProductionYear.ToString();
            if (currMovie.CastingShort != null)
            {
                ans.realisateur = currMovie.CastingShort.Directors;
            }

            if (currMovie.Statistics != null && currMovie.Statistics.PressRating != null)
            {
                ans.presse = (double)currMovie.Statistics.PressRating;
            }

            ans.totalInSearch = currCount;
            if (currMovie.LinkList != null && currMovie.LinkList.Count > 0)
            {
                ans.link = currMovie.LinkList[0].Href;
            }

            if (currMovie.Runtime != null)
            {
                ans.duree = TimeSpan.FromSeconds(int.Parse(currMovie.Runtime)).ToString();
            }

            ans.genre = "";
            if (currMovie.GenreList != null)
            {
                foreach (var genre in currMovie.GenreList)
                {
                    ans.genre += genre.Value + ", ";
                }
                ans.genre = ans.genre.TrimEnd(' ');
                ans.genre = ans.genre.TrimEnd(',');
            }
            if (currMovie.SynopsisShort != null)
            {
                ans.synopsis = currMovie.SynopsisShort.Replace("<br />", "\n").Replace("<br/>", "\n");
                ans.synopsis = noHTMLreg.Replace(ans.synopsis, "");
            }

            if (currMovie.Poster != null)
            {
                ans.jaquette     = BitmapFromWeb(currMovie.Poster.Href);
                ans.jaquetteTime = DateTime.Now;
            }

            return(ans);
        }
コード例 #3
0
        public static FilmInfo GetFromTitleLight(string title, int index)
        {
            FilmInfo ans        = new FilmInfo();
            string   hexedTitle = TitleManipulator.HexIt(title);

            ans.HexedTitle = hexedTitle;
            ans.Key        = title;


            var alFeed = api.Search(hexedTitle, new[] { TypeFilters.Movie });

            if (alFeed.MovieList != null && alFeed.MovieList.Count >= index)
            {
                currCount = alFeed.MovieList.Count;

                Movie apiMovie = alFeed.MovieList[index - 1];

                apiMovie = api.MovieGetInfo(int.Parse(apiMovie.Code), ResponseProfiles.Large, new[] { TypeFilters.Movie }, new[] { "synopsis" }, new[] { MediaFormat.Mpeg2 });

                if (apiMovie.Error != null)
                {
                    throw new Exception(apiMovie.Error.Value);
                }

                ans.titre = apiMovie.Title;

                currMovie = apiMovie;
            }
            else
            {
                currCount = 0;

                if (alFeed.Error != null)
                {
                    throw new Exception(alFeed.Error.Value);
                }
            }

            return(ans);
        }