本文整理汇总了C#中MediaPortal.Plugins.MovingPictures.Database.DBMovieInfo类的典型用法代码示例。如果您正苦于以下问题:C# DBMovieInfo类的具体用法?C# DBMovieInfo怎么用?C# DBMovieInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DBMovieInfo类属于MediaPortal.Plugins.MovingPictures.Database命名空间,在下文中一共展示了DBMovieInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RenamableFile
public RenamableFile(DBMovieInfo movie, DBLocalMedia localMedia)
{
_movie = movie;
_localMedia = localMedia;
_originalName = localMedia.FullPath;
_originalFile = localMedia.File;
}
开发者ID:MichelZ,项目名称:moving-pictures-michelz,代码行数:7,代码来源:RenamableFile.cs
示例2: Get
public static DBSourceMovieInfo Get(DBMovieInfo movie, DBSourceInfo source)
{
foreach (DBSourceMovieInfo currInfo in movie.SourceMovieInfo)
if (currInfo.Source == source)
return currInfo;
return null;
}
开发者ID:MichelZ,项目名称:moving-pictures-michelz,代码行数:8,代码来源:DBSourceMovieInfo.cs
示例3: PlayMovie
/// <summary>
/// Play a movie with MovingPictures.
///
/// Taken from Trakt-for-MediaPortal:
/// https://github.com/Technicolour/Trakt-for-Mediaportal/blob/master/TraktPlugin/TraktHandlers/MovingPictures.cs
/// </summary>
/// <param name="movie">Movie to play</param>
/// <param name="resume">Ask to resume movie?</param>
public static void PlayMovie(DBMovieInfo movie, bool resume, int startPosition = 0)
{
if (movie == null) return;
// Play on a new thread
ThreadStart ts = delegate() { DoPlayMovie(movie, resume, startPosition); };
Thread playMovieAsync = new Thread(ts);
playMovieAsync.Start();
}
开发者ID:johanj,项目名称:WifiRemote,代码行数:17,代码来源:MovingPicturesHelper.cs
示例4: AddWatchedHistory
public static void AddWatchedHistory(DBMovieInfo movie, DBUser user)
{
DBWatchedHistory history = new DBWatchedHistory();
history.DateWatched = DateTime.Now;
history.Movie = movie;
history.User = user;
movie.WatchedHistory.Add(history);
history.Commit();
movie.Commit();
}
开发者ID:MichelZ,项目名称:moving-pictures-michelz,代码行数:11,代码来源:DBWatchedHistory.cs
示例5: DetermineGroupName
private static string DetermineGroupName(DBMovieInfo movie)
{
switch (Browser.CurrentSortField) {
case SortingFields.Title:
// Either the first character of the title, or the word "Numeric"
// should we have a category for special characters like numeric has?
string groupName = "";
if (movie.SortBy.Trim().Length > 0)
groupName = movie.SortBy.Trim().Substring(0, 1).ToUpper();
// group all non-word characters together
if (!Regex.Match(groupName, @"\w").Success)
groupName = "#";
// numeric group
int iTemp;
if (int.TryParse(groupName, out iTemp))
groupName = "0-9";
return groupName;
case SortingFields.DateAdded:
return GetDateGroupName(movie.DateAdded.Date);
case SortingFields.ReleaseDate:
return Translation.GetByName("MonthName" + movie.ReleaseDate.Month.ToString()) + ", " + movie.ReleaseDate.Year.ToString();
case SortingFields.Year:
return movie.Year.ToString();
case SortingFields.Certification:
return movie.Certification.Trim().ToUpper();
case SortingFields.Language:
return movie.Language.Trim().ToUpper();
case SortingFields.Score:
return Math.Round(movie.Score).ToString();
case SortingFields.Runtime:
return "";
case SortingFields.FileSize:
string size = movie.LocalMedia[0].FileSize.ToFormattedByteString();
// split the string to get size and unit
string[] splits = size.Split(' ');
// round the size to the nearest unit
int roundedSize = (int)Math.Round(double.Parse(splits[0]), MidpointRounding.ToEven);
// group by rounded size
return roundedSize.ToString() + " " + splits[1];
case SortingFields.FilePath:
if (movie.LocalMedia.Count > 0)
return movie.LocalMedia[0].File.Directory.ToString();
else
return "";
default:
return "";
}
}
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:52,代码来源:GroupHeaders.cs
示例6: GetArtwork
public bool GetArtwork(DBMovieInfo movie)
{
string myVideoCoversFolder = Config.GetFolder(Config.Dir.Thumbs) + "\\Videos\\Title";
Regex cleaner = new Regex("[\\\\/:*?\"<>|]");
string cleanTitle = cleaner.Replace(movie.Title, "_");
string id = movie.GetSourceMovieInfo(SourceInfo).Identifier;
string filename = myVideoCoversFolder + "\\" + cleanTitle + "{" + id + "}L.jpg";
if (System.IO.File.Exists(filename))
return movie.AddCoverFromFile(filename);
return false;
}
开发者ID:MichelZ,项目名称:moving-pictures-michelz,代码行数:14,代码来源:MyVideosProvider.cs
示例7: DetermineGroupName
private static string DetermineGroupName(DBMovieInfo movie)
{
switch (Browser.CurrentSortField) {
case SortingFields.Title:
// Either the first character of the title, or the word "Numeric"
// should we have a category for special characters like numeric has?
string groupName = "";
if (movie.SortBy.Trim().Length > 0)
groupName = movie.SortBy.Trim().Substring(0, 1).ToUpper();
// group all non-word characters together
if (!Regex.Match(groupName, @"\w").Success)
groupName = "#";
// numeric group
int iTemp;
if (int.TryParse(groupName, out iTemp))
groupName = "0-9";
return groupName;
case SortingFields.DateAdded:
return GetDateGroupName(movie.DateAdded.Date);
case SortingFields.Year:
return movie.Year.ToString();
case SortingFields.Certification:
return movie.Certification.Trim().ToUpper();
case SortingFields.Language:
return movie.Language.Trim().ToUpper();
case SortingFields.Score:
return Math.Round(movie.Score).ToString();
case SortingFields.Runtime:
return "";
case SortingFields.FilePath:
if (movie.LocalMedia.Count > 0)
return movie.LocalMedia[0].File.Directory.ToString();
else
return "";
default:
return "";
}
}
开发者ID:MichelZ,项目名称:moving-pictures-michelz,代码行数:42,代码来源:GroupHeaders.cs
示例8: GetRenameActionList
// Returns a list of files and directories ready to be renamed, based on this movie.
// To perform a rename on this list call list.RenameApprovedItems();
public List<Renamable> GetRenameActionList(DBMovieInfo movie)
{
List<Renamable> renamableList = new List<Renamable>();
// if this is a disk or a ripped disk, we dont want to rename any files
if (movie.LocalMedia[0].ImportPath.IsOpticalDrive ||
movie.LocalMedia[0].IsBluray ||
movie.LocalMedia[0].IsDVD ||
movie.LocalMedia[0].IsHDDVD) {
return renamableList;
}
foreach (DBLocalMedia currFile in movie.LocalMedia) {
string primaryExtension = Path.GetExtension(currFile.FullPath);
string path = Path.GetDirectoryName(currFile.FullPath);
string newFileName = GetNewFileName(currFile);
// generate primary renamable file for the current video file
if (MovingPicturesCore.Settings.RenameFiles) {
RenamableFile primaryRenamable = new RenamableFile(movie, currFile);
primaryRenamable.NewName = path + @"\" + newFileName + primaryExtension;
renamableList.Add(primaryRenamable);
}
// generate secondary renamable files for subtitles, etc
if (MovingPicturesCore.Settings.RenameSecondaryFiles) {
renamableList.AddRange(GetSecondaryFiles(currFile));
}
}
// generate a renamable object for the directory as needed
if (MovingPicturesCore.Settings.RenameFolders) {
RenamableDirectory renamableDir = GetDirectoryRenamable(movie);
if (renamableDir != null) renamableList.Add(renamableDir);
}
renamableList.UpdateFinalFilenames();
return renamableList;
}
开发者ID:MichelZ,项目名称:moving-pictures-michelz,代码行数:42,代码来源:MovieRenamer.cs
示例9: FromUrl
public static Backdrop FromUrl(DBMovieInfo movie, string url, bool ignoreRestrictions, out ImageLoadResults status)
{
ImageSize minSize = null;
ImageSize maxSize = new ImageSize();
if (!ignoreRestrictions) {
minSize = new ImageSize();
minSize.Width = MovingPicturesCore.Settings.MinimumBackdropWidth;
minSize.Height = MovingPicturesCore.Settings.MinimumBackdropHeight;
}
maxSize.Width = MovingPicturesCore.Settings.MaximumBackdropWidth;
maxSize.Height = MovingPicturesCore.Settings.MaximumBackdropHeight;
bool redownload = MovingPicturesCore.Settings.RedownloadBackdrops;
Backdrop newBackdrop = new Backdrop();
newBackdrop.Filename = GenerateFilename(movie, url);
status = newBackdrop.FromUrl(url, ignoreRestrictions, minSize, maxSize, redownload);
switch (status) {
case ImageLoadResults.SUCCESS:
logger.Info("Added backdrop for \"{0}\" from: {1}", movie.Title, url);
break;
case ImageLoadResults.SUCCESS_REDUCED_SIZE:
logger.Info("Added resized backdrop for \"{0}\" from: {1}", movie.Title, url);
break;
case ImageLoadResults.FAILED_ALREADY_LOADED:
logger.Debug("Backdrop for \"{0}\" from the following URL is already loaded: {1}", movie.Title, url);
return null;
case ImageLoadResults.FAILED_TOO_SMALL:
logger.Debug("Downloaded backdrop for \"{0}\" failed minimum resolution requirements: {1}", movie.Title, url);
return null;
case ImageLoadResults.FAILED:
logger.Error("Failed downloading backdrop for \"{0}\": {1}", movie.Title, url);
return null;
}
return newBackdrop;
}
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:40,代码来源:Backdrop.cs
示例10: onMovieEnded
private void onMovieEnded(DBMovieInfo movie)
{
// update watched counter
updateMovieWatchedCounter(movie);
// clear resume state
clearMovieResumeState(movie);
// reset player
resetPlayer();
if (MovingPicturesCore.Settings.FollwitEnabled)
MovingPicturesCore.Follwit.CurrentlyWatching(movie, false);
// invoke event
if (MovieEnded != null)
MovieEnded(movie);
}
开发者ID:MichelZ,项目名称:moving-pictures-michelz,代码行数:18,代码来源:MoviePlayer.cs
示例11: onMovieStopped
private void onMovieStopped(DBMovieInfo movie)
{
// reset player
resetPlayer();
if (MovingPicturesCore.Settings.FollwitEnabled)
MovingPicturesCore.Follwit.CurrentlyWatching(movie, false);
// invoke event
if (MovieStopped != null)
MovieStopped(movie);
}
开发者ID:MichelZ,项目名称:moving-pictures-michelz,代码行数:12,代码来源:MoviePlayer.cs
示例12: getTmdbId
/// <summary>
/// returns the tmdb id for a movie if its exists
/// </summary>
private string getTmdbId(DBMovieInfo movie)
{
// get source info, maybe already have it from poster or movieinfo
var tmdbSource = DBSourceInfo.GetAll().Find(s => s.ToString() == "themoviedb.org");
if (tmdbSource == null)
return null;
string id = movie.GetSourceMovieInfo(tmdbSource).Identifier;
if (id == null || id.Trim() == string.Empty)
return null;
return id;
}
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:16,代码来源:FanartTVProvider.cs
示例13: GetArtwork
public bool GetArtwork(DBMovieInfo movie)
{
if (movie == null)
return false;
// do we have an id?
string movieId = getMovieId(movie);
if (string.IsNullOrEmpty(movieId))
return false;
string url = apiMovieArtwork;
if (!string.IsNullOrEmpty(MovingPicturesCore.Settings.FanartTVClientKey))
url = url + "&client_key=" + MovingPicturesCore.Settings.FanartTVClientKey;
// try to get movie artwork
string response = getJson(string.Format(apiMovieArtwork, movieId));
if (response == null)
return false;
// de-serialize json response
var movieImages = response.FromJson<Artwork>();
if (movieImages == null)
return false;
// check if we have any posters
if (movieImages.movieposter == null || movieImages.movieposter.Count == 0)
return false;
// filter posters by language
var langPosters = movieImages.movieposter.Where(p => p.lang == MovingPicturesCore.Settings.DataProviderLanguageCode);
// if no localised posters available use all posters
if (langPosters.Count() == 0) {
langPosters = movieImages.movieposter;
}
// sort by highest rated / most popular
langPosters = langPosters.OrderByDescending(p => p.likes);
// grab coverart loading settings
int maxCovers = MovingPicturesCore.Settings.MaxCoversPerMovie;
int maxCoversInSession = MovingPicturesCore.Settings.MaxCoversPerSession;
int coversAdded = 0;
// download posters
foreach (var poster in langPosters) {
// if we have hit our limit quit
if (movie.AlternateCovers.Count >= maxCovers || coversAdded >= maxCoversInSession)
return true;
// get url for cover and load it via the movie object
string coverPath = poster.url;
if (coverPath.Trim() != string.Empty) {
if (movie.AddCoverFromURL(coverPath) == ImageLoadResults.SUCCESS)
coversAdded++;
}
}
if (coversAdded > 0) {
// Update source info
movie.GetSourceMovieInfo(SourceInfo).Identifier = movieId;
return true;
}
return false;
}
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:66,代码来源:FanartTVProvider.cs
示例14: PromptUserToResume
private bool PromptUserToResume(DBMovieInfo movie)
{
if (movie.UserSettings == null || movie.UserSettings.Count == 0 || (movie.ActiveUserSettings.ResumePart < 2 && movie.ActiveUserSettings.ResumeTime <= 30))
return false;
logger.Debug("Resume Prompt: Movie='{0}', ResumePart={1}, ResumeTime={2}", movie.Title, movie.ActiveUserSettings.ResumePart, movie.ActiveUserSettings.ResumeTime);
// figure out the resume time to display to the user
int displayTime = movie.ActiveUserSettings.ResumeTime;
if (movie.LocalMedia.Count > 1) {
for (int i = 0; i < movie.ActiveUserSettings.ResumePart - 1; i++) {
if (movie.LocalMedia[i].Duration > 0)
displayTime += (movie.LocalMedia[i].Duration / 1000); // convert milliseconds to seconds
}
}
string sbody = movie.Title + "\n" + Translation.ResumeFrom + " " + Util.Utils.SecondsToHMSString(displayTime);
bool bResume = _gui.ShowCustomYesNo(Translation.ResumeFromLast, sbody, null, null, true);
if (bResume)
return true;
return false;
}
开发者ID:MichelZ,项目名称:moving-pictures-michelz,代码行数:24,代码来源:MoviePlayer.cs
示例15: updateMovieResumeState
private void updateMovieResumeState(DBMovieInfo movie, int part, int timePlayed, byte[] resumeData, int titleBD)
{
if (movie.UserSettings.Count == 0)
return;
// get the user settings for the default profile (for now)
DBUserMovieSettings userSetting = movie.ActiveUserSettings;
if (timePlayed > 0 && g_Player.SetResumeBDTitleState >= 0) {
// set part and time data
userSetting.ResumePart = part;
userSetting.ResumeTime = timePlayed;
userSetting.ResumeData = new ByteArray(resumeData);
userSetting.ResumeTitleBD = titleBD;
logger.Debug("Updating movie resume state.");
}
else {
// clear the resume settings
userSetting.ResumePart = 0;
userSetting.ResumeTime = 0;
userSetting.ResumeData = null;
userSetting.ResumeTitleBD = 1000;
g_Player.SetResumeBDTitleState = userSetting.ResumeTitleBD;
logger.Debug("Clearing movie resume state.");
}
// save the changes to the user setting for this movie
userSetting.Commit();
}
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:28,代码来源:MoviePlayer.cs
示例16: playMovie
private void playMovie(DBMovieInfo movie, int requestedPart)
{
logger.Debug("playMovie()");
_playerState = MoviePlayerState.Processing;
if (movie == null || requestedPart > movie.LocalMedia.Count || requestedPart < 1) {
resetPlayer();
return;
}
logger.Debug("Request: Movie='{0}', Part={1}", movie.Title, requestedPart);
for (int i = 0; i < movie.LocalMedia.Count; i++) {
logger.Debug("LocalMedia[{0}] = {1}, Duration = {2}", i, movie.LocalMedia[i].FullPath, movie.LocalMedia[i].Duration);
}
int part = requestedPart;
// if this is a request to start the movie from the beginning, check if we should resume
// or prompt the user for disk selection
if (requestedPart == 1) {
// check if we should be resuming, and if not, clear resume data
switch (PromptUserToResume(movie))
{
case ResumeDialogResult.Resume: _resumeActive = true; part = movie.ActiveUserSettings.ResumePart; break;
case ResumeDialogResult.FromBeginning: _resumeActive = false; clearMovieResumeState(movie); break;
case ResumeDialogResult.Cancel:return;
}
// if we have a multi-part movie composed of disk images and we are not resuming
// ask which part the user wants to play
if (!_resumeActive && movie.LocalMedia.Count > 1 && (movie.LocalMedia[0].IsImageFile || movie.LocalMedia[0].IsVideoDisc)) {
GUIDialogFileStacking dlg = (GUIDialogFileStacking)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_FILESTACKING);
if (null != dlg) {
dlg.SetNumberOfFiles(movie.LocalMedia.Count);
dlg.DoModal(GUIWindowManager.ActiveWindow);
part = dlg.SelectedFile;
if (part < 1) {
resetPlayer();
return;
}
}
}
}
DBLocalMedia mediaToPlay = movie.LocalMedia[part - 1];
MediaState mediaState = mediaToPlay.State;
while (mediaState != MediaState.Online) {
switch (mediaState) {
case MediaState.Removed:
_gui.ShowMessage("Error", Translation.MediaIsMissing);
resetPlayer();
return;
case MediaState.Offline:
string bodyString = String.Format(Translation.MediaNotAvailableBody, mediaToPlay.MediaLabel);
// Special debug line to troubleshoot availability issues
logger.Debug("Media not available: Path={0}, DriveType={1}, Serial={2}, ExpectedSerial={3}",
mediaToPlay.FullPath, mediaToPlay.ImportPath.GetDriveType().ToString(),
mediaToPlay.ImportPath.GetVolumeSerial(), mediaToPlay.VolumeSerial);
// Prompt user to enter media
if (!_gui.ShowCustomYesNo(Translation.MediaNotAvailableHeader, bodyString, Translation.Retry, Translation.Cancel, true)) {
// user cancelled so exit
resetPlayer();
return;
}
break;
case MediaState.NotMounted:
// Mount this media
MountResult result = mediaToPlay.Mount();
while (result == MountResult.Pending) {
if (_gui.ShowCustomYesNo(Translation.VirtualDriveHeader, Translation.VirtualDriveMessage, Translation.Retry, Translation.Cancel, true)) {
// User has chosen to retry
// We stay in the mount loop
result = mediaToPlay.Mount();
}
else {
// Exit the player
resetPlayer();
return;
}
}
// If the mounting failed (can not be solved within the loop) show error and return
if (result == MountResult.Failed) {
_gui.ShowMessage(Translation.Error, Translation.FailedMountingImage);
// Exit the player
resetPlayer();
return;
}
// Mounting was succesfull, break the mount loop
break;
}
// Check mediaState again
mediaState = mediaToPlay.State;
}
// Get the path to the playable video.
string videoPath = mediaToPlay.GetVideoPath();
//.........这里部分代码省略.........
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:101,代码来源:MoviePlayer.cs
示例17: onMovieEnded
private void onMovieEnded(DBMovieInfo movie)
{
// update watched counter
updateMovieWatchedCounter(movie);
// clear resume state
clearMovieResumeState(movie);
// reset player
resetPlayer();
// invoke event
if (MovieEnded != null)
MovieEnded(movie);
}
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:15,代码来源:MoviePlayer.cs
示例18: Play
public void Play(DBMovieInfo movie, int part)
{
// stop the mediainfo background process if it is running
MovingPicturesCore.ProcessManager.CancelProcess(typeof(MediaInfoUpdateProcess));
// stop the internal player if it's running
if (g_Player.Playing)
g_Player.Stop();
// set player state working
_playerState = MoviePlayerState.Processing;
// queue the local media object in case we first need to play the custom intro
// we can get back to it later.
queuedMedia = movie.LocalMedia[part-1];
// try playing our custom intro (if present). If successful quit, as we need to
// wait for the intro to finish.
bool success = playCustomIntro();
if (success) return;
// Start movie
playMovie(movie, part);
}
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:24,代码来源:MoviePlayer.cs
示例19: CurrentlyWatching
public bool CurrentlyWatching(DBMovieInfo movie, bool isWatching)
{
if (!MovingPicturesCore.Settings.FollwitEnabled) {
logger.Warn("Attempt to call follw.it made when service is disabled.");
return false;
}
if (!IsOnline) {
logger.Warn("Can not send movie watched count to follw.it because service is offline");
return false;
}
try {
if (MovingPicturesCore.Settings.RestrictSynchronizedMovies) {
var filtered = MovingPicturesCore.Settings.FollwitSyncFilter.Filter(new List<DBMovieInfo>() {movie});
if (filtered.Count == 0)
return false;
}
FollwitBackgroundProcess bgProc = new FollwitBackgroundProcess();
bgProc.Action = isWatching ? FitActions.BeginWatching : FitActions.EndWatching;
bgProc.Movies.Add(movie);
MovingPicturesCore.ProcessManager.StartProcess(bgProc);
}
catch (Exception ex) {
logger.ErrorException("Unexpected error sending 'now watching' information to follw.it!", ex);
_follwitAPI = null;
MovingPicturesCore.Follwit.Status = FollwitConnector.StatusEnum.INTERNAL_ERROR;
return false;
}
return true;
}
开发者ID:MichelZ,项目名称:moving-pictures-michelz,代码行数:33,代码来源:FollwitConnector.cs
示例20: clearMovieResumeState
private void clearMovieResumeState(DBMovieInfo movie)
{
updateMovieResumeState(movie, 0, 0, null, 0);
}
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:4,代码来源:MoviePlayer.cs
注:本文中的MediaPortal.Plugins.MovingPictures.Database.DBMovieInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论