mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-17 15:02:34 +02:00
Properly dispose filestream after getting mediainfo.
This commit is contained in:
parent
fe5cb9503c
commit
f1a5261e0a
@ -88,5 +88,17 @@ public void get_info_unicode()
|
||||
info.Width.Should().Be(480);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_dispose_file_after_scanning_mediainfo()
|
||||
{
|
||||
var path = Path.Combine(Directory.GetCurrentDirectory(), "Files", "Media", "H264_sample.mp4");
|
||||
|
||||
var info = Subject.GetMediaInfo(path);
|
||||
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Write);
|
||||
|
||||
stream.Close();
|
||||
}
|
||||
}
|
||||
}
|
@ -41,7 +41,12 @@ public MediaInfoModel GetMediaInfo(string filename)
|
||||
|
||||
mediaInfo.Option("ParseSpeed", "0.2");
|
||||
|
||||
int open = mediaInfo.Open(_diskProvider.OpenReadStream(filename));
|
||||
int open;
|
||||
|
||||
using (var stream = _diskProvider.OpenReadStream(filename))
|
||||
{
|
||||
open = mediaInfo.Open(stream);
|
||||
}
|
||||
|
||||
if (open != 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user