aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Archiving/ZipClient.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-12-03 17:11:04 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-12-03 17:11:04 -0500
commitc4ceeae8893ad12d4043fb40ba234c5b190029fb (patch)
tree9aca532adab026e7ae1391b6a4bf1723e8544b64 /Emby.Server.Implementations/Archiving/ZipClient.cs
parent6320869212269ae34dfb9f1aad31fc0dcdd76790 (diff)
improve xmltv gz support
Diffstat (limited to 'Emby.Server.Implementations/Archiving/ZipClient.cs')
-rw-r--r--Emby.Server.Implementations/Archiving/ZipClient.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Archiving/ZipClient.cs b/Emby.Server.Implementations/Archiving/ZipClient.cs
index d7d37bb61..32938e151 100644
--- a/Emby.Server.Implementations/Archiving/ZipClient.cs
+++ b/Emby.Server.Implementations/Archiving/ZipClient.cs
@@ -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>