1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-20 21:55:03 -04:00

Fixed: A bug caused way too much data being read during MediaInfo discovery (often the entire file).

Fixed: Further optimized the MediaInfo discovery to reduce the read data to a couple of dozen kbytes, but less detailed.
This commit is contained in:
Taloth Saldono
2015-06-02 21:57:47 +02:00
parent 724981db57
commit 1fbbfb3317
2 changed files with 48 additions and 6 deletions
@@ -39,7 +39,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
mediaInfo = new MediaInfo();
_logger.Debug("Getting media info from {0}", filename);
mediaInfo.Option("ParseSpeed", "0.2");
mediaInfo.Option("ParseSpeed", "0.0");
int open;
@@ -48,6 +48,28 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
open = mediaInfo.Open(stream);
}
if (open != 0)
{
int audioRuntime;
int videoRuntime;
int generalRuntime;
//Runtime
Int32.TryParse(mediaInfo.Get(StreamKind.Video, 0, "PlayTime"), out videoRuntime);
Int32.TryParse(mediaInfo.Get(StreamKind.Audio, 0, "PlayTime"), out audioRuntime);
Int32.TryParse(mediaInfo.Get(StreamKind.General, 0, "PlayTime"), out generalRuntime);
if (audioRuntime == 0 && videoRuntime == 0 && generalRuntime == 0)
{
mediaInfo.Option("ParseSpeed", "1.0");
using (var stream = _diskProvider.OpenReadStream(filename))
{
open = mediaInfo.Open(stream);
}
}
}
if (open != 0)
{
int width;