Skip to content

Commit

Permalink
Merge pull request #2484 from MediaBrowser/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
LukePulverenti authored Feb 23, 2017
2 parents 66769b7 + 188c6b4 commit cf1abfd
Show file tree
Hide file tree
Showing 106 changed files with 188,253 additions and 5,225 deletions.
17 changes: 2 additions & 15 deletions Emby.Server.Core/ApplicationHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
using Emby.Server.Implementations.Migrations;
using Emby.Server.Implementations.Security;
using Emby.Server.Implementations.Social;
using Emby.Server.Implementations.Sync;
using Emby.Server.Implementations.Channels;
using Emby.Server.Implementations.Collections;
using Emby.Server.Implementations.Dto;
Expand All @@ -109,7 +108,6 @@
using Emby.Server.Implementations.ServerManager;
using Emby.Server.Implementations.Session;
using Emby.Server.Implementations.Social;
using Emby.Server.Implementations.Sync;
using Emby.Server.Implementations.TV;
using Emby.Server.Implementations.Updates;
using MediaBrowser.Model.Activity;
Expand Down Expand Up @@ -526,6 +524,7 @@ private void PerformPostInitMigrations()
}

protected abstract IConnectManager CreateConnectManager();
protected abstract ISyncManager CreateSyncManager();

/// <summary>
/// Registers resources that classes will depend on
Expand Down Expand Up @@ -587,9 +586,6 @@ protected override async Task RegisterResources(IProgress<double> progress)
AuthenticationRepository = await GetAuthenticationRepository().ConfigureAwait(false);
RegisterSingleInstance(AuthenticationRepository);

SyncRepository = GetSyncRepository();
RegisterSingleInstance(SyncRepository);

UserManager = new UserManager(LogManager.GetLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, () => ConnectManager, this, JsonSerializer, FileSystemManager, CryptographyProvider, _defaultUserNameFactory());
RegisterSingleInstance(UserManager);

Expand Down Expand Up @@ -627,7 +623,7 @@ protected override async Task RegisterResources(IProgress<double> progress)
TVSeriesManager = new TVSeriesManager(UserManager, UserDataManager, LibraryManager, ServerConfigurationManager);
RegisterSingleInstance(TVSeriesManager);

SyncManager = new SyncManager(LibraryManager, SyncRepository, ImageProcessor, LogManager.GetLogger("SyncManager"), UserManager, () => DtoService, this, TVSeriesManager, () => MediaEncoder, FileSystemManager, () => SubtitleEncoder, ServerConfigurationManager, UserDataManager, () => MediaSourceManager, JsonSerializer, TaskManager, MemoryStreamFactory);
SyncManager = CreateSyncManager();
RegisterSingleInstance(SyncManager);

DtoService = new DtoService(LogManager.GetLogger("DtoService"), LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ServerConfigurationManager, FileSystemManager, ProviderManager, () => ChannelManager, SyncManager, this, () => DeviceManager, () => MediaSourceManager, () => LiveTvManager);
Expand Down Expand Up @@ -944,15 +940,6 @@ private IActivityRepository GetActivityLogRepository()
return repo;
}

private ISyncRepository GetSyncRepository()
{
var repo = new SyncRepository(LogManager.GetLogger("SyncRepository"), JsonSerializer, ServerConfigurationManager.ApplicationPaths);

repo.Initialize();

return repo;
}

/// <summary>
/// Configures the repositories.
/// </summary>
Expand Down
19 changes: 1 addition & 18 deletions Emby.Server.Implementations/Emby.Server.Implementations.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -264,23 +264,6 @@
<Compile Include="Sorting\StartDateComparer.cs" />
<Compile Include="Sorting\StudioComparer.cs" />
<Compile Include="StartupOptions.cs" />
<Compile Include="Sync\AppSyncProvider.cs" />
<Compile Include="Sync\CloudSyncProfile.cs" />
<Compile Include="Sync\IHasSyncQuality.cs" />
<Compile Include="Sync\MediaSync.cs" />
<Compile Include="Sync\MultiProviderSync.cs" />
<Compile Include="Sync\ServerSyncScheduledTask.cs" />
<Compile Include="Sync\SyncConfig.cs" />
<Compile Include="Sync\SyncConvertScheduledTask.cs" />
<Compile Include="Sync\SyncedMediaSourceProvider.cs" />
<Compile Include="Sync\SyncHelper.cs" />
<Compile Include="Sync\SyncJobOptions.cs" />
<Compile Include="Sync\SyncJobProcessor.cs" />
<Compile Include="Sync\SyncManager.cs" />
<Compile Include="Sync\SyncNotificationEntryPoint.cs" />
<Compile Include="Sync\SyncRegistrationInfo.cs" />
<Compile Include="Sync\SyncRepository.cs" />
<Compile Include="Sync\TargetDataProvider.cs" />
<Compile Include="TV\SeriesPostScanTask.cs" />
<Compile Include="TV\TVSeriesManager.cs" />
<Compile Include="Udp\UdpServer.cs" />
Expand Down Expand Up @@ -329,7 +312,7 @@
<Private>True</Private>
</Reference>
<Reference Include="SQLitePCLRaw.core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.core.1.1.1\lib\portable-net45+netcore45+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLitePCLRaw.core.dll</HintPath>
<HintPath>..\packages\SQLitePCLRaw.core.1.1.2\lib\portable-net45+netcore45+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLitePCLRaw.core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="UniversalDetector, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down
3 changes: 1 addition & 2 deletions Emby.Server.Implementations/EntryPoints/UsageReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public async Task ReportServerUsage(CancellationToken cancellationToken)
{ "serverid", _applicationHost.SystemId },
{ "deviceid", _applicationHost.SystemId },
{ "ver", _applicationHost.ApplicationVersion.ToString() },
{ "platform", _applicationHost.OperatingSystemDisplayName },
{ "isservice", _applicationHost.IsRunningAsService.ToString().ToLower()}
{ "platform", _applicationHost.OperatingSystemDisplayName }
};

var users = _userManager.Users.ToList();
Expand Down
25 changes: 19 additions & 6 deletions Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -474,17 +474,30 @@ private ChannelInfo GetEpgChannelFromTunerChannel(ListingsProviderInfo info, Cha

public ChannelInfo GetEpgChannelFromTunerChannel(List<NameValuePair> mappings, ChannelInfo tunerChannel, List<ChannelInfo> epgChannels)
{
var tunerChannelId = string.IsNullOrWhiteSpace(tunerChannel.TunerChannelId)
? tunerChannel.Id
: tunerChannel.TunerChannelId;
if (!string.IsNullOrWhiteSpace(tunerChannel.Id))
{
var mappedTunerChannelId = GetMappedChannel(tunerChannel.Id, mappings);

if (string.IsNullOrWhiteSpace(mappedTunerChannelId))
{
mappedTunerChannelId = tunerChannel.Id;
}

var channel = epgChannels.FirstOrDefault(i => string.Equals(mappedTunerChannelId, i.Id, StringComparison.OrdinalIgnoreCase));

if (channel != null)
{
return channel;
}
}

if (!string.IsNullOrWhiteSpace(tunerChannelId))
if (!string.IsNullOrWhiteSpace(tunerChannel.TunerChannelId))
{
var mappedTunerChannelId = GetMappedChannel(tunerChannelId, mappings);
var mappedTunerChannelId = GetMappedChannel(tunerChannel.TunerChannelId, mappings);

if (string.IsNullOrWhiteSpace(mappedTunerChannelId))
{
mappedTunerChannelId = tunerChannelId;
mappedTunerChannelId = tunerChannel.TunerChannelId;
}

var channel = epgChannels.FirstOrDefault(i => string.Equals(mappedTunerChannelId, i.Id, StringComparison.OrdinalIgnoreCase));
Expand Down
7 changes: 1 addition & 6 deletions Emby.Server.Implementations/LiveTv/LiveTvManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2926,19 +2926,14 @@ public TunerChannelMapping GetTunerChannelMapping(ChannelInfo tunerChannel, List
var result = new TunerChannelMapping
{
Name = tunerChannel.Name,
Id = tunerChannel.TunerChannelId
Id = tunerChannel.Id
};

if (!string.IsNullOrWhiteSpace(tunerChannel.Number))
{
result.Name = tunerChannel.Number + " " + result.Name;
}

if (string.IsNullOrWhiteSpace(result.Id))
{
result.Id = tunerChannel.Id;
}

var providerChannel = EmbyTV.EmbyTV.Current.GetEpgChannelFromTunerChannel(mappings, tunerChannel, epgChannels);

if (providerChannel != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ protected BaseTunerHost(IServerConfigurationManager config, ILogger logger, IJso
MediaEncoder = mediaEncoder;
}

protected abstract Task<IEnumerable<ChannelInfo>> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken);
protected abstract Task<List<ChannelInfo>> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken);
public abstract string Type { get; }

public async Task<IEnumerable<ChannelInfo>> GetChannels(TunerHostInfo tuner, bool enableCache, CancellationToken cancellationToken)
public async Task<List<ChannelInfo>> GetChannels(TunerHostInfo tuner, bool enableCache, CancellationToken cancellationToken)
{
ChannelCache cache = null;
var key = tuner.Id;
Expand Down Expand Up @@ -73,7 +73,7 @@ protected virtual List<TunerHostInfo> GetTunerHosts()
.ToList();
}

public async Task<IEnumerable<ChannelInfo>> GetChannels(bool enableCache, CancellationToken cancellationToken)
public async Task<List<ChannelInfo>> GetChannels(bool enableCache, CancellationToken cancellationToken)
{
var list = new List<ChannelInfo>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private async Task<List<Channels>> GetLineup(TunerHostInfo info, CancellationTok
}
}

protected override async Task<IEnumerable<ChannelInfo>> GetChannelsInternal(TunerHostInfo info, CancellationToken cancellationToken)
protected override async Task<List<ChannelInfo>> GetChannelsInternal(TunerHostInfo info, CancellationToken cancellationToken)
{
var lineup = await GetLineup(info, cancellationToken).ConfigureAwait(false);

Expand All @@ -99,7 +99,8 @@ protected override async Task<IEnumerable<ChannelInfo>> GetChannelsInternal(Tune
AudioCodec = i.AudioCodec,
VideoCodec = i.VideoCodec,
ChannelType = ChannelType.TV
});

}).ToList();
}

private readonly Dictionary<string, DiscoverResponse> _modelCache = new Dictionary<string, DiscoverResponse>();
Expand Down
6 changes: 4 additions & 2 deletions Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ public string Name

private const string ChannelIdPrefix = "m3u_";

protected override async Task<IEnumerable<ChannelInfo>> GetChannelsInternal(TunerHostInfo info, CancellationToken cancellationToken)
protected override async Task<List<ChannelInfo>> GetChannelsInternal(TunerHostInfo info, CancellationToken cancellationToken)
{
return await new M3uParser(Logger, _fileSystem, _httpClient, _appHost).Parse(info.Url, ChannelIdPrefix, info.Id, !info.EnableTvgId, cancellationToken).ConfigureAwait(false);
var result = await new M3uParser(Logger, _fileSystem, _httpClient, _appHost).Parse(info.Url, ChannelIdPrefix, info.Id, !info.EnableTvgId, cancellationToken).ConfigureAwait(false);

return result.Cast<ChannelInfo>().ToList();
}

public Task<List<LiveTvTunerInfo>> GetTunerInfos(CancellationToken cancellationToken)
Expand Down
39 changes: 18 additions & 21 deletions Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,26 @@ private M3UChannel GetChannelnfo(string extInf, string tunerHostId, string media
channel.Name = GetChannelName(extInf, attributes);
channel.Number = GetChannelNumber(extInf, attributes, mediaUrl);

var channelId = GetTunerChannelId(attributes);
string tvgId;
attributes.TryGetValue("tvg-id", out tvgId);

string channelId;
attributes.TryGetValue("channel-id", out channelId);

channel.TunerChannelId = string.IsNullOrWhiteSpace(tvgId) ? channelId : tvgId;

var channelIdValues = new List<string>();
if (!string.IsNullOrWhiteSpace(channelId))
{
channel.Id = channelId;
channel.TunerChannelId = channelId;
channelIdValues.Add(channelId);
}
if (!string.IsNullOrWhiteSpace(tvgId))
{
channelIdValues.Add(tvgId);
}
if (channelIdValues.Count > 0)
{
channel.Id = string.Join("_", channelIdValues.ToArray());
}

return channel;
Expand Down Expand Up @@ -296,24 +311,6 @@ private string GetChannelName(string extInf, Dictionary<string, string> attribut
return name;
}

private string GetTunerChannelId(Dictionary<string, string> attributes)
{
var values = new List<string>();

string result;
if (attributes.TryGetValue("tvg-id", out result))
{
values.Add(result);
}

if (attributes.TryGetValue("channel-id", out result))
{
values.Add(result);
}

return values.Count == 0 ? null : string.Join("-", values.ToArray());
}

private Dictionary<string, string> ParseExtInf(string line, out string remaining)
{
var dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ private async Task<MBRegistrationRecord> GetRegistrationStatusInternal(string fe
{ "systemid", _appHost.SystemId },
{ "mb2equiv", mb2Equivalent },
{ "ver", version },
{ "platform", _appHost.OperatingSystemDisplayName },
{ "isservice", _appHost.IsRunningAsService.ToString().ToLower() }
{ "platform", _appHost.OperatingSystemDisplayName }
};

try
Expand Down
118 changes: 0 additions & 118 deletions Emby.Server.Implementations/Sync/AppSyncProvider.cs

This file was deleted.

Loading

0 comments on commit cf1abfd

Please sign in to comment.