static private GetTitleAndYear ( string inputTitle, string &title, string &year ) : void | ||
inputTitle | string | |
title | string | |
year | string | |
return | void |
/// <summary> /// Gets the current program /// </summary> /// <returns></returns> private VideoInfo GetCurrentProgram() { VideoInfo videoInfo = new VideoInfo(); // get current program details Program program = TVHome.Navigator.Channel.CurrentProgram; if (program == null || string.IsNullOrEmpty(program.Title)) { TraktLogger.Info("Unable to get current program from database"); return(null); } else { string title = null; string year = null; BasicHandler.GetTitleAndYear(program.Title, out title, out year); videoInfo = new VideoInfo { Type = !string.IsNullOrEmpty(program.EpisodeNum) || !string.IsNullOrEmpty(program.SeriesNum) ? VideoType.Series : VideoType.Movie, Title = title, Year = year, SeasonIdx = program.SeriesNum, EpisodeIdx = program.EpisodeNum, StartTime = program.StartTime, Runtime = GetRuntime(program) }; TraktLogger.Info("Current program details. Title='{0}', Year='{1}', Season='{2}', Episode='{3}', StartTime='{4}', Runtime='{5}'", videoInfo.Title, videoInfo.Year.ToLogString(), videoInfo.SeasonIdx.ToLogString(), videoInfo.EpisodeIdx.ToLogString(), videoInfo.StartTime == null ? "<empty>" : videoInfo.StartTime.ToString(), videoInfo.Runtime); } return(videoInfo); }
public bool Scrobble(string filename) { StopScrobble(); if (!g_Player.IsTVRecording) { return(false); } // get recording details from tv database TvBusinessLayer layer = new TvBusinessLayer(); Recording recording = layer.GetRecordingByFileName(filename); if (recording == null || string.IsNullOrEmpty(recording.Title)) { TraktLogger.Warning("Unable to get recording details from database"); return(false); } // get year from title if available, some EPG entries contain this string title = null; string year = null; BasicHandler.GetTitleAndYear(recording.Title, out title, out year); CurrentRecording = new VideoInfo { Type = !string.IsNullOrEmpty(recording.EpisodeNum) || !string.IsNullOrEmpty(recording.SeriesNum) ? VideoType.Series : VideoType.Movie, Title = title, Year = year, SeasonIdx = recording.SeriesNum, EpisodeIdx = recording.EpisodeNum, IsScrobbling = true }; TraktLogger.Info("Current program details. Title='{0}', Year='{1}', Season='{2}', Episode='{3}', StartTime='{4}', Runtime='{5}'", CurrentRecording.Title, CurrentRecording.Year.ToLogString(), CurrentRecording.SeasonIdx.ToLogString(), CurrentRecording.EpisodeIdx.ToLogString(), CurrentRecording.StartTime == null ? "<empty>" : CurrentRecording.StartTime.ToString(), CurrentRecording.Runtime); if (CurrentRecording.Type == VideoType.Series) { TraktLogger.Info("Detected tv show playing in TV Recordings. Title = '{0}'", CurrentRecording.ToString()); } else { TraktLogger.Info("Detected movie playing in TV Recordings. Title = '{0}'", CurrentRecording.ToString()); } BasicHandler.StartScrobble(CurrentRecording); return(true); }