private int GetFieldIdValue(IMDBMovie movie, string where) { if (where == "watched") { return((int)movie.Watched); } if (where == "actor") { return(movie.ActorID); } if (where == "title") { return(movie.ID); } if (where == "genre") { return(movie.GenreID); } if (where == "year") { return(movie.Year); } if (where == "rating") { return((int)movie.Rating); } return(-1); }
protected override void OnPageLoad() { base.OnPageLoad(); currentLayout = Layout.Playlist; facadeLayout.CurrentLayout = currentLayout; LoadDirectory(string.Empty); if (g_Player.Playing && playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_VIDEO) { int iSong = playlistPlayer.CurrentSong; if (iSong >= 0 && iSong <= facadeLayout.Count) { GUIControl.SelectItemControl(GetID, facadeLayout.GetID, iSong); } } if (facadeLayout.Count <= 0) { GUIControl.FocusControl(GetID, btnLayouts.GetID); IMDBMovie movie = new IMDBMovie(); movie.SetProperties(false, string.Empty); } using (Profile.Settings settings = new Profile.MPSettings()) { playlistPlayer.RepeatPlaylist = settings.GetValueAsBool("movies", "repeat", true); } if (btnRepeatPlaylist != null) { btnRepeatPlaylist.Selected = playlistPlayer.RepeatPlaylist; } }
public void SetLabel(IMDBMovie movie, ref GUIListItem item) { if (movie == null) { return; } FilterDefinition definition = (FilterDefinition)currentView.Filters[CurrentLevel]; if (definition.Where == "genre") { item.Label = movie.SingleGenre; item.Label2 = string.Empty; item.Label3 = string.Empty; } if (definition.Where == "actor") { item.Label = movie.Actor; item.Label2 = string.Empty; item.Label3 = string.Empty; } if (definition.Where == "year") { item.Label = movie.Year.ToString(); item.Label2 = string.Empty; item.Label3 = string.Empty; } }
/// <summary> /// In database view the file info isn't set. /// This function trys to get the files from database and then creates the file info for it. /// </summary> /// <param name="item">Item to store the file info</param> /// <returns>True if FileInformation was created otherwise false</returns> private bool TryGetFileInfo(ref GUIListItem item) { if (item == null) { return(false); } try { IMDBMovie movie1 = item.AlbumInfoTag as IMDBMovie; if (movie1 != null && movie1.ID > 0) { ArrayList movies1 = new ArrayList(); VideoDatabase.GetFiles(movie1.ID, ref movies1); if (movies1.Count > 0) { item.FileInfo = new Util.FileInformation(movies1[0] as string, false); } } } catch (Exception exp) { Log.Error("VideoSort::TryGetFileInfo -> Exception: {0}", exp.Message); } return(item.FileInfo != null); }
protected override void OnInfo(int itemIndex) { GUIListItem item = facadeLayout[itemIndex]; if (item == null) { return; } IMDBMovie movie = item.AlbumInfoTag as IMDBMovie; if (movie == null) { return; } if (movie.ID >= 0) { GUIVideoInfo videoInfo = (GUIVideoInfo)GUIWindowManager.GetWindow((int)Window.WINDOW_VIDEO_INFO); videoInfo.Movie = movie; videoInfo.FolderForThumbs = string.Empty; GUIWindowManager.ActivateWindow((int)Window.WINDOW_VIDEO_INFO); } // F3 key actor info action if (movie.ActorID >= 0) { IMDBActor actor = VideoDatabase.GetActorInfo(movie.ActorID); if (actor != null) { OnVideoArtistInfo(actor); } } }
private void OnMovieInfo(GUIListItem item) { if (item == null) { return; } // Get movie info (item.DVDLabel holds movie id from videodatabase) IMDBMovie movie = new IMDBMovie(); int movieId = -1; int.TryParse(item.DVDLabel, out movieId); VideoDatabase.GetMovieInfoById(movieId, ref movie); if (movie == null) { return; } if (movie.ID >= 0) { GUIVideoInfo videoInfo = (GUIVideoInfo)GUIWindowManager.GetWindow((int)Window.WINDOW_VIDEO_INFO); videoInfo.Movie = movie; videoInfo.FolderForThumbs = string.Empty; GUIWindowManager.ActivateWindow((int)Window.WINDOW_VIDEO_INFO); } }
private void DoDeleteItem(GUIListItem item) { IMDBMovie movie = item.AlbumInfoTag as IMDBMovie; if (movie == null) { return; } if (movie.ID < 0) { return; } if (item.IsFolder) { return; } if (!item.IsRemote) { // Delete covers FanArt.DeleteCovers(movie.Title, movie.ID); // Delete fanarts FanArt.DeleteFanarts(movie.File, movie.Title); VideoDatabase.DeleteMovieInfoById(movie.ID); } }
static async Task <string> Example12() { return(await Bolt.NewSession(async session => { var movie = new IMDBMovie { imdb = "tt0110912", released = 1994, tagline = "The lives of two mob hitmen, a boxer, a gangster's wife, and a pair of diner bandits intertwine in four tales of violence and redemption.", title = "Pulp Fiction" }; var parameters = new Neo4jParameters() .WithEntity("newMovie", movie); var cursor = await session.RunAsync(@" CREATE (movie:Movie $newMovie) RETURN movie", parameters); var createdMovie = await cursor.MapSingleAsync <IMDBMovie>(); return createdMovie.Dump(); })); }
/// <summary> /// Plays a MpVideos movie /// </summary> /// <param name="id"></param> /// <param name="startPos"></param> internal static void PlayVideo(int id, int startPos) { //Code mostly copied from WindowPlugins -> GUIVideoFiles -> GuiVideoTitle.cs IMDBMovie movie = new IMDBMovie(); VideoDatabase.GetMovieInfoById(id, ref movie); if (movie == null && movie.ID < 0) { WifiRemote.LogMessage("No video found for id " + id, WifiRemote.LogType.Warn); return; } GUIVideoFiles.Reset(); // reset pincode ArrayList files = new ArrayList(); //Code for MediaPortal 1.3 Beta and higher VideoDatabase.GetFilesForMovie(movie.ID, ref files); if (files.Count > 1) { GUIVideoFiles.StackedMovieFiles = files; GUIVideoFiles.IsStacked = true; } else { GUIVideoFiles.IsStacked = false; } GUIVideoFiles.MovieDuration(files, false); GUIVideoFiles.PlayMovie(movie.ID, false); }
/// <summary> /// Creates Sync Data based on a single IMDBMovie object /// </summary> /// <param name="Movie">The movie to base the object on</param> /// <returns>The Trakt Sync data to send</returns> public static TraktMovieSync CreateSyncData(IMDBMovie Movie) { string username = TraktSettings.Username; string password = TraktSettings.Password; if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { return(null); } List <TraktMovieSync.Movie> moviesList = new List <TraktMovieSync.Movie>(); moviesList.Add(new TraktMovieSync.Movie { IMDBID = Movie.IMDBNumber, Title = Movie.Title, Year = Movie.Year.ToString() }); TraktMovieSync syncData = new TraktMovieSync { UserName = username, Password = password, MovieList = moviesList }; return(syncData); }
/// <summary> /// Creates Scrobble data based on a IMDBMovie object /// </summary> /// <param name="movie">The movie to base the object on</param> /// <returns>The Trakt scrobble data to send</returns> public static TraktMovieScrobble CreateScrobbleData(IMDBMovie movie) { string username = TraktSettings.Username; string password = TraktSettings.Password; if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { return(null); } TraktMovieScrobble scrobbleData = new TraktMovieScrobble { Title = movie.Title, Year = movie.Year.ToString(), IMDBID = movie.IMDBNumber, PluginVersion = TraktSettings.Version, MediaCenter = "Mediaportal", MediaCenterVersion = Assembly.GetEntryAssembly().GetName().Version.ToString(), MediaCenterBuildDate = String.Empty, UserName = username, Password = password }; return(scrobbleData); }
private void ShowInfo(GUIListItem item) { if (item == null) { return; } try { NewMovie newmovie = item.AlbumInfoTag as NewMovie; if (newmovie != null) { if (newmovie.MovieDetails != null) { IMDBMovie movie = (IMDBMovie)newmovie.MovieDetails; // Open video info screen GUIVideoInfo videoInfo = (GUIVideoInfo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIDEO_INFO); videoInfo.Movie = movie; GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_VIDEO_INFO); } } } catch (System.Exception ex) { logger.Error("ShowInfo: " + ex.ToString()); } }
/// <summary> /// In database view the file info isn't set. /// This function trys to get the files from database and then creates the file info for it. /// </summary> /// <param name="item">Item to store the file info</param> /// <returns>True if FileInformation was created otherwise false</returns> private bool TryGetFileInfo(ref GUIListItem item) { if (item == null) { return(false); } try { IMDBMovie movie1 = item.AlbumInfoTag as IMDBMovie; if (movie1 != null && movie1.ID > 0) { item.FileInfo = new Util.FileInformation(); DateTime dateAddedWatched; DateTime.TryParseExact(item.Label2, "yyyy-MM-dd HH:mm:ss", CultureInfo.CurrentCulture, DateTimeStyles.None, out dateAddedWatched); item.FileInfo.CreationTime = dateAddedWatched; } } catch (Exception exp) { Log.Error("VideoSort::TryGetFileInfo -> Exception: {0}", exp.Message); } return(item.FileInfo != null); }
private void ShowInfo() { try { GUIWindow fWindow = GUIWindowManager.GetWindow(Utils.ActiveWindow); int FocusControlID = fWindow.GetFocusControlId(); int idx = -1; if (ControlIDPlays.Contains(FocusControlID)) { idx = ControlIDPlays.IndexOf(FocusControlID) + 1; } // // CurrentFacade.Facade = Utils.GetLatestsFacade(CurrentFacade.ControlID); if (CurrentFacade.Facade != null && CurrentFacade.Facade.Focus && CurrentFacade.Facade.SelectedListItem != null) { idx = CurrentFacade.Facade.SelectedListItem.ItemId; } // if (idx > 0) { IMDBMovie movie = (IMDBMovie)latestMyVideosForPlay[idx]; // Open video info screen GUIVideoInfo videoInfo = (GUIVideoInfo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIDEO_INFO); videoInfo.Movie = movie; GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_VIDEO_INFO); } } catch (Exception ex) { logger.Error("ShowInfo: " + ex.ToString()); } }
/// <summary> /// Gets the trakt compatible string for the movies Audio Channels /// </summary> private string GetMovieAudioChannels(IMDBMovie movie) { if (movie.MediaInfo == null) { return(null); } switch (movie.MediaInfo.AudioChannels) { case "7.1": case "6.1": case "5.1": return(movie.MediaInfo.AudioChannels); case "7": return("6.1"); case "stereo": return("2.0"); case "mono": return("1.0"); default: return(null); } }
private void SetIMDBThumbs(ArrayList items) { for (int x = 0; x < items.Count; ++x) { string coverArtImage = string.Empty; GUIListItem listItem = (GUIListItem)items[x]; IMDBMovie movie = listItem.AlbumInfoTag as IMDBMovie; if (movie != null) { if (movie.ID >= 0) { string titleExt = movie.Title + "{" + movie.ID + "}"; coverArtImage = Util.Utils.GetCoverArt(Thumbs.MovieTitle, titleExt); if (Util.Utils.FileExistsInCache(coverArtImage)) { listItem.ThumbnailImage = coverArtImage; listItem.IconImageBig = coverArtImage; listItem.IconImage = coverArtImage; } } } // let's try to assign better covers if (!string.IsNullOrEmpty(coverArtImage)) { coverArtImage = Util.Utils.ConvertToLargeCoverArt(coverArtImage); if (Util.Utils.FileExistsInCache(coverArtImage)) { listItem.ThumbnailImage = coverArtImage; } } SelectItem(); } }
public void StopScrobble() { if (CurrentMovie == null) { return; } var scrobbleData = CreateScrobbleData(CurrentMovie); // check if movie is considered 'watched' if (scrobbleData.Progress >= WatchedPercent) { ShowRateDialog(CurrentMovie); } var scrobbleMovie = new Thread((objScrobble) => { var tScrobbleData = objScrobble as TraktScrobbleMovie; if (tScrobbleData == null) { return; } TraktScrobbleResponse response = null; if (tScrobbleData.Progress >= WatchedPercent) { TraktLogger.Info("Sending 'stop' scrobble of movie to trakt.tv. Title = '{0}', Year = '{1}', IMDb ID = '{2}'", tScrobbleData.Movie.Title, tScrobbleData.Movie.Year, tScrobbleData.Movie.Ids.Imdb ?? "<empty>"); response = TraktAPI.TraktAPI.StopMovieScrobble(tScrobbleData); if (response != null && response.Movie != null && response.Action == "scrobble") { // add to cache TraktCache.AddMovieToWatchHistory(response.Movie); } } else { TraktLogger.Info("Sending 'pause' scrobble of movie to trakt.tv. Title = '{0}', Year = '{1}', IMDb ID = '{2}'", tScrobbleData.Movie.Title, tScrobbleData.Movie.Year, tScrobbleData.Movie.Ids.Imdb ?? "<empty>"); response = TraktAPI.TraktAPI.PauseMovieScrobble(tScrobbleData); if (response != null && response.Movie != null && response.Action == "pause") { // add to cache TraktCache.AddMovieToPausedData(response.Movie, response.Progress); } } TraktLogger.LogTraktResponse(response); }) { IsBackground = true, Name = "Scrobble" }; scrobbleMovie.Start(scrobbleData); CurrentMovie = null; }
private void AddToFilmstrip(Latest latests, int x) { try { //Add to filmstrip IMDBMovie movie = new IMDBMovie(); movie.Title = latests.Title; movie.File = string.Empty; try { movie.RunTime = Int32.Parse(latests.Runtime); } catch { movie.RunTime = 0; } try { movie.Year = Int32.Parse(latests.Year); } catch { movie.Year = 0; } movie.DVDLabel = latests.Fanart; movie.Rating = latests.RoundedRating; movie.Watched = 0; Utils.LoadImage(latests.Thumb, ref imagesThumbs); GUIListItem item = new GUIListItem(); item.ItemId = x; item.IconImage = latests.Thumb; item.IconImageBig = latests.Thumb; item.ThumbnailImage = latests.Thumb; item.Label = movie.Title; item.Label2 = latests.Genre; item.Label3 = latests.DateAdded; item.IsFolder = false; item.Path = movie.File; item.Duration = movie.RunTime; // *60; item.AlbumInfoTag = movie; item.Year = movie.Year; item.DVDLabel = movie.DVDLabel; item.Rating = movie.Rating; item.Path = latests.Summary; item.IsPlayed = movie.Watched > 0 ? true : false; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(item_OnItemSelected); facadeCollection.Add(item); } catch (Exception ex) { logger.Error("AddToFilmstrip: " + ex.ToString()); } }
/// <summary> /// Gets the trakt compatible string for the movies Media Type /// </summary> private string GetMovieMediaType(IMDBMovie movie) { if (movie.MediaInfo == null) { return(null); } // My Videos does not expose this info via the API return(null); }
public void Select(IMDBMovie movie) { FilterDefinition definition = (FilterDefinition)currentView.Filters[CurrentLevel]; definition.SelectedValue = GetFieldIdValue(movie, definition.Where).ToString(); if (currentLevel + 1 < currentView.Filters.Count) { currentLevel++; } }
/// <summary> /// Checks if the movie is 3D or not /// </summary> private bool IsMovie3D(IMDBMovie movie) { if (movie.MediaInfo == null) { return(false); } // My Videos does not expose this info via the API return(false); }
private bool MovieMatch(IMDBMovie localMovie, TraktMovie traktMovie) { // IMDb comparison if (!string.IsNullOrEmpty(traktMovie.Ids.Imdb) && !string.IsNullOrEmpty(BasicHandler.GetProperImdbId(localMovie.IMDBNumber))) { return(string.Compare(BasicHandler.GetProperImdbId(localMovie.IMDBNumber), traktMovie.Ids.Imdb, true) == 0); } // Title & Year comparison return(string.Compare(localMovie.Title, traktMovie.Title, true) == 0 && localMovie.Year.ToString() == traktMovie.Year.ToString()); }
public NewMovie() { _status = Utils.ImporterStatus.NONE; _selected = -1; _moviedetails = new IMDBMovie(); _fetcher = new IMDBFetcher(this); _grabbermovies = new List <GrabberMovie>(); _hasnearest = false; _moviedetails.ID = -1; }
private bool MovieMatch(IMDBMovie myVideosMovie, TraktMovieBase traktMovie) { // IMDb comparison if (!string.IsNullOrEmpty(traktMovie.IMDBID) && !string.IsNullOrEmpty(BasicHandler.GetProperMovieImdbId(myVideosMovie.IMDBNumber))) { return(string.Compare(BasicHandler.GetProperMovieImdbId(myVideosMovie.IMDBNumber), traktMovie.IMDBID, true) == 0); } // Title & Year comparison return(string.Compare(myVideosMovie.Title, traktMovie.Title, true) == 0 && myVideosMovie.Year.ToString() == traktMovie.Year.ToString()); }
private static PlayListItem ToPlayListItem(IMDBMovie movie) { PlayListItem pli = new PlayListItem(); pli.Type = PlayListItem.PlayListItemType.Video; pli.FileName = movie.File; pli.Description = movie.Title; pli.Duration = movie.RunTime; return(pli); }
/// <summary> /// Shows the Rate Movie Dialog after playback has ended /// </summary> /// <param name="movie">The movie being rated</param> private void ShowRateDialog(IMDBMovie movie) { if (!TraktSettings.ShowRateDialogOnWatched) { return; } if (!TraktSettings.ShowRateDlgForPlaylists && PlayListPlayer.SingletonPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_VIDEO) { return; } TraktLogger.Debug("Showing rate dialog for movie. Title = '{0}', Year = '{1}', IMDb ID = '{2}'", movie.Title, movie.Year, movie.IMDBNumber ?? "<empty>"); var rateThread = new Thread((o) => { var movieToRate = o as IMDBMovie; if (movieToRate == null) { return; } var rateObject = new TraktSyncMovieRated { Ids = new TraktMovieId { Imdb = movieToRate.IMDBNumber.ToNullIfEmpty() }, Title = movieToRate.Title, Year = movieToRate.Year, RatedAt = DateTime.UtcNow.ToISO8601(), }; // get the rating submitted to trakt.tv int rating = GUI.GUIUtils.ShowRateDialog <TraktSyncMovieRated>(rateObject); if (rating > 0) { // update local cache TraktCache.AddMovieToRatings(rateObject, rating); TraktLogger.Debug("Rating {0} ({1}) as {2}/10", movieToRate.Title, movie.Year, rating.ToString()); } else if (rating == 0) { TraktCache.RemoveMovieFromRatings(rateObject); } }) { Name = "Rate", IsBackground = true }; rateThread.Start(movie); }
private void item_OnItemSelected(GUIListItem item, GUIControl parent) { IMDBMovie movie = item.AlbumInfoTag as IMDBMovie; if (movie == null) { movie = new IMDBMovie(); } movie.SetProperties(false); if (movie.ID >= 0) { string coverArtImage; string titleExt = movie.Title + "{" + movie.ID + "}"; coverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, titleExt); if (Util.Utils.FileExistsInCache(coverArtImage)) { facadeLayout.FilmstripLayout.InfoImageFileName = coverArtImage; } } else if (movie.Actor != string.Empty) { string coverArtImage; coverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieActors, movie.Actor); if (Util.Utils.FileExistsInCache(coverArtImage)) { facadeLayout.FilmstripLayout.InfoImageFileName = coverArtImage; } } // History item set on selected item string view = handler.CurrentLevelWhere; switch (view) { case "genre": m_history.Set(facadeLayout.SelectedListItem.Label, "genre"); break; case "actor": m_history.Set(facadeLayout.SelectedListItem.Label, "actor"); break; case "year": m_history.Set(facadeLayout.SelectedListItem.Label, "year"); break; default: if (handler.CurrentLevel == 0) { m_history.Set(facadeLayout.SelectedListItem.Label, "title"); } break; } }
private string GetFieldIdValue(IMDBMovie movie, string where) { if (where == "watched") { return(movie.Watched.ToString()); } if (where == "actor") { return(movie.ActorID.ToString()); } if (where == "director") { return(movie.ActorID.ToString()); } if (where == "title") { return(movie.ID.ToString()); } if (where == "genre") { return(movie.GenreID.ToString()); } if (where == "user groups" || where == "user groups only") { return(movie.UserGroupID.ToString()); } if (where == "movie collections" || where == "movie collections only") { return(movie.MovieCollectionID.ToString()); } if (where == "year") { return(movie.Year.ToString()); } if (where == "rating") { return(movie.Rating.ToString()); } if (where == "recently added") { return(movie.ID.ToString()); } if (where == "recently watched") { return(movie.ID.ToString()); } if (where == "actorindex" || where == "directorindex" || where == "titleindex") { return(movie.Title); } return(""); }
protected void SetYearThumbs(ArrayList itemlist) { foreach (GUIListItem item in itemlist) { // get the years somewhere since the label isn't set yet. IMDBMovie movie = item.AlbumInfoTag as IMDBMovie; if (movie != null) { string yearCover = Util.Utils.GetCoverArt(Thumbs.MovieYear, movie.Year.ToString()); SetItemThumb(item, yearCover); } } }
protected override void OnClick(int itemIndex) { GUIListItem item = facadeLayout.SelectedListItem; if (item == null) { return; } if (item.IsFolder) { currentSelectedItem = -1; if (item.Label == "..") { handler.CurrentLevel--; } else { IMDBMovie movie = item.AlbumInfoTag as IMDBMovie; ((VideoViewHandler)handler).Select(movie); } LoadDirectory(item.Path); } else { IMDBMovie movie = item.AlbumInfoTag as IMDBMovie; if (movie == null) { return; } if (movie.ID < 0) { return; } GUIVideoFiles.Reset(); // reset pincode ArrayList files = new ArrayList(); VideoDatabase.GetFiles(movie.ID, ref files); if (files.Count > 1) { GUIVideoFiles._stackedMovieFiles = files; GUIVideoFiles._isStacked = true; GUIVideoFiles.MovieDuration(files); } else { GUIVideoFiles._isStacked = false; } GUIVideoFiles.PlayMovie(movie.ID, false); } }