commit
ae7889b467
|
@ -309,8 +309,8 @@
|
||||||
<Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project>
|
<Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project>
|
||||||
<Name>SocketHttpListener.Portable</Name>
|
<Name>SocketHttpListener.Portable</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<Reference Include="Emby.XmlTv, Version=1.0.6249.32870, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Emby.XmlTv, Version=1.0.6251.29080, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Emby.XmlTv.1.0.6\lib\portable-net45+win8\Emby.XmlTv.dll</HintPath>
|
<HintPath>..\packages\Emby.XmlTv.1.0.7\lib\portable-net45+win8\Emby.XmlTv.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MediaBrowser.Naming, Version=1.0.6201.24431, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="MediaBrowser.Naming, Version=1.0.6201.24431, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -26,13 +27,15 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
|
private readonly IZipClient _zipClient;
|
||||||
|
|
||||||
public XmlTvListingsProvider(IServerConfigurationManager config, IHttpClient httpClient, ILogger logger, IFileSystem fileSystem)
|
public XmlTvListingsProvider(IServerConfigurationManager config, IHttpClient httpClient, ILogger logger, IFileSystem fileSystem, IZipClient zipClient)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
|
_zipClient = zipClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
@ -63,7 +66,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 cacheFile;
|
return UnzipIfNeeded(path, cacheFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.Info("Downloading xmltv listings from {0}", path);
|
_logger.Info("Downloading xmltv listings from {0}", path);
|
||||||
|
@ -103,7 +106,30 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.Debug("Returning xmltv path {0}", cacheFile);
|
_logger.Debug("Returning xmltv path {0}", 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();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
|
public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
|
||||||
|
@ -122,6 +148,8 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_logger.Debug("Getting xmltv programs for channel {0}", channelId);
|
||||||
|
|
||||||
var path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
|
var path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
|
||||||
var reader = new XmlTvReader(path, GetLanguage());
|
var reader = new XmlTvReader(path, GetLanguage());
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Emby.XmlTv" version="1.0.6" targetFramework="portable45-net45+win8" />
|
<package id="Emby.XmlTv" version="1.0.7" targetFramework="portable45-net45+win8" />
|
||||||
<package id="MediaBrowser.Naming" version="1.0.4" targetFramework="portable45-net45+win8" />
|
<package id="MediaBrowser.Naming" version="1.0.4" targetFramework="portable45-net45+win8" />
|
||||||
<package id="SQLitePCL.pretty" version="1.1.0" targetFramework="portable45-net45+win8" />
|
<package id="SQLitePCL.pretty" version="1.1.0" targetFramework="portable45-net45+win8" />
|
||||||
<package id="SQLitePCLRaw.core" version="1.1.1" targetFramework="portable45-net45+win8" />
|
<package id="SQLitePCLRaw.core" version="1.1.1" targetFramework="portable45-net45+win8" />
|
||||||
|
|
|
@ -48,6 +48,19 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override double? GetDefaultPrimaryImageAspectRatio()
|
||||||
|
{
|
||||||
|
if (IsMovie)
|
||||||
|
{
|
||||||
|
double value = 2;
|
||||||
|
value /= 3;
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public override SourceType SourceType
|
public override SourceType SourceType
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user