fail nicer when MediaInfo lib is not available.

This commit is contained in:
Keivan Beigi 2013-09-06 11:56:48 -07:00
parent 3ef5baf0a0
commit 739188a577
1 changed files with 9 additions and 3 deletions

View File

@ -112,10 +112,10 @@ namespace NzbDrone.Core.Providers
public TimeSpan GetRunTime(string filename)
{
var mediaInfo = new MediaInfo();
MediaInfo mediaInfo = null;
try
{
mediaInfo = new MediaInfo();
_logger.Trace("Getting media info from {0}", filename);
mediaInfo.Option("ParseSpeed", "0.2");
@ -133,8 +133,14 @@ namespace NzbDrone.Core.Providers
catch (Exception ex)
{
_logger.ErrorException("Unable to parse media info from file: " + filename, ex);
}
finally
{
if (mediaInfo != null)
{
mediaInfo.Close();
}
}
return new TimeSpan();
}