diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-09-25 01:07:08 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-25 01:07:08 -0400 |
| commit | 88d62050a6a16ce5b9c093501d9a4dc4ce4f62c9 (patch) | |
| tree | a7ea536feec327f28c8106caa0ecf9446a5bf0f4 /Emby.Server.Implementations/LiveTv | |
| parent | 1443dd1aeeba7f4477263f0eb5bd805491df856f (diff) | |
| parent | 076d4ca5b47fe2a500c0ed5e4625601dba3762d4 (diff) | |
Merge pull request #2914 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/LiveTv')
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs index fb8308cda5..55500df6e5 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs @@ -65,14 +65,15 @@ namespace Emby.Server.Implementations.LiveTv.Listings if (!path.StartsWith("http", StringComparison.OrdinalIgnoreCase)) { - return path; + return UnzipIfNeeded(path, path); } var cacheFilename = DateTime.UtcNow.DayOfYear.ToString(CultureInfo.InvariantCulture) + "-" + DateTime.UtcNow.Hour.ToString(CultureInfo.InvariantCulture) + ".xml"; var cacheFile = Path.Combine(_config.ApplicationPaths.CachePath, "xmltv", cacheFilename); if (_fileSystem.FileExists(cacheFile)) { - return UnzipIfNeeded(path, cacheFile); + //return UnzipIfNeeded(path, cacheFile); + return cacheFile; } _logger.Info("Downloading xmltv listings from {0}", path); @@ -112,28 +113,29 @@ namespace Emby.Server.Implementations.LiveTv.Listings } _logger.Debug("Returning xmltv path {0}", cacheFile); - return UnzipIfNeeded(path, cacheFile); + return cacheFile; + //return UnzipIfNeeded(path, cacheFile); } private string UnzipIfNeeded(string originalUrl, string file) { - //var ext = Path.GetExtension(originalUrl); - - //if (string.Equals(ext, ".gz", StringComparison.OrdinalIgnoreCase)) - //{ - // using (var stream = _fileSystem.OpenRead(file)) - // { - // var tempFolder = Path.Combine(_config.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString()); - // _fileSystem.CreateDirectory(tempFolder); - - // _zipClient.ExtractAllFromZip(stream, tempFolder, true); - - // return _fileSystem.GetFiles(tempFolder, true) - // .Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase)) - // .Select(i => i.FullName) - // .FirstOrDefault(); - // } - //} + var ext = Path.GetExtension(originalUrl.Split('?')[0]); + + if (string.Equals(ext, ".gz", StringComparison.OrdinalIgnoreCase)) + { + using (var stream = _fileSystem.OpenRead(file)) + { + var tempFolder = Path.Combine(_config.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString()); + _fileSystem.CreateDirectory(tempFolder); + + _zipClient.ExtractAllFromGz(stream, tempFolder, true); + + return _fileSystem.GetFiles(tempFolder, true) + .Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase)) + .Select(i => i.FullName) + .FirstOrDefault(); + } + } return file; } |
