update channel mapping

This commit is contained in:
Luke Pulverenti 2016-06-10 12:45:04 -04:00
parent b0c1ba1e19
commit 3ba9d3c12f
9 changed files with 30 additions and 14 deletions

View File

@ -578,7 +578,9 @@ namespace MediaBrowser.Api.LiveTv
{ {
var config = GetConfiguration(); var config = GetConfiguration();
var listingProvider = config.ListingProviders.First(i => string.Equals(request.ProviderId, i.Id, StringComparison.OrdinalIgnoreCase)); var listingsProviderInfo = config.ListingProviders.First(i => string.Equals(request.ProviderId, i.Id, StringComparison.OrdinalIgnoreCase));
var listingsProviderName = _liveTvManager.ListingProviders.First(i => string.Equals(i.Type, listingsProviderInfo.Type, StringComparison.OrdinalIgnoreCase)).Name;
var tunerChannels = await _liveTvManager.GetChannelsForListingsProvider(request.ProviderId, CancellationToken.None) var tunerChannels = await _liveTvManager.GetChannelsForListingsProvider(request.ProviderId, CancellationToken.None)
.ConfigureAwait(false); .ConfigureAwait(false);
@ -586,7 +588,7 @@ namespace MediaBrowser.Api.LiveTv
var providerChannels = await _liveTvManager.GetChannelsFromListingsProviderData(request.ProviderId, CancellationToken.None) var providerChannels = await _liveTvManager.GetChannelsFromListingsProviderData(request.ProviderId, CancellationToken.None)
.ConfigureAwait(false); .ConfigureAwait(false);
var mappings = listingProvider.ChannelMappings.ToList(); var mappings = listingsProviderInfo.ChannelMappings.ToList();
var result = new ChannelMappingOptions var result = new ChannelMappingOptions
{ {
@ -601,7 +603,7 @@ namespace MediaBrowser.Api.LiveTv
Mappings = mappings, Mappings = mappings,
ProviderName = "Schedules Direct" ProviderName = listingsProviderName
}; };
return ToOptimizedResult(result); return ToOptimizedResult(result);

View File

@ -390,6 +390,8 @@ namespace MediaBrowser.Controller.LiveTv
Task<List<ChannelInfo>> GetChannelsForListingsProvider(string id, CancellationToken cancellationToken); Task<List<ChannelInfo>> GetChannelsForListingsProvider(string id, CancellationToken cancellationToken);
Task<List<ChannelInfo>> GetChannelsFromListingsProviderData(string id, CancellationToken cancellationToken); Task<List<ChannelInfo>> GetChannelsFromListingsProviderData(string id, CancellationToken cancellationToken);
List<IListingsProvider> ListingProviders { get;}
event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCancelled; event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCancelled;
event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCancelled; event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCancelled;
event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCreated; event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCreated;

View File

@ -73,6 +73,10 @@ namespace MediaBrowser.Server.Implementations.Library
{ {
return false; return false;
} }
if (string.Equals(stream.Codec, "ssa", StringComparison.OrdinalIgnoreCase))
{
return false;
}
return true; return true;
} }

View File

@ -879,6 +879,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
throw new Exception("ListingsId required"); throw new Exception("ListingsId required");
} }
await AddMetadata(info, new List<ChannelInfo>(), cancellationToken).ConfigureAwait(false);
var token = await GetToken(info, cancellationToken); var token = await GetToken(info, cancellationToken);
if (string.IsNullOrWhiteSpace(token)) if (string.IsNullOrWhiteSpace(token))
@ -886,8 +888,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
throw new Exception("token required"); throw new Exception("token required");
} }
ClearPairCache(listingsId);
var httpOptions = new HttpRequestOptions() var httpOptions = new HttpRequestOptions()
{ {
Url = ApiUrl + "/lineups/" + listingsId, Url = ApiUrl + "/lineups/" + listingsId,
@ -921,10 +921,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
} }
channelNumber = channelNumber.TrimStart('0'); channelNumber = channelNumber.TrimStart('0');
var name = channelNumber;
var station = GetStation(listingsId, channelNumber, null);
if (station != null)
{
name = station.name;
}
list.Add(new ChannelInfo list.Add(new ChannelInfo
{ {
Number = channelNumber, Number = channelNumber,
Name = map.channel Name = name
}); });
} }
} }

View File

@ -5,6 +5,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
{ {
public interface IDbConnector public interface IDbConnector
{ {
Task<IDbConnection> Connect(string dbPath); Task<IDbConnection> Connect(string dbPath, int? cacheSize = null);
} }
} }

View File

@ -23,7 +23,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
/// <param name="logger">The logger.</param> /// <param name="logger">The logger.</param>
/// <returns>Task{IDbConnection}.</returns> /// <returns>Task{IDbConnection}.</returns>
/// <exception cref="System.ArgumentNullException">dbPath</exception> /// <exception cref="System.ArgumentNullException">dbPath</exception>
public static async Task<IDbConnection> ConnectToDb(string dbPath, ILogger logger) public static async Task<IDbConnection> ConnectToDb(string dbPath, int? cacheSize, ILogger logger)
{ {
if (string.IsNullOrEmpty(dbPath)) if (string.IsNullOrEmpty(dbPath))
{ {
@ -35,7 +35,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
var connectionstr = new SQLiteConnectionStringBuilder var connectionstr = new SQLiteConnectionStringBuilder
{ {
PageSize = 4096, PageSize = 4096,
CacheSize = 2000, CacheSize = cacheSize ?? 2000,
SyncMode = SynchronizationModes.Normal, SyncMode = SynchronizationModes.Normal,
DataSource = dbPath, DataSource = dbPath,
JournalMode = SQLiteJournalModeEnum.Wal JournalMode = SQLiteJournalModeEnum.Wal

View File

@ -127,7 +127,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
{ {
var dbFile = Path.Combine(_config.ApplicationPaths.DataPath, "library.db"); var dbFile = Path.Combine(_config.ApplicationPaths.DataPath, "library.db");
_connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); _connection = await dbConnector.Connect(dbFile, 6000).ConfigureAwait(false);
var createMediaStreamsTableCommand var createMediaStreamsTableCommand
= "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, TimeBase TEXT NULL, CodecTimeBase TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))"; = "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, TimeBase TEXT NULL, CodecTimeBase TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";

View File

@ -16,9 +16,9 @@ namespace MediaBrowser.Server.Mono.Native
_logger = logger; _logger = logger;
} }
public Task<IDbConnection> Connect(string dbPath) public Task<IDbConnection> Connect(string dbPath, int? cacheSize = null)
{ {
return SqliteExtensions.ConnectToDb(dbPath, _logger); return SqliteExtensions.ConnectToDb(dbPath, cacheSize, _logger);
} }
} }
} }

View File

@ -16,11 +16,11 @@ namespace MediaBrowser.ServerApplication.Native
_logger = logger; _logger = logger;
} }
public async Task<IDbConnection> Connect(string dbPath) public async Task<IDbConnection> Connect(string dbPath, int? cacheSize = null)
{ {
try try
{ {
return await SqliteExtensions.ConnectToDb(dbPath, _logger).ConfigureAwait(false); return await SqliteExtensions.ConnectToDb(dbPath, cacheSize, _logger).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {