本文整理汇总了C#中TvDatabase.TvBusinessLayer.GetRecordingByFileName方法的典型用法代码示例。如果您正苦于以下问题:C# TvBusinessLayer.GetRecordingByFileName方法的具体用法?C# TvBusinessLayer.GetRecordingByFileName怎么用?C# TvBusinessLayer.GetRecordingByFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TvDatabase.TvBusinessLayer
的用法示例。
在下文中一共展示了TvBusinessLayer.GetRecordingByFileName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Scrobble
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;
}
示例2: Scrobble
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.Info("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;
GetTitleAndYear(recording, 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
};
if (CurrentRecording.Type == VideoType.Series)
TraktLogger.Info("Detected tv-series '{0}' playing in TV Recordings", CurrentRecording.ToString());
else
TraktLogger.Info("Detected movie '{0}' playing in TV Recordings", CurrentRecording.ToString());
#region scrobble timer
TraktTimer = new Timer(new TimerCallback((stateInfo) =>
{
Thread.CurrentThread.Name = "Scrobble";
VideoInfo videoInfo = stateInfo as VideoInfo;
// maybe the program does not exist on trakt
// ignore in future if it failed previously
if (videoInfo.IsScrobbling)
{
if (videoInfo.Type == VideoType.Series)
{
videoInfo.IsScrobbling = BasicHandler.ScrobbleEpisode(videoInfo, TraktScrobbleStates.watching);
}
else
{
videoInfo.IsScrobbling = BasicHandler.ScrobbleMovie(videoInfo, TraktScrobbleStates.watching);
}
if (videoInfo.Equals(CurrentRecording))
CurrentRecording.IsScrobbling = videoInfo.IsScrobbling;
}
}), CurrentRecording, 3000, 900000);
#endregion
return true;
}