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) {}
}