improve support for compressed xmltv

This commit is contained in:
Luke Pulverenti 2017-09-25 15:13:54 -04:00
parent 64d85e4c33
commit ab8c0bf1e6

View File

@ -72,8 +72,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
var cacheFile = Path.Combine(_config.ApplicationPaths.CachePath, "xmltv", cacheFilename); var cacheFile = Path.Combine(_config.ApplicationPaths.CachePath, "xmltv", cacheFilename);
if (_fileSystem.FileExists(cacheFile)) if (_fileSystem.FileExists(cacheFile))
{ {
//return UnzipIfNeeded(path, cacheFile); return UnzipIfNeeded(path, cacheFile);
return cacheFile;
} }
_logger.Info("Downloading xmltv listings from {0}", path); _logger.Info("Downloading xmltv listings from {0}", path);
@ -95,26 +94,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(cacheFile)); _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(cacheFile));
using (var stream = _fileSystem.OpenRead(tempFile)) _fileSystem.CopyFile(tempFile, cacheFile, true);
{
using (var reader = new StreamReader(stream, Encoding.UTF8))
{
using (var fileStream = _fileSystem.GetFileStream(cacheFile, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
{
using (var writer = new StreamWriter(fileStream))
{
while (!reader.EndOfStream)
{
writer.WriteLine(reader.ReadLine());
}
}
}
}
}
_logger.Debug("Returning xmltv path {0}", cacheFile); return UnzipIfNeeded(path, cacheFile);
return cacheFile;
//return UnzipIfNeeded(path, cacheFile);
} }
private string UnzipIfNeeded(string originalUrl, string file) private string UnzipIfNeeded(string originalUrl, string file)