public static void SetMusicProperties(string chanName, Guid channelId) { string logo = string.Empty; if (channelId != Guid.Empty && chanName != string.Empty) { logo = Utility.GetLogoImage(channelId, chanName); } else { chanName = string.Empty; } if (string.IsNullOrEmpty(logo)) { logo = "defaultMyRadioBig.png"; } GUIPropertyManager.RemovePlayerProperties(); GUIPropertyManager.SetProperty("#Play.Current.Thumb", logo); GUIPropertyManager.SetProperty("#Play.Current.ArtistThumb", chanName); GUIPropertyManager.SetProperty("#Play.Current.Album", chanName); GUIPropertyManager.SetProperty("#Play.Current.Title", chanName); GUIPropertyManager.SetProperty("#Play.Current.Artist", chanName); }
private void DoOnEnded(g_Player.MediaType type, string filename) { if (type == g_Player.MediaType.Music || type == g_Player.MediaType.Radio) { GUIPropertyManager.RemovePlayerProperties(); } }
public static void Play() { // We have the Station Name in there to retrieve the correct Coverart for the station in the Vis Window GUIPropertyManager.RemovePlayerProperties(); GUIPropertyManager.SetProperty("#Play.Current.ArtistThumb", _currentChannel.DisplayName); GUIPropertyManager.SetProperty("#Play.Current.Album", _currentChannel.DisplayName); if ((_currentChannel.IsWebstream()) || (_currentChannel.CurrentProgram == null || _currentChannel.NextProgram == null || string.IsNullOrEmpty(_currentChannel.CurrentProgram.Title) || string.IsNullOrEmpty(_currentChannel.NextProgram.Title))) { GUIPropertyManager.SetProperty("#Play.Current.Title", _currentChannel.DisplayName); // No EPG GUIPropertyManager.SetProperty("#Play.Next.Title", string.Empty); } else { GUIPropertyManager.SetProperty("#Play.Current.Title", _currentChannel.CurrentProgram.Title); GUIPropertyManager.SetProperty("#Play.Next.Title", _currentChannel.NextProgram.Title); } string strLogo = Utils.GetCoverArt(Thumbs.Radio, _currentChannel.DisplayName); if (string.IsNullOrEmpty(strLogo)) { strLogo = "defaultMyRadioBig.png"; } GUIPropertyManager.SetProperty("#Play.Current.Thumb", strLogo); if (g_Player.Playing && !_currentChannel.IsWebstream()) { if (!g_Player.IsTimeShifting || (g_Player.IsTimeShifting && _currentChannel.IsWebstream())) { g_Player.Stop(); } } if (_currentChannel.IsWebstream()) { g_Player.PlayAudioStream(GetPlayPath(_currentChannel)); GUIPropertyManager.SetProperty("#Play.Current.Title", _currentChannel.DisplayName); } else { if (g_Player.IsRadio && g_Player.Playing) { Channel currentlyPlaying = TVHome.Navigator.Channel; if (currentlyPlaying != null && currentlyPlaying.IdChannel == _currentChannel.IdChannel) { return; } } TVHome.ViewChannelAndCheck(_currentChannel); } }
private static void Play(GUIListItem item) { // We have the Station Name in there to retrieve the correct Coverart for the station in the Vis Window GUIPropertyManager.RemovePlayerProperties(); GUIPropertyManager.SetProperty("#Play.Current.ArtistThumb", item.Label); GUIPropertyManager.SetProperty("#Play.Current.Album", item.Label); GUIPropertyManager.SetProperty("#Play.Current.Thumb", item.ThumbnailImage); if (item.MusicTag == null) { return; } _currentChannel = (Channel)item.MusicTag; Play(); }
/// <summary> /// Examines the current playing movie and fills in all the #tags for the skin. /// For movies it will look in the video database for any IMDB info /// For record TV programs it will look in the TVDatabase for recording info /// </summary> /// <param name="fileName">Filename of the current playing movie</param> /// <remarks> /// Function will fill in the following tags for TV programs /// #Play.Current.Title, #Play.Current.Plot, #Play.Current.PlotOutline #Play.Current.File, #Play.Current.Thumb, #Play.Current.Year, #Play.Current.Channel, /// /// Function will fill in the following tags for movies /// #Play.Current.Title, #Play.Current.Plot, #Play.Current.PlotOutline #Play.Current.File, #Play.Current.Thumb, #Play.Current.Year /// #Play.Current.Director, #cast, #dvdlabel, #imdbnumber, #Play.Current.Plot, #Play.Current.PlotOutline, #rating, #tagline, #votes, #credits /// </remarks> private void SetCurrentFile(string fileName) { GUIPropertyManager.RemovePlayerProperties(); GUIPropertyManager.SetProperty("#Play.Current.Title", Util.Utils.GetFilename(fileName)); GUIPropertyManager.SetProperty("#Play.Current.File", Path.GetFileName(fileName)); GUIPropertyManager.SetProperty("#Play.Current.Thumb", ""); GUIPropertyManager.SetProperty("#Play.Current.VideoCodec.Texture", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.VideoResolution", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.AudioCodec.Texture", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.AudioChannels", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.HasSubtitles", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.AspectRatio", string.Empty); if ((g_Player.IsVideo || g_Player.IsDVD) && !g_Player.IsTV && g_Player.MediaInfo != null) { GUIPropertyManager.SetProperty("#Play.Current.VideoCodec.Texture", Util.Utils.MakeFileName(g_Player.MediaInfo.VideoCodec)); GUIPropertyManager.SetProperty("#Play.Current.VideoResolution", g_Player.MediaInfo.VideoResolution); GUIPropertyManager.SetProperty("#Play.Current.AudioCodec.Texture", Util.Utils.MakeFileName(g_Player.MediaInfo.AudioCodec)); GUIPropertyManager.SetProperty("#Play.Current.AudioChannels", g_Player.MediaInfo.AudioChannelsFriendly); GUIPropertyManager.SetProperty("#Play.Current.HasSubtitles", g_Player.MediaInfo.HasSubtitles.ToString()); GUIPropertyManager.SetProperty("#Play.Current.AspectRatio", g_Player.MediaInfo.AspectRatio); } if (g_Player.IsDVD) { // for dvd's the file is in the form c:\media\movies\the matrix\video_ts\video_ts.ifo // first strip the \video_ts\video_ts.ifo string lowPath = fileName.ToLower(); int index = lowPath.IndexOf("video_ts/"); if (index < 0) { index = lowPath.IndexOf(@"video_ts\"); } if (index >= 0) { fileName = fileName.Substring(0, index); fileName = Util.Utils.RemoveTrailingSlash(fileName); // get the name by stripping the first part : c:\media\movies string strName = fileName; int pos = fileName.LastIndexOfAny(new char[] { '\\', '/' }); if (pos >= 0 && pos + 1 < fileName.Length - 1) { strName = fileName.Substring(pos + 1); } GUIPropertyManager.SetProperty("#Play.Current.Title", strName); GUIPropertyManager.SetProperty("#Play.Current.File", strName); // construct full filename as imdb info is stored... fileName += @"\VIDEO_TS\VIDEO_TS.IFO"; } } bool isLive = g_Player.IsTimeShifting; string extension = Path.GetExtension(fileName).ToLower(); if (extension.Equals(".sbe") || extension.Equals(".dvr-ms") || (extension.Equals(".ts") && !isLive || g_Player.IsTVRecording)) { // this is a recorded movie. // check the TVDatabase for the description,genre,title,... if (g_Player.currentTitle != "") { GUIPropertyManager.SetProperty("#Play.Current.Title", g_Player.currentTitle); GUIPropertyManager.SetProperty("#Play.Current.Plot", g_Player.currentTitle + "\n" + g_Player.currentDescription); GUIPropertyManager.SetProperty("#Play.Current.PlotOutline", g_Player.currentDescription); } } /*if (fileName.Substring(0, 4) == "rtsp") * { * GUIPropertyManager.SetProperty("#Play.Current.Title", g_Player.currentTitle); * GUIPropertyManager.SetProperty("#Play.Current.Plot", g_Player.currentTitle + "\n" + g_Player.currentDescription); * GUIPropertyManager.SetProperty("#Play.Current.PlotOutline", g_Player.currentDescription); * }*/ IMDBMovie movieDetails = new IMDBMovie(); bool bMovieInfoFound = false; if (!g_Player.IsTVRecording) { if (VideoDatabase.HasMovieInfo(fileName)) { VideoDatabase.GetMovieInfo(fileName, ref movieDetails); bMovieInfoFound = true; } else if (File.Exists(Path.ChangeExtension(fileName, ".xml"))) { MatroskaTagInfo info = MatroskaTagHandler.Fetch(Path.ChangeExtension(fileName, ".xml")); movieDetails.Title = info.title; movieDetails.Plot = info.description; movieDetails.Genre = info.genre; GUIPropertyManager.SetProperty("#Play.Current.Channel", info.channelName); string logo = Util.Utils.GetCoverArt(Thumbs.TVChannel, info.channelName); if (!Util.Utils.FileExistsInCache(logo)) { logo = "defaultVideoBig.png"; } GUIPropertyManager.SetProperty("#Play.Current.Thumb", logo); _thumbLogo = logo; bMovieInfoFound = true; } if (bMovieInfoFound) { movieDetails.SetPlayProperties(); } else { GUIListItem item = new GUIListItem(); item.IsFolder = false; item.Path = fileName; Util.Utils.SetThumbnails(ref item); GUIPropertyManager.SetProperty("#Play.Current.Thumb", item.ThumbnailImage); } } else if (g_Player.IsTV && g_Player.IsTimeShifting) { GUIPropertyManager.SetProperty("#Play.Current.Title", GUIPropertyManager.GetProperty("#TV.View.channel")); GUIPropertyManager.SetProperty("#Play.Current.Genre", GUIPropertyManager.GetProperty("#TV.View.title")); } else { GUIListItem item = new GUIListItem(); item.IsFolder = false; item.Path = fileName; Util.Utils.SetThumbnails(ref item); GUIPropertyManager.SetProperty("#Play.Current.Thumb", item.ThumbnailImage); } _thumbLogo = GUIPropertyManager.GetProperty("#Play.Current.Thumb"); }
private static void SetCurrentSkinProperties(MusicTag tag, String fileName) { var thumb = string.Empty; if (tag != null) { string strThumb = Util.Utils.GetAlbumThumbName(tag.Artist, tag.Album); if (Util.Utils.FileExistsInCache(strThumb)) { thumb = strThumb; } // no succes with album cover try folder cache if (string.IsNullOrEmpty(thumb)) { thumb = Util.Utils.TryEverythingToGetFolderThumbByFilename(fileName, false); } // let us test if there is a larger cover art image string strLarge = Util.Utils.ConvertToLargeCoverArt(thumb); if (Util.Utils.FileExistsInCache(strLarge)) { thumb = strLarge; } GUIPropertyManager.SetProperty("#Play.Current.Thumb", thumb); // non-text values default to 0 and datetime.minvalue so // set the appropriate properties to string.empty // Duration string strDuration = tag.Duration <= 0 ? string.Empty : MediaPortal.Util.Utils.SecondsToHMSString(tag.Duration); // Track string strTrack = tag.Track <= 0 ? string.Empty : tag.Track.ToString(); // Year string strYear = tag.Year <= 1900 ? string.Empty : tag.Year.ToString(); // Rating string strRating = (Convert.ToDecimal(2 * tag.Rating + 1)).ToString(); // Bitrate string strBitrate = tag.BitRate <= 0 ? string.Empty : tag.BitRate.ToString(); // Disc ID string strDiscID = tag.DiscID <= 0 ? string.Empty : tag.DiscID.ToString(); // Disc Total string strDiscTotal = tag.DiscTotal <= 0 ? string.Empty : tag.DiscTotal.ToString(); // Times played string strTimesPlayed = tag.TimesPlayed <= 0 ? string.Empty : tag.TimesPlayed.ToString(); // track total string strTrackTotal = tag.TrackTotal <= 0 ? string.Empty : tag.TrackTotal.ToString(); // BPM string strBPM = tag.BPM <= 0 ? string.Empty : tag.BPM.ToString(); // Channels string strChannels = tag.Channels <= 0 ? string.Empty : tag.Channels.ToString(); // Sample Rate string strSampleRate = tag.SampleRate <= 0 ? string.Empty : tag.SampleRate.ToString(); // Date Last Played string strDateLastPlayed = tag.DateTimePlayed == DateTime.MinValue ? string.Empty : tag.DateTimePlayed.ToShortDateString(); // Date Added string strDateAdded = tag.DateTimeModified == DateTime.MinValue ? string.Empty : tag.DateTimeModified.ToShortDateString(); GUIPropertyManager.SetProperty("#Play.Current.Title", tag.Title); GUIPropertyManager.SetProperty("#Play.Current.Track", strTrack); GUIPropertyManager.SetProperty("#Play.Current.Album", tag.Album); GUIPropertyManager.SetProperty("#Play.Current.Artist", tag.Artist); GUIPropertyManager.SetProperty("#Play.Current.Genre", tag.Genre); GUIPropertyManager.SetProperty("#Play.Current.Year", strYear); GUIPropertyManager.SetProperty("#Play.Current.Rating", strRating); GUIPropertyManager.SetProperty("#Play.Current.Duration", strDuration); GUIPropertyManager.SetProperty("#duration", strDuration); GUIPropertyManager.SetProperty("#Play.Current.AlbumArtist", tag.AlbumArtist); GUIPropertyManager.SetProperty("#Play.Current.BitRate", strBitrate); GUIPropertyManager.SetProperty("#Play.Current.Comment", tag.Comment); GUIPropertyManager.SetProperty("#Play.Current.Composer", tag.Composer); GUIPropertyManager.SetProperty("#Play.Current.Conductor", tag.Conductor); GUIPropertyManager.SetProperty("#Play.Current.DiscID", strDiscID); GUIPropertyManager.SetProperty("#Play.Current.DiscTotal", strDiscTotal); GUIPropertyManager.SetProperty("#Play.Current.Lyrics", tag.Lyrics); GUIPropertyManager.SetProperty("#Play.Current.TimesPlayed", strTimesPlayed); GUIPropertyManager.SetProperty("#Play.Current.TrackTotal", strTrackTotal); GUIPropertyManager.SetProperty("#Play.Current.FileType", tag.FileType); GUIPropertyManager.SetProperty("#Play.Current.Codec", tag.Codec); GUIPropertyManager.SetProperty("#Play.Current.BitRateMode", tag.BitRateMode); GUIPropertyManager.SetProperty("#Play.Current.BPM", strBPM); GUIPropertyManager.SetProperty("#Play.Current.Channels", strChannels); GUIPropertyManager.SetProperty("#Play.Current.SampleRate", strSampleRate); GUIPropertyManager.SetProperty("#Play.Current.DateLastPlayed", strDateLastPlayed); GUIPropertyManager.SetProperty("#Play.Current.DateAdded", strDateAdded); var albumInfo = new AlbumInfo(); if (MusicDatabase.Instance.GetAlbumInfo(tag.Album, tag.AlbumArtist, ref albumInfo)) { GUIPropertyManager.SetProperty("#Play.AlbumInfo.Review", albumInfo.Review); GUIPropertyManager.SetProperty("#Play.AlbumInfo.Rating", albumInfo.Rating.ToString()); GUIPropertyManager.SetProperty("#Play.AlbumInfo.Genre", albumInfo.Genre); GUIPropertyManager.SetProperty("#Play.AlbumInfo.Styles", albumInfo.Styles); GUIPropertyManager.SetProperty("#Play.AlbumInfo.Tones", albumInfo.Tones); GUIPropertyManager.SetProperty("#Play.AlbumInfo.Year", albumInfo.Year.ToString()); } else { GUIPropertyManager.SetProperty("#Play.AlbumInfo.Review", String.Empty); GUIPropertyManager.SetProperty("#Play.AlbumInfo.Rating", String.Empty); GUIPropertyManager.SetProperty("#Play.AlbumInfo.Genre", String.Empty); GUIPropertyManager.SetProperty("#Play.AlbumInfo.Styles", String.Empty); GUIPropertyManager.SetProperty("#Play.AlbumInfo.Tones", String.Empty); GUIPropertyManager.SetProperty("#Play.AlbumInfo.Year", String.Empty); } var artistInfo = new ArtistInfo(); if (MusicDatabase.Instance.GetArtistInfo(tag.Artist, ref artistInfo)) { GUIPropertyManager.SetProperty("#Play.ArtistInfo.Bio", artistInfo.AMGBio); GUIPropertyManager.SetProperty("#Play.ArtistInfo.Born", artistInfo.Born); GUIPropertyManager.SetProperty("#Play.ArtistInfo.Genres", artistInfo.Genres); GUIPropertyManager.SetProperty("#Play.ArtistInfo.Instruments", artistInfo.Instruments); GUIPropertyManager.SetProperty("#Play.ArtistInfo.Styles", artistInfo.Styles); GUIPropertyManager.SetProperty("#Play.ArtistInfo.Tones", artistInfo.Tones); GUIPropertyManager.SetProperty("#Play.ArtistInfo.YearsActive", artistInfo.YearsActive); } else { GUIPropertyManager.SetProperty("#Play.ArtistInfo.Bio", String.Empty); GUIPropertyManager.SetProperty("#Play.ArtistInfo.Born", String.Empty); GUIPropertyManager.SetProperty("#Play.ArtistInfo.Genres", String.Empty); GUIPropertyManager.SetProperty("#Play.ArtistInfo.Instruments", String.Empty); GUIPropertyManager.SetProperty("#Play.ArtistInfo.Styles", String.Empty); GUIPropertyManager.SetProperty("#Play.ArtistInfo.Tones", String.Empty); GUIPropertyManager.SetProperty("#Play.ArtistInfo.YearsActive", String.Empty); } } else { // there is no current track so blank all properties GUIPropertyManager.RemovePlayerProperties(); GUIPropertyManager.SetProperty("#Play.Current.Title", GUILocalizeStrings.Get(4543)); } }
/// <summary> /// Examines the current playing movie and fills in all the properties for the skin. /// For movies it will look in the video database for any IMDB info /// For record TV programs it will look in the TVDatabase for recording info /// </summary> /// <param name="fileName">Filename of the current playing movie</param> /// <remarks> /// Function will fill in the following properties for TV programs /// #Play.Current.Title, #Play.Current.Plot, #Play.Current.PlotOutline #Play.Current.File, #Play.Current.Thumb, #Play.Current.Year, #Play.Current.Channel, /// /// Function will fill in the following properties for movies /// #Play.Current.Title, #Play.Current.Plot, #Play.Current.PlotOutline #Play.Current.File, #Play.Current.Thumb, #Play.Current.Year /// #Play.Current.Director, #cast, #dvdlabel, #imdbnumber, #Play.Current.Plot, #Play.Current.PlotOutline, #rating, #tagline, #votes, #credits /// </remarks> private void SetCurrentFile(string fileName) { // Clear all player properties and the audio / video properties GUIPropertyManager.RemovePlayerProperties(); GUIPropertyManager.SetProperty("#Play.Current.VideoCodec.Texture", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.VideoResolution", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.AudioCodec.Texture", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.AudioChannels", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.HasSubtitles", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.AspectRatio", string.Empty); // Preset title and file GUIPropertyManager.SetProperty("#Play.Current.Title", Util.Utils.GetFilename(fileName)); GUIPropertyManager.SetProperty("#Play.Current.File", Util.Utils.GetFileNameWithExtension(fileName)); // Set audio / video properties if ((g_Player.IsVideo || g_Player.IsDVD) && !g_Player.IsTV && g_Player.MediaInfo != null) { GUIPropertyManager.SetProperty("#Play.Current.VideoCodec.Texture", Util.Utils.MakeFileName(g_Player.MediaInfo.VideoCodec)); GUIPropertyManager.SetProperty("#Play.Current.VideoResolution", g_Player.MediaInfo.VideoResolution); GUIPropertyManager.SetProperty("#Play.Current.AudioCodec.Texture", Util.Utils.MakeFileName(g_Player.MediaInfo.AudioCodec)); GUIPropertyManager.SetProperty("#Play.Current.AudioChannels", g_Player.MediaInfo.AudioChannelsFriendly); GUIPropertyManager.SetProperty("#Play.Current.HasSubtitles", g_Player.MediaInfo.HasSubtitles.ToString()); GUIPropertyManager.SetProperty("#Play.Current.AspectRatio", g_Player.MediaInfo.AspectRatio); } // Set the properties and thumb path for movies played with the tv plugin if (g_Player.IsTVRecording) { // Set the thumb path to the tv recorded thumbs cache or to the channel logo string thumb = string.Format("{0}\\{1}{2}", Thumbs.TVRecorded, Path.ChangeExtension(Util.Utils.SplitFilename(g_Player.currentFileName), null), Util.Utils.GetThumbExtension()); if (!Util.Utils.FileExistsInCache(thumb)) { thumb = Util.Utils.GetCoverArt(Thumbs.TVChannel, GUIPropertyManager.GetProperty("#TV.RecordedTV.Channel")); } GUIPropertyManager.SetProperty("#Play.Current.Thumb", thumb); // Set the properties to the #TV.Recorded properties GUIPropertyManager.SetProperty("#Play.Current.Title", GUIPropertyManager.GetProperty("#TV.RecordedTV.Title")); GUIPropertyManager.SetProperty("#Play.Current.Plot", GUIPropertyManager.GetProperty("#TV.RecordedTV.Description")); GUIPropertyManager.SetProperty("#Play.Current.Genre", GUIPropertyManager.GetProperty("#TV.RecordedTV.Genre")); GUIPropertyManager.SetProperty("#Play.Current.Channel", GUIPropertyManager.GetProperty("#TV.RecordedTV.Channel")); return; } // Set title and file for DVD if (g_Player.IsDVD) { // for dvd's the file is in the form c:\media\movies\the matrix\video_ts\video_ts.ifo // first strip the \video_ts\video_ts.ifo string lowPath = fileName.ToLowerInvariant(); int index = lowPath.IndexOf("video_ts/"); if (index < 0) { index = lowPath.IndexOf(@"video_ts\"); } if (index >= 0) { fileName = fileName.Substring(0, index); fileName = Util.Utils.RemoveTrailingSlash(fileName); // get the name by stripping the first part : c:\media\movies string strName = fileName; int pos = fileName.LastIndexOfAny(new char[] { '\\', '/' }); if (pos >= 0 && pos + 1 < fileName.Length - 1) { strName = fileName.Substring(pos + 1); } // get the name when play DVD directly from Drive letter List <GUIListItem> rootDrives = VirtualDirectories.Instance.Movies.GetRootExt(); for (int i = rootDrives.Count - 1; i >= 0; i--) { GUIListItem itemDVDroot = (GUIListItem)rootDrives[i]; string itemDVD = Path.GetPathRoot(itemDVDroot.Path); itemDVD = Util.Utils.RemoveTrailingSlash(itemDVD); if (itemDVD == strName && !String.IsNullOrEmpty(itemDVDroot.DVDLabel)) //cd or dvd drive { strName = itemDVDroot.DVDLabel; } } GUIPropertyManager.SetProperty("#Play.Current.Title", strName); GUIPropertyManager.SetProperty("#Play.Current.File", strName); // construct full filename as imdb info is stored... fileName += @"\VIDEO_TS\VIDEO_TS.IFO"; } } // Get the BD handler ISelectBDHandler selectBdHandler; if (GlobalServiceProvider.IsRegistered <ISelectBDHandler>()) { selectBdHandler = GlobalServiceProvider.Get <ISelectBDHandler>(); } else { selectBdHandler = new SelectBDHandler(); GlobalServiceProvider.Add <ISelectBDHandler>(selectBdHandler); } // Adapt filename for image files if (Util.Utils.IsISOImage(fileName)) { fileName = DaemonTools.MountedIsoFile; } // ------------------------------------------------------- // Try to set the properties and the thumb path in 5 steps bool movieInfoFound = false; bool thumbInfoFound = false; // Step 1 ------------------------------- ------------------------- // Try to set the properties and thumb path from the video database IMDBMovie movie = new IMDBMovie(); string name = fileName; if (fileName.ToLowerInvariant().Contains(".mpls")) // BD folder title check (playlist) { int index = fileName.ToLowerInvariant().LastIndexOf(@"\playlist"); name = fileName.Remove(index) + @"\index.bdmv"; } if (VideoDatabase.HasMovieInfo(name)) { // Set the properties (incuding cover thumb) from the movie info VideoDatabase.GetMovieInfo(name, ref movie); if (movie.ThumbURL.ToLowerInvariant().StartsWith("file://")) { movie.ThumbURL = movie.ThumbURL.Substring(7); } movie.SetPlayProperties(true); movieInfoFound = true; if (!string.IsNullOrEmpty(movie.ThumbURL)) { thumbInfoFound = true; return; } } // Step 2 -------------------------------------------------------- // Try to set the properties and the thumb path from the .nfo file string path = string.Empty; int pathIndex = 0; if (fileName.ToUpperInvariant().Contains(@"\BDMV")) { pathIndex = fileName.ToUpperInvariant().LastIndexOf(@"\BDMV"); path = fileName.Remove(pathIndex); } else if (fileName.ToUpperInvariant().Contains(@"\VIDEO_TS\")) { pathIndex = fileName.ToUpperInvariant().LastIndexOf(@"\VIDEO_TS\"); path = fileName.Remove(pathIndex); } else if (!String.IsNullOrEmpty(fileName)) { path = Path.GetDirectoryName(fileName); } IMDBMovie.FetchMovieNfo(path, fileName, ref movie); if (!movie.IsEmpty) { // Set the properties (incuding cover thumb) from the .nfo file movie.SetPlayProperties(true); movieInfoFound = true; if (!string.IsNullOrEmpty(movie.ThumbURL)) { thumbInfoFound = true; return; } } // Step 3 ------------------------------------- // Try to set the properties from the .xml file if (File.Exists(Path.ChangeExtension(fileName, ".xml"))) { MatroskaTagInfo info = MatroskaTagHandler.Fetch(Path.ChangeExtension(fileName, ".xml")); if (info != null) { // Set properties from the .xml file movieInfoFound = true; movie.Title = info.Title; movie.Plot = info.Description; movie.Genre = info.Genre; if (thumbInfoFound) { // take previously found thumb movie.ThumbURL = GUIPropertyManager.GetProperty("#Play.Current.Thumb"); } else { // take channel logo (better than nothing, but do not set thumbInfoFound) movie.ThumbURL = Util.Utils.GetCoverArt(Thumbs.TVChannel, info.ChannelName); } movie.SetPlayProperties(true); GUIPropertyManager.SetProperty("#Play.Current.Channel", info.ChannelName); } } // Step 4 ------------------------------------------------------------ // If nothing else helps, try to set the thumb path from the file name if (!thumbInfoFound) { GUIListItem item = new GUIListItem(); item.IsFolder = false; item.Path = fileName; Util.Utils.SetThumbnails(ref item); if (!string.IsNullOrEmpty(item.ThumbnailImage)) { GUIPropertyManager.SetProperty("#Play.Current.Thumb", item.ThumbnailImage); } } // Step 5 -------------------------------- // All is done if the movie info was found if (movieInfoFound) { return; } // Fallback ---------------------------------------------- // If no movie info could be found, set at least the title if (!movieInfoFound && g_Player.IsTV && g_Player.IsTimeShifting) { // Set the title for live TV GUIPropertyManager.SetProperty("#Play.Current.Title", GUIPropertyManager.GetProperty("#TV.View.title")); return; } if (!movieInfoFound && VirtualDirectory.IsImageFile(Path.GetExtension(fileName))) { // Set the title for images string title = Util.Utils.GetFilename(fileName, true); GUIPropertyManager.SetProperty("#Play.Current.Title", title); return; } if (fileName.ToLowerInvariant().Contains("index.bdmv")) { // Set the title for BDs string title = selectBdHandler.GetDiscTitle(fileName); if (String.IsNullOrEmpty(title)) { // get the name when play BD directly from Drive letter List <GUIListItem> rootDrives = VirtualDirectories.Instance.Movies.GetRootExt(); title = Path.GetPathRoot(fileName); title = Util.Utils.RemoveTrailingSlash(title); for (int i = rootDrives.Count - 1; i >= 0; i--) { GUIListItem itemBDroot = (GUIListItem)rootDrives[i]; string itemBD = Path.GetPathRoot(itemBDroot.Path); itemBD = Util.Utils.RemoveTrailingSlash(itemBD); if (itemBD == title && !String.IsNullOrEmpty(itemBDroot.DVDLabel)) { title = itemBDroot.DVDLabel; } } } GUIPropertyManager.SetProperty("#Play.Current.Title", title); } else if (fileName.ToLowerInvariant().Contains(".mpls")) { // Set the title for BD playlist string title = selectBdHandler.GetDiscTitle(fileName); if (String.IsNullOrEmpty(title)) { // get the name when play BD directly from Drive letter List <GUIListItem> rootDrives = VirtualDirectories.Instance.Movies.GetRootExt(); title = Path.GetPathRoot(fileName); title = Util.Utils.RemoveTrailingSlash(title); for (int i = rootDrives.Count - 1; i >= 0; i--) { GUIListItem itemBDroot = (GUIListItem)rootDrives[i]; string itemBD = Path.GetPathRoot(itemBDroot.Path); itemBD = Util.Utils.RemoveTrailingSlash(itemBD); if (itemBD == title && !String.IsNullOrEmpty(itemBDroot.DVDLabel)) { title = itemBDroot.DVDLabel; } } } GUIPropertyManager.SetProperty("#Play.Current.Title", title); } }
/// <summary> /// Examines the current playing movie and fills in all the #tags for the skin. /// For movies it will look in the video database for any IMDB info /// For record TV programs it will look in the TVDatabase for recording info /// </summary> /// <param name="fileName">Filename of the current playing movie</param> /// <remarks> /// Function will fill in the following tags for TV programs /// #Play.Current.Title, #Play.Current.Plot, #Play.Current.PlotOutline #Play.Current.File, #Play.Current.Thumb, #Play.Current.Year, #Play.Current.Channel, /// /// Function will fill in the following tags for movies /// #Play.Current.Title, #Play.Current.Plot, #Play.Current.PlotOutline #Play.Current.File, #Play.Current.Thumb, #Play.Current.Year /// #Play.Current.Director, #cast, #dvdlabel, #imdbnumber, #Play.Current.Plot, #Play.Current.PlotOutline, #rating, #tagline, #votes, #credits /// </remarks> private void SetCurrentFile(string fileName) { GUIPropertyManager.RemovePlayerProperties(); GUIPropertyManager.SetProperty("#Play.Current.Title", Util.Utils.GetFilename(fileName)); GUIPropertyManager.SetProperty("#Play.Current.File", Util.Utils.GetFileNameWithExtension(fileName)); GUIPropertyManager.SetProperty("#Play.Current.Thumb", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.VideoCodec.Texture", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.VideoResolution", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.AudioCodec.Texture", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.AudioChannels", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.HasSubtitles", string.Empty); GUIPropertyManager.SetProperty("#Play.Current.AspectRatio", string.Empty); if ((g_Player.IsVideo || g_Player.IsDVD) && !g_Player.IsTV && g_Player.MediaInfo != null) { GUIPropertyManager.SetProperty("#Play.Current.VideoCodec.Texture", Util.Utils.MakeFileName(g_Player.MediaInfo.VideoCodec)); GUIPropertyManager.SetProperty("#Play.Current.VideoResolution", g_Player.MediaInfo.VideoResolution); GUIPropertyManager.SetProperty("#Play.Current.AudioCodec.Texture", Util.Utils.MakeFileName(g_Player.MediaInfo.AudioCodec)); GUIPropertyManager.SetProperty("#Play.Current.AudioChannels", g_Player.MediaInfo.AudioChannelsFriendly); GUIPropertyManager.SetProperty("#Play.Current.HasSubtitles", g_Player.MediaInfo.HasSubtitles.ToString()); GUIPropertyManager.SetProperty("#Play.Current.AspectRatio", g_Player.MediaInfo.AspectRatio); } if (g_Player.IsDVD) { // for dvd's the file is in the form c:\media\movies\the matrix\video_ts\video_ts.ifo // first strip the \video_ts\video_ts.ifo string lowPath = fileName.ToLowerInvariant(); int index = lowPath.IndexOf("video_ts/"); if (index < 0) { index = lowPath.IndexOf(@"video_ts\"); } if (index >= 0) { fileName = fileName.Substring(0, index); fileName = Util.Utils.RemoveTrailingSlash(fileName); // get the name by stripping the first part : c:\media\movies string strName = fileName; int pos = fileName.LastIndexOfAny(new char[] { '\\', '/' }); if (pos >= 0 && pos + 1 < fileName.Length - 1) { strName = fileName.Substring(pos + 1); } // get the name when play DVD directly from Drive letter List <GUIListItem> rootDrives = VirtualDirectories.Instance.Movies.GetRootExt(); for (int i = rootDrives.Count - 1; i >= 0; i--) { GUIListItem itemDVDroot = (GUIListItem)rootDrives[i]; string itemDVD = Path.GetPathRoot(itemDVDroot.Path); itemDVD = Util.Utils.RemoveTrailingSlash(itemDVD); if (itemDVD == strName && !String.IsNullOrEmpty(itemDVDroot.DVDLabel)) //cd or dvd drive { strName = itemDVDroot.DVDLabel; } } GUIPropertyManager.SetProperty("#Play.Current.Title", strName); GUIPropertyManager.SetProperty("#Play.Current.File", strName); // construct full filename as imdb info is stored... fileName += @"\VIDEO_TS\VIDEO_TS.IFO"; } } bool isLive = g_Player.IsTimeShifting; string extension = Util.Utils.GetFileExtension(fileName).ToLowerInvariant(); if (extension.Equals(".sbe") || extension.Equals(".dvr-ms") || (extension.Equals(".ts") && !isLive || g_Player.IsTVRecording)) { // this is a recorded movie. // check the TVDatabase for the description,genre,title,... if (g_Player.currentTitle != "") { GUIPropertyManager.SetProperty("#Play.Current.Title", g_Player.currentTitle); GUIPropertyManager.SetProperty("#Play.Current.Plot", g_Player.currentTitle + "\n" + g_Player.currentDescription); GUIPropertyManager.SetProperty("#Play.Current.PlotOutline", g_Player.currentDescription); } } /*if (fileName.Substring(0, 4) == "rtsp") * { * GUIPropertyManager.SetProperty("#Play.Current.Title", g_Player.currentTitle); * GUIPropertyManager.SetProperty("#Play.Current.Plot", g_Player.currentTitle + "\n" + g_Player.currentDescription); * GUIPropertyManager.SetProperty("#Play.Current.PlotOutline", g_Player.currentDescription); * }*/ IMDBMovie movieDetails = new IMDBMovie(); bool bMovieInfoFound = false; ISelectBDHandler selectBdHandler; if (GlobalServiceProvider.IsRegistered <ISelectBDHandler>()) { selectBdHandler = GlobalServiceProvider.Get <ISelectBDHandler>(); } else { selectBdHandler = new SelectBDHandler(); GlobalServiceProvider.Add <ISelectBDHandler>(selectBdHandler); } bool playingRemoteUrl = Util.Utils.IsRemoteUrl(fileName); if (!g_Player.IsTVRecording && !playingRemoteUrl) { // Check if we play image file to search db with the proper filename if (Util.Utils.IsISOImage(fileName)) { fileName = DaemonTools.MountedIsoFile; } if (VideoDatabase.HasMovieInfo(fileName)) { VideoDatabase.GetMovieInfo(fileName, ref movieDetails); bMovieInfoFound = true; } else if (File.Exists(Path.ChangeExtension(fileName, ".xml"))) { MatroskaTagInfo info = MatroskaTagHandler.Fetch(Path.ChangeExtension(fileName, ".xml")); movieDetails.Title = info.title; movieDetails.Plot = info.description; movieDetails.Genre = info.genre; GUIPropertyManager.SetProperty("#Play.Current.Channel", info.channelName); string logo = Util.Utils.GetCoverArt(Thumbs.TVChannel, info.channelName); if (!Util.Utils.FileExistsInCache(logo)) { logo = "defaultVideoBig.png"; } GUIPropertyManager.SetProperty("#Play.Current.Thumb", logo); _thumbLogo = logo; bMovieInfoFound = true; } else // Nfo support { string path = string.Empty; int pathIndex = 0; if (fileName.ToUpperInvariant().Contains(@"\BDMV")) { pathIndex = fileName.ToUpperInvariant().LastIndexOf(@"\BDMV"); path = fileName.Remove(pathIndex); } else if (fileName.ToUpperInvariant().Contains(@"\VIDEO_TS\")) { pathIndex = fileName.ToUpperInvariant().LastIndexOf(@"\VIDEO_TS\"); path = fileName.Remove(pathIndex); } else if (!String.IsNullOrEmpty(fileName)) { path = Path.GetDirectoryName(fileName); } IMDBMovie.FetchMovieNfo(path, fileName, ref movieDetails); if (!movieDetails.IsEmpty) { bMovieInfoFound = true; } } if (bMovieInfoFound) { movieDetails.SetPlayProperties(true); } else { GUIListItem item = new GUIListItem(); item.IsFolder = false; item.Path = fileName; Util.Utils.SetThumbnails(ref item); GUIPropertyManager.SetProperty("#Play.Current.Thumb", item.ThumbnailImage); // Image file check to set title for OSD (non db) if (VirtualDirectory.IsImageFile(Path.GetExtension(fileName))) { string title = Util.Utils.GetFilename(fileName, true); GUIPropertyManager.SetProperty("#Play.Current.Title", title); } else if (fileName.ToLowerInvariant().Contains("index.bdmv")) // BD folder title check { string title = selectBdHandler.GetDiscTitle(fileName); // get the name when play BD directly from Drive letter if (String.IsNullOrEmpty(title)) { List <GUIListItem> rootDrives = VirtualDirectories.Instance.Movies.GetRootExt(); title = Path.GetPathRoot(fileName); title = Util.Utils.RemoveTrailingSlash(title); for (int i = rootDrives.Count - 1; i >= 0; i--) { GUIListItem itemBDroot = (GUIListItem)rootDrives[i]; string itemBD = Path.GetPathRoot(itemBDroot.Path); itemBD = Util.Utils.RemoveTrailingSlash(itemBD); if (itemBD == title && !String.IsNullOrEmpty(itemBDroot.DVDLabel)) //cd or dvd drive { title = itemBDroot.DVDLabel; } } } GUIPropertyManager.SetProperty("#Play.Current.Title", title); } else if (fileName.ToLowerInvariant().Contains(".mpls")) // BD folder title check (playlist) { // Check if index.bdmv is in the VDB int index = fileName.ToLowerInvariant().LastIndexOf(@"\playlist"); string name = fileName.Remove(index); name = name + @"\index.bdmv"; if (VideoDatabase.HasMovieInfo(name)) { VideoDatabase.GetMovieInfo(name, ref movieDetails); movieDetails.SetPlayProperties(); } else { string title = selectBdHandler.GetDiscTitle(fileName); // get the name when play BD directly from Drive letter if (String.IsNullOrEmpty(title)) { List <GUIListItem> rootDrives = VirtualDirectories.Instance.Movies.GetRootExt(); title = Path.GetPathRoot(fileName); title = Util.Utils.RemoveTrailingSlash(title); for (int i = rootDrives.Count - 1; i >= 0; i--) { GUIListItem itemBDroot = (GUIListItem)rootDrives[i]; string itemBD = Path.GetPathRoot(itemBDroot.Path); itemBD = Util.Utils.RemoveTrailingSlash(itemBD); if (itemBD == title && !String.IsNullOrEmpty(itemBDroot.DVDLabel)) //cd or dvd drive { title = itemBDroot.DVDLabel; } } } GUIPropertyManager.SetProperty("#Play.Current.Title", title); } } } } else if (g_Player.IsTV && g_Player.IsTimeShifting) { GUIPropertyManager.SetProperty("#Play.Current.Title", GUIPropertyManager.GetProperty("#TV.View.channel")); GUIPropertyManager.SetProperty("#Play.Current.Genre", GUIPropertyManager.GetProperty("#TV.View.title")); } else { GUIListItem item = new GUIListItem(); item.IsFolder = false; item.Path = fileName; Util.Utils.SetThumbnails(ref item); GUIPropertyManager.SetProperty("#Play.Current.Thumb", item.ThumbnailImage); } _thumbLogo = GUIPropertyManager.GetProperty("#Play.Current.Thumb"); }
/// <summary> /// Play a radio channel /// </summary> /// <param name="channelId">Id of the channel</param> public static void PlayRadioChannel(int channelId) { if (GUIGraphicsContext.form.InvokeRequired) { PlayRadioChannelDelegate d = PlayRadioChannel; GUIGraphicsContext.form.Invoke(d, channelId); return; } WifiRemote.LogMessage("Start radio channel " + channelId, WifiRemote.LogType.Debug); TvDatabase.Channel channel = TvDatabase.Channel.Retrieve(channelId); if (channel != null) { if (GUIWindowManager.ActiveWindow != (int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_RADIO) { WifiRemote.LogMessage("Radio Window not active, activating it", WifiRemote.LogType.Debug); MediaPortal.GUI.Library.GUIWindowManager.ActivateWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_RADIO); } GUIPropertyManager.RemovePlayerProperties(); GUIPropertyManager.SetProperty("#Play.Current.ArtistThumb", channel.DisplayName); GUIPropertyManager.SetProperty("#Play.Current.Album", channel.DisplayName); GUIPropertyManager.SetProperty("#Play.Current.Title", channel.DisplayName); GUIPropertyManager.SetProperty("#Play.Current.Title", channel.DisplayName); string strLogo = Utils.GetCoverArt(Thumbs.Radio, channel.DisplayName); if (string.IsNullOrEmpty(strLogo)) { strLogo = "defaultMyRadioBig.png"; } GUIPropertyManager.SetProperty("#Play.Current.Thumb", strLogo); if (g_Player.Playing && !channel.IsWebstream()) { if (!g_Player.IsTimeShifting || (g_Player.IsTimeShifting && channel.IsWebstream())) { WifiRemote.LogMessage("Stopping current media so we can start playing radio", WifiRemote.LogType.Debug); g_Player.Stop(); } } bool success = false; if (channel.IsWebstream()) { IList <TuningDetail> details = channel.ReferringTuningDetail(); TuningDetail detail = details[0]; WifiRemote.LogMessage("Play webStream:" + detail.Name + ", url:" + detail.Url, WifiRemote.LogType.Debug); success = g_Player.PlayAudioStream(detail.Url); GUIPropertyManager.SetProperty("#Play.Current.Title", channel.DisplayName); } else { // TV card radio channel WifiRemote.LogMessage("Play TV card radio channel", WifiRemote.LogType.Debug); //Check if same channel is alrady playing if (g_Player.IsRadio && g_Player.Playing) { Channel currentlyPlaying = TvPlugin.TVHome.Navigator.Channel; if (currentlyPlaying != null && currentlyPlaying.IdChannel == channel.IdChannel) { WifiRemote.LogMessage("Already playing TV card radio channel with id:" + channel.IdChannel + ", do not tune again", WifiRemote.LogType.Debug); } else { success = TvPlugin.TVHome.ViewChannelAndCheck(channel); } } else { success = TvPlugin.TVHome.ViewChannelAndCheck(channel); } } WifiRemote.LogMessage("Started radio channel " + channelId + " Success: " + success, WifiRemote.LogType.Debug); } else { Log.Warn("Couldn't retrieve radio channel for id: " + channelId); } }