private void SetMovieProperties(string path) { bool isFile = false; if (Util.Utils.IsVideo(path)) isFile = true; IMDBMovie info = new IMDBMovie(); if (path == "..") { info.Reset(); info.SetProperties(true); return; } bool isDirectory = false; bool isMultiMovieFolder = false; bool isFound = false; try { if (Directory.Exists(path)) { isDirectory = true; string[] files = Directory.GetFiles(path); foreach (string file in files) { IMDBMovie movie = new IMDBMovie(); VideoDatabase.GetMovieInfo(file, ref movie); if (!movie.IsEmpty) { if (!isFound) { info = movie; isFound = true; } else { isMultiMovieFolder = true; break; } } } } else { VideoDatabase.GetMovieInfo(path, ref info); } if (info.IsEmpty) { FetchMatroskaInfo(path, isDirectory, ref info); } if (info.IsEmpty && File.Exists(path + @"\VIDEO_TS\VIDEO_TS.IFO")) //still empty and is ripped DVD { VideoDatabase.GetMovieInfo(path + @"\VIDEO_TS\VIDEO_TS.IFO", ref info); isFile = true; } if (info.IsEmpty) { if (_markWatchedFiles) { int fID = VideoDatabase.GetFileId(path); byte[] resumeData = null; int timeStopped = VideoDatabase.GetMovieStopTimeAndResumeData(fID, out resumeData); if (timeStopped > 0 || resumeData != null) info.Watched = 1; } } if (isMultiMovieFolder || !isFile) { info.Reset(); info.SetProperties(true); return; } info.SetProperties(false); } catch (Exception) {} }
private void SetMovieProperties(string path, string filename) { IMDBMovie info = new IMDBMovie(); if (path == ".." || string.IsNullOrEmpty(path) || (!Directory.Exists(path) && !Util.Utils.IsVideo(filename))) { info.Reset(true); info.SetProperties(true, string.Empty); return; } if (Directory.Exists(path) && !Util.Utils.IsVideo(filename)) { info.SetProperties(true, path); return; } try { VideoDatabase.GetMovieInfo(filename, ref info); // Get recording/nfo xml if (info.IsEmpty) { FetchMatroskaInfo(filename, false, ref info); if (info.IsEmpty) { FetchMovieNfo(path, filename, ref info); } } info.SetProperties(false, filename); } catch (Exception) { } }