Ejemplo n.º 1
0
        /// <summary>
        /// Starting Point
        /// </summary>
        public override bool Init()
        {
            FileLog.Info("Starting Trailers v{0}", PluginSettings.Version);

            PluginSettings.PerformMaintenance();
            PluginSettings.LoadSettings();

            // Initialize Extension Settings
            ExtensionSettings.Init();

            // Load Trailer Providers
            LoadTrailerProviders();

            // Listen to this event to detect skin\language changes in GUI
            GUIWindowManager.OnDeActivateWindow += new GUIWindowManager.WindowActivationHandler(GUIWindowManager_OnDeActivateWindow);
            GUIWindowManager.OnActivateWindow   += new GUIWindowManager.WindowActivationHandler(GUIWindowManager_OnActivateWindow);
            GUIWindowManager.Receivers          += new SendMessageHandler(GUIWindowManager_Receivers);

            // Listen to player events
            g_Player.PlayBackEnded   += new g_Player.EndedHandler(g_Player_PlayBackEnded);
            g_Player.PlayBackStopped += new g_Player.StoppedHandler(g_Player_PlayBackStopped);

            // Initialize translations
            Translation.Init();

            // Initilize plugins for auto trailer download
            TrailerDownloader.Init();

            // Load main skin window
            // this is a launching pad to all other windows
            string xmlSkin = GUIGraphicsContext.Skin + @"\Trailers.xml";

            FileLog.Info("Loading main skin window: " + xmlSkin);
            return(Load(xmlSkin));
        }
Ejemplo n.º 2
0
        public void Download()
        {
            // get all movies in database
            ArrayList myvideos = new ArrayList();

            VideoDatabase.GetMovies(ref myvideos);

            var localMovies = (from IMDBMovie movie in myvideos select movie).ToList();

            FileLog.Info("{0} movies in My Videos database", localMovies.Count);

            // get locally cached trailers
            var cache = TrailerDownloader.LoadMovieList(MoviePluginSource.MyVideos);

            // process local movies
            var movieList = new List <Movie>();

            foreach (var movie in localMovies)
            {
                // add to cache if it doesn't already exist
                if (!cache.Movies.Exists(m => m.IMDbID == movie.IMDBNumber && m.Title == movie.Title && m.Year == movie.Year.ToString()))
                {
                    string fanart = string.Empty;
                    MediaPortal.Util.FanArt.GetFanArtfilename(movie.ID, 0, out fanart);

                    string poster = MediaPortal.Util.Utils.GetLargeCoverArtName(MediaPortal.Util.Thumbs.MovieTitle, movie.Title + "{" + movie.ID + "}");

                    FileLog.Info("Adding Title='{0}', Year='{1}', IMDb='{2}', TMDb='{3}' to movie trailer cache.", movie.Title, movie.Year, movie.IMDBNumber ?? "<empty>", "<empty>");

                    movieList.Add(new Movie
                    {
                        File      = movie.VideoFileName,
                        IMDbID    = movie.IMDBNumber,
                        Year      = movie.Year.ToString(),
                        Title     = movie.Title,
                        Cast      = Regex.Replace(movie.Cast, @"\n|\r", "|"),
                        Directors = movie.Director,
                        Writers   = movie.WritingCredits.Replace(" / ", "|"),
                        Genres    = movie.Genre.Replace(" / ", "|"),
                        Plot      = movie.Plot,
                        Fanart    = fanart,
                        Poster    = poster
                    });
                }
            }

            // remove any movies from cache that are no longer in local collection
            cache.Movies.RemoveAll(c => !localMovies.Exists(l => l.IMDBNumber == c.IMDbID && l.Title == c.Title && l.Year.ToString() == c.Year));

            // add any new local movies to cache since last time
            cache.Movies.AddRange(movieList);

            // process the movie cache and download trailers
            TrailerDownloader.ProcessAndDownloadTrailers(cache, MoviePluginSource.MyVideos);

            return;
        }
Ejemplo n.º 3
0
        public void Download()
        {
            // get all movies in database
            var localMovies = DBMovieInfo.GetAll();

            FileLog.Info("{0} movies in MovingPictures database", localMovies.Count);

            // get locally cached trailers
            var cache = TrailerDownloader.LoadMovieList(MoviePluginSource.MovingPictures);

            // process local movies
            var movieList = new List <Movie>();

            foreach (var movie in localMovies)
            {
                // add to cache if it doesn't already exist
                if (!cache.Movies.Exists(m => m.IMDbID == (movie.ImdbID ?? string.Empty).Trim() && m.Title == movie.Title && m.Year == movie.Year.ToString()))
                {
                    FileLog.Info("Adding Title='{0}', Year='{1}', IMDb='{2}', TMDb='{3}' to movie trailer cache.", movie.Title, movie.Year, movie.ImdbID ?? "<empty>", GetTmdbID(movie) ?? "<empty>");

                    movieList.Add(new Movie
                    {
                        File      = movie.LocalMedia.First().FullPath,
                        IMDbID    = movie.ImdbID,
                        TMDbID    = GetTmdbID(movie),
                        Plot      = movie.Summary,
                        Cast      = movie.Actors.ToString(),
                        Directors = movie.Directors.ToString(),
                        Writers   = movie.Writers.ToString(),
                        Year      = movie.Year.ToString(),
                        Title     = movie.Title,
                        Poster    = movie.CoverFullPath,
                        Fanart    = movie.BackdropFullPath,
                        Genres    = movie.Genres.ToString()
                    });
                }
            }

            // remove any movies from cache that are no longer in local collection
            cache.Movies.RemoveAll(c => !localMovies.Exists(l => (l.ImdbID ?? string.Empty).Trim() == c.IMDbID && l.Title == c.Title && l.Year.ToString() == c.Year));

            // add any new local movies to cache since last time
            cache.Movies.AddRange(movieList);

            // process the movie cache and download trailers
            TrailerDownloader.ProcessAndDownloadTrailers(cache, MoviePluginSource.MovingPictures);

            return;
        }
Ejemplo n.º 4
0
        public void Download()
        {
            // get all movies in database
            ArrayList myvideos = new ArrayList();

            BaseMesFilms.GetMovies(ref myvideos);

            var localMovies = (from MFMovie movie in myvideos select movie).ToList();

            FileLog.Info("{0} movies in My Films database", localMovies.Count);

            // get locally cached trailers
            var cache = TrailerDownloader.LoadMovieList(MoviePluginSource.MyFilms);

            // process local movies
            var movieList = new List <Movie>();

            foreach (var movie in localMovies)
            {
                // add to cache if it doesn't already exist
                if (!cache.Movies.Exists(m => m.IMDbID == movie.IMDBNumber && m.Title == movie.Title && m.Year == movie.Year.ToString()))
                {
                    FileLog.Info("Adding Title='{0}', Year='{1}', IMDb='{2}', TMDb='{3}' to movie trailer cache.", movie.Title, movie.Year, movie.IMDBNumber ?? "<empty>", movie.TMDBNumber ?? "<empty>");

                    movieList.Add(new Movie
                    {
                        File   = movie.Path,
                        IMDbID = movie.IMDBNumber,
                        TMDbID = movie.TMDBNumber,
                        Year   = movie.Year.ToString(),
                        Title  = movie.Title,
                        Poster = movie.Picture,
                        Fanart = movie.Fanart,
                    });
                }
            }

            // remove any movies from cache that are no longer in local collection
            cache.Movies.RemoveAll(c => !localMovies.Exists(l => l.IMDBNumber == c.IMDbID && l.Title == c.Title && l.Year.ToString() == c.Year));

            // add any new local movies to cache since last time
            cache.Movies.AddRange(movieList);

            // process the movie cache and download trailers
            TrailerDownloader.ProcessAndDownloadTrailers(cache, MoviePluginSource.MyFilms);

            return;
        }