improve xmltv gz support

This commit is contained in:
Luke Pulverenti
2017-12-03 17:11:04 -05:00
parent 6320869212
commit c4ceeae889
3 changed files with 72 additions and 17 deletions

View File

@@ -89,6 +89,24 @@ namespace Emby.Server.Implementations.Archiving
}
}
public void ExtractFirstFileFromGz(Stream source, string targetPath, string defaultFileName)
{
using (var reader = GZipReader.Open(source))
{
if (reader.MoveToNextEntry())
{
var entry = reader.Entry;
var filename = entry.Key;
if (string.IsNullOrWhiteSpace(filename))
{
filename = defaultFileName;
}
reader.WriteEntryToFile(Path.Combine(targetPath, filename));
}
}
}
/// <summary>
/// Extracts all from7z.
/// </summary>