diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
index 322b6773fc..7eb6a67d4a 100644
--- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj
+++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
@@ -110,8 +110,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -136,6 +162,10 @@
+
+
+
+
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
similarity index 98%
rename from MediaBrowser.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
rename to Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
index 4137ab2cf8..6bb06843a3 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
@@ -9,7 +9,7 @@ using MediaBrowser.Controller.IO;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Logging;
-namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
+namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
public class DirectRecorder : IRecorder
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
similarity index 98%
rename from MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
rename to Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 1e5f760ca7..b8b0cb73c1 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -34,10 +34,12 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.Configuration;
+using MediaBrowser.Model.Diagnostics;
using MediaBrowser.Model.FileOrganization;
-using Microsoft.Win32;
+using MediaBrowser.Model.System;
+using MediaBrowser.Model.Threading;
-namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
+namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
public class EmbyTV : ILiveTvService, ISupportsDirectStreamProvider, ISupportsNewTimerIds, IDisposable
{
@@ -58,6 +60,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private readonly IProviderManager _providerManager;
private readonly IFileOrganizationService _organizationService;
private readonly IMediaEncoder _mediaEncoder;
+ private readonly IProcessFactory _processFactory;
+ private readonly ISystemEvents _systemEvents;
public static EmbyTV Current;
@@ -67,7 +71,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private readonly ConcurrentDictionary _activeRecordings =
new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase);
- public EmbyTV(IServerApplicationHost appHost, ILogger logger, IJsonSerializer jsonSerializer, IHttpClient httpClient, IServerConfigurationManager config, ILiveTvManager liveTvManager, IFileSystem fileSystem, ILibraryManager libraryManager, ILibraryMonitor libraryMonitor, IProviderManager providerManager, IFileOrganizationService organizationService, IMediaEncoder mediaEncoder)
+ public EmbyTV(IServerApplicationHost appHost, ILogger logger, IJsonSerializer jsonSerializer, IHttpClient httpClient, IServerConfigurationManager config, ILiveTvManager liveTvManager, IFileSystem fileSystem, ILibraryManager libraryManager, ILibraryMonitor libraryMonitor, IProviderManager providerManager, IFileOrganizationService organizationService, IMediaEncoder mediaEncoder, ITimerFactory timerFactory, IProcessFactory processFactory, ISystemEvents systemEvents)
{
Current = this;
@@ -81,11 +85,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
_providerManager = providerManager;
_organizationService = organizationService;
_mediaEncoder = mediaEncoder;
+ _processFactory = processFactory;
+ _systemEvents = systemEvents;
_liveTvManager = (LiveTvManager)liveTvManager;
_jsonSerializer = jsonSerializer;
_seriesTimerProvider = new SeriesTimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "seriestimers"));
- _timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), _logger);
+ _timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), _logger, timerFactory);
_timerProvider.TimerFired += _timerProvider_TimerFired;
_config.NamedConfigurationUpdated += _config_NamedConfigurationUpdated;
@@ -103,10 +109,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{
_timerProvider.RestartTimers();
- SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
+ _systemEvents.Resume += _systemEvents_Resume;
CreateRecordingFolders();
}
+ private void _systemEvents_Resume(object sender, EventArgs e)
+ {
+ _timerProvider.RestartTimers();
+ }
+
private void OnRecordingFoldersChanged()
{
CreateRecordingFolders();
@@ -230,16 +241,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
}
}
- void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
- {
- _logger.Info("Power mode changed to {0}", e.Mode);
-
- if (e.Mode == PowerModes.Resume)
- {
- _timerProvider.RestartTimers();
- }
- }
-
public string Name
{
get { return "Emby"; }
@@ -987,7 +988,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
_liveStreamsSemaphore.Release();
}
- throw new ApplicationException("Tuner not found.");
+ throw new Exception("Tuner not found.");
}
public async Task> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken)
@@ -1030,7 +1031,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
IsInfiniteStream = true,
RequiresOpening = false,
RequiresClosing = false,
- Protocol = Model.MediaInfo.MediaProtocol.Http,
+ Protocol = MediaBrowser.Model.MediaInfo.MediaProtocol.Http,
BufferMs = 0
};
@@ -1352,7 +1353,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
timer.StartDate = DateTime.UtcNow.AddSeconds(retryIntervalSeconds);
_timerProvider.AddOrUpdate(timer);
}
- else if (File.Exists(recordPath))
+ else if (_fileSystem.FileExists(recordPath))
{
timer.RecordingPath = recordPath;
timer.Status = RecordingStatus.Completed;
@@ -1408,7 +1409,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
.Where(i => i.Status == RecordingStatus.Completed && !string.IsNullOrWhiteSpace(i.RecordingPath))
.Where(i => string.Equals(i.SeriesTimerId, seriesTimerId, StringComparison.OrdinalIgnoreCase))
.OrderByDescending(i => i.EndDate)
- .Where(i => File.Exists(i.RecordingPath))
+ .Where(i => _fileSystem.FileExists(i.RecordingPath))
.Skip(seriesTimer.KeepUpTo - 1)
.ToList();
@@ -1456,13 +1457,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{
try
{
- File.Delete(timer.RecordingPath);
+ _fileSystem.DeleteFile(timer.RecordingPath);
}
- catch (DirectoryNotFoundException)
- {
-
- }
- catch (FileNotFoundException)
+ catch (IOException)
{
}
@@ -1518,7 +1515,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
if (regInfo.IsValid)
{
- return new EncodedRecorder(_logger, _fileSystem, _mediaEncoder, _config.ApplicationPaths, _jsonSerializer, config, _httpClient);
+ return new EncodedRecorder(_logger, _fileSystem, _mediaEncoder, _config.ApplicationPaths, _jsonSerializer, config, _httpClient, _processFactory);
}
}
@@ -1574,7 +1571,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{
var nfoPath = Path.Combine(seriesPath, "tvshow.nfo");
- if (File.Exists(nfoPath))
+ if (_fileSystem.FileExists(nfoPath))
{
return;
}
@@ -1609,7 +1606,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{
var nfoPath = Path.ChangeExtension(recordingPath, ".nfo");
- if (File.Exists(nfoPath))
+ if (_fileSystem.FileExists(nfoPath))
{
return;
}
@@ -1930,7 +1927,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
var defaultFolder = RecordingPath;
var defaultName = "Recordings";
- if (Directory.Exists(defaultFolder))
+ if (_fileSystem.DirectoryExists(defaultFolder))
{
list.Add(new VirtualFolderInfo
{
@@ -1940,7 +1937,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
}
var customPath = GetConfiguration().MovieRecordingPath;
- if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && Directory.Exists(customPath))
+ if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && _fileSystem.DirectoryExists(customPath))
{
list.Add(new VirtualFolderInfo
{
@@ -1951,7 +1948,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
}
customPath = GetConfiguration().SeriesRecordingPath;
- if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && Directory.Exists(customPath))
+ if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && _fileSystem.DirectoryExists(customPath))
{
list.Add(new VirtualFolderInfo
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTVRegistration.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTVRegistration.cs
similarity index 94%
rename from MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTVRegistration.cs
rename to Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTVRegistration.cs
index 675fca3258..b339537ae7 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTVRegistration.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTVRegistration.cs
@@ -1,7 +1,7 @@
using System.Threading.Tasks;
using MediaBrowser.Common.Security;
-namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
+namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
public class EmbyTVRegistration : IRequiresRegistration
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
similarity index 92%
rename from MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
rename to Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
index 95c2b5ebb2..93ba9c420b 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
@@ -13,13 +13,14 @@ using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.MediaEncoding;
+using MediaBrowser.Model.Diagnostics;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
-namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
+namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
public class EncodedRecorder : IRecorder
{
@@ -32,11 +33,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private bool _hasExited;
private Stream _logFileStream;
private string _targetPath;
- private Process _process;
+ private IProcess _process;
+ private readonly IProcessFactory _processFactory;
private readonly IJsonSerializer _json;
private readonly TaskCompletionSource _taskCompletionSource = new TaskCompletionSource();
- public EncodedRecorder(ILogger logger, IFileSystem fileSystem, IMediaEncoder mediaEncoder, IServerApplicationPaths appPaths, IJsonSerializer json, LiveTvOptions liveTvOptions, IHttpClient httpClient)
+ public EncodedRecorder(ILogger logger, IFileSystem fileSystem, IMediaEncoder mediaEncoder, IServerApplicationPaths appPaths, IJsonSerializer json, LiveTvOptions liveTvOptions, IHttpClient httpClient, IProcessFactory processFactory)
{
_logger = logger;
_fileSystem = fileSystem;
@@ -45,6 +47,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
_json = json;
_liveTvOptions = liveTvOptions;
_httpClient = httpClient;
+ _processFactory = processFactory;
}
private string OutputFormat
@@ -82,27 +85,23 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
_targetPath = targetFile;
_fileSystem.CreateDirectory(Path.GetDirectoryName(targetFile));
- var process = new Process
+ var process = _processFactory.Create(new ProcessOptions
{
- StartInfo = new ProcessStartInfo
- {
- CreateNoWindow = true,
- UseShellExecute = false,
+ CreateNoWindow = true,
+ UseShellExecute = false,
- // Must consume both stdout and stderr or deadlocks may occur
- //RedirectStandardOutput = true,
- RedirectStandardError = true,
- RedirectStandardInput = true,
+ // Must consume both stdout and stderr or deadlocks may occur
+ //RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ RedirectStandardInput = true,
- FileName = _mediaEncoder.EncoderPath,
- Arguments = GetCommandLineArgs(mediaSource, inputFile, targetFile, duration),
-
- WindowStyle = ProcessWindowStyle.Hidden,
- ErrorDialog = false
- },
+ FileName = _mediaEncoder.EncoderPath,
+ Arguments = GetCommandLineArgs(mediaSource, inputFile, targetFile, duration),
+ IsHidden = true,
+ ErrorDialog = false,
EnableRaisingEvents = true
- };
+ });
_process = process;
@@ -251,7 +250,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
///
/// Processes the exited.
///
- private void OnFfMpegProcessExited(Process process, string inputFile)
+ private void OnFfMpegProcessExited(IProcess process, string inputFile)
{
_hasExited = true;
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs
similarity index 80%
rename from MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs
rename to Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs
index 713cb9cd30..139cf570ee 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs
@@ -1,6 +1,6 @@
using MediaBrowser.Controller.Plugins;
-namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
+namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
public class EntryPoint : IServerEntryPoint
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs
similarity index 93%
rename from MediaBrowser.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs
rename to Emby.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs
index 5706b6ae9e..3b5e60c4a7 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs
@@ -3,7 +3,7 @@ using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Dto;
-namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
+namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
public interface IRecorder
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
similarity index 96%
rename from MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
rename to Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
index 9bda9c3f60..ded4f04c4a 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
@@ -8,7 +8,7 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
-namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
+namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
public class ItemDataProvider
where T : class
@@ -54,9 +54,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
catch (FileNotFoundException)
{
}
- catch (DirectoryNotFoundException)
- {
- }
catch (IOException ex)
{
Logger.ErrorException("Error deserializing {0}", ex, jsonFile);
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs
similarity index 98%
rename from MediaBrowser.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs
rename to Emby.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs
index f7b4b3fde6..0ae5971bcb 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs
@@ -4,7 +4,7 @@ using System;
using System.Globalization;
using MediaBrowser.Model.LiveTv;
-namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
+namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
internal class RecordingHelper
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs
similarity index 93%
rename from MediaBrowser.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs
rename to Emby.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs
index b2a347b77e..7bf6bf1ca2 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs
@@ -6,7 +6,7 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
-namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
+namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
public class SeriesTimerManager : ItemDataProvider
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
similarity index 90%
rename from MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
rename to Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
index 1e01df29dc..35868d318e 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
@@ -12,20 +12,23 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
+using MediaBrowser.Model.Threading;
-namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
+namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
public class TimerManager : ItemDataProvider
{
- private readonly ConcurrentDictionary _timers = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase);
+ private readonly ConcurrentDictionary _timers = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase);
private readonly ILogger _logger;
public event EventHandler> TimerFired;
+ private readonly ITimerFactory _timerFactory;
- public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, ILogger logger1)
+ public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, ILogger logger1, ITimerFactory timerFactory)
: base(fileSystem, jsonSerializer, logger, dataPath, (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase))
{
_logger = logger1;
+ _timerFactory = timerFactory;
}
public void RestartTimers()
@@ -126,7 +129,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private void StartTimer(TimerInfo item, TimeSpan dueTime)
{
- var timer = new Timer(TimerCallback, item.Id, dueTime, TimeSpan.Zero);
+ var timer = _timerFactory.Create(TimerCallback, item.Id, dueTime, TimeSpan.Zero);
if (_timers.TryAdd(item.Id, timer))
{
@@ -141,7 +144,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private void StopTimer(TimerInfo item)
{
- Timer timer;
+ ITimer timer;
if (_timers.TryRemove(item.Id, out timer))
{
timer.Dispose();
diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
similarity index 99%
rename from MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
rename to Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
index d5abcf98e2..7beaed338b 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
@@ -16,7 +16,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-namespace MediaBrowser.Server.Implementations.LiveTv.Listings
+namespace Emby.Server.Implementations.LiveTv.Listings
{
public class SchedulesDirect : IListingsProvider
{
@@ -589,13 +589,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
{
var imageIdString = "[";
- programIds.ForEach(i =>
+ foreach (var i in programIds)
{
if (!imageIdString.Contains(i.Substring(0, 10)))
{
imageIdString += "\"" + i.Substring(0, 10) + "\",";
}
- });
+ }
+
imageIdString = imageIdString.TrimEnd(',') + "]";
var httpOptions = new HttpRequestOptions()
@@ -822,7 +823,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
return root.token;
}
- throw new ApplicationException("Could not authenticate with Schedules Direct Error: " + root.message);
+ throw new Exception("Could not authenticate with Schedules Direct Error: " + root.message);
}
}
diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
similarity index 90%
rename from MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
rename to Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
index ef498a43d5..57723e3c53 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
@@ -15,21 +15,24 @@ using Emby.XmlTv.Entities;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
-namespace MediaBrowser.Server.Implementations.LiveTv.Listings
+namespace Emby.Server.Implementations.LiveTv.Listings
{
public class XmlTvListingsProvider : IListingsProvider
{
private readonly IServerConfigurationManager _config;
private readonly IHttpClient _httpClient;
private readonly ILogger _logger;
+ private readonly IFileSystem _fileSystem;
- public XmlTvListingsProvider(IServerConfigurationManager config, IHttpClient httpClient, ILogger logger)
+ public XmlTvListingsProvider(IServerConfigurationManager config, IHttpClient httpClient, ILogger logger, IFileSystem fileSystem)
{
_config = config;
_httpClient = httpClient;
_logger = logger;
+ _fileSystem = fileSystem;
}
public string Name
@@ -58,7 +61,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
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 (File.Exists(cacheFile))
+ if (_fileSystem.FileExists(cacheFile))
{
return cacheFile;
}
@@ -78,13 +81,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
}).ConfigureAwait(false);
- Directory.CreateDirectory(Path.GetDirectoryName(cacheFile));
+ _fileSystem.CreateDirectory(Path.GetDirectoryName(cacheFile));
- using (var stream = File.OpenRead(tempFile))
+ using (var stream = _fileSystem.OpenRead(tempFile))
{
using (var reader = new StreamReader(stream, Encoding.UTF8))
{
- using (var fileStream = File.OpenWrite(cacheFile))
+ using (var fileStream = _fileSystem.GetFileStream(cacheFile, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
{
using (var writer = new StreamWriter(fileStream))
{
@@ -138,10 +141,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
IsSeries = p.Episode != null,
IsRepeat = p.IsRepeat,
IsPremiere = p.Premiere != null,
- IsKids = p.Categories.Any(c => info.KidsCategories.Contains(c, StringComparer.InvariantCultureIgnoreCase)),
- IsMovie = p.Categories.Any(c => info.MovieCategories.Contains(c, StringComparer.InvariantCultureIgnoreCase)),
- IsNews = p.Categories.Any(c => info.NewsCategories.Contains(c, StringComparer.InvariantCultureIgnoreCase)),
- IsSports = p.Categories.Any(c => info.SportsCategories.Contains(c, StringComparer.InvariantCultureIgnoreCase)),
+ IsKids = p.Categories.Any(c => info.KidsCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
+ IsMovie = p.Categories.Any(c => info.MovieCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
+ IsNews = p.Categories.Any(c => info.NewsCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
+ IsSports = p.Categories.Any(c => info.SportsCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
ImageUrl = p.Icon != null && !String.IsNullOrEmpty(p.Icon.Source) ? p.Icon.Source : null,
HasImage = p.Icon != null && !String.IsNullOrEmpty(p.Icon.Source),
OfficialRating = p.Rating != null && !String.IsNullOrEmpty(p.Rating.Value) ? p.Rating.Value : null,
@@ -177,7 +180,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
if (channels != null)
{
- channels.ForEach(c =>
+ foreach (var c in channels)
{
var channelNumber = info.GetMappedChannel(c.Number);
var match = results.FirstOrDefault(r => string.Equals(r.Id, channelNumber, StringComparison.OrdinalIgnoreCase));
@@ -186,14 +189,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
{
c.ImageUrl = match.Icon.Source;
}
- });
+ }
}
}
public Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings)
{
// Assume all urls are valid. check files for existence
- if (!info.Path.StartsWith("http", StringComparison.OrdinalIgnoreCase) && !File.Exists(info.Path))
+ if (!info.Path.StartsWith("http", StringComparison.OrdinalIgnoreCase) && !_fileSystem.FileExists(info.Path))
{
throw new FileNotFoundException("Could not find the XmlTv file specified:", info.Path);
}
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveStreamHelper.cs b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs
similarity index 94%
rename from MediaBrowser.Server.Implementations/LiveTv/LiveStreamHelper.cs
rename to Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs
index 336c32baef..a338ae23ae 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveStreamHelper.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs
@@ -8,7 +8,7 @@ using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Logging;
-namespace MediaBrowser.Server.Implementations.LiveTv
+namespace Emby.Server.Implementations.LiveTv
{
public class LiveStreamHelper
{
@@ -57,7 +57,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
mediaSource.RunTimeTicks = null;
}
- var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == Model.Entities.MediaStreamType.Audio);
+ var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaBrowser.Model.Entities.MediaStreamType.Audio);
if (audioStream == null || audioStream.Index == -1)
{
@@ -68,7 +68,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
mediaSource.DefaultAudioStreamIndex = audioStream.Index;
}
- var videoStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == Model.Entities.MediaStreamType.Video);
+ var videoStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaBrowser.Model.Entities.MediaStreamType.Video);
if (videoStream != null)
{
if (!videoStream.BitRate.HasValue)
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvConfigurationFactory.cs b/Emby.Server.Implementations/LiveTv/LiveTvConfigurationFactory.cs
similarity index 90%
rename from MediaBrowser.Server.Implementations/LiveTv/LiveTvConfigurationFactory.cs
rename to Emby.Server.Implementations/LiveTv/LiveTvConfigurationFactory.cs
index 57d1d79e16..2be6427372 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvConfigurationFactory.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvConfigurationFactory.cs
@@ -2,7 +2,7 @@
using MediaBrowser.Model.LiveTv;
using System.Collections.Generic;
-namespace MediaBrowser.Server.Implementations.LiveTv
+namespace Emby.Server.Implementations.LiveTv
{
public class LiveTvConfigurationFactory : IConfigurationFactory
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
similarity index 99%
rename from MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs
rename to Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
index c7a2d295d9..4e71615210 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
@@ -14,7 +14,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-namespace MediaBrowser.Server.Implementations.LiveTv
+namespace Emby.Server.Implementations.LiveTv
{
public class LiveTvDtoService
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
similarity index 98%
rename from MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
rename to Emby.Server.Implementations/LiveTv/LiveTvManager.cs
index 93fc5459a1..adec668589 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -25,8 +25,6 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.IO;
-using IniParser;
-using IniParser.Model;
using MediaBrowser.Common.Events;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Security;
@@ -37,9 +35,9 @@ using MediaBrowser.Model.Events;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Tasks;
-using MediaBrowser.Server.Implementations.LiveTv.Listings;
+using Emby.Server.Implementations.LiveTv.Listings;
-namespace MediaBrowser.Server.Implementations.LiveTv
+namespace Emby.Server.Implementations.LiveTv
{
///
/// Class LiveTvManager
@@ -2967,43 +2965,46 @@ namespace MediaBrowser.Server.Implementations.LiveTv
public List GetSatIniMappings()
{
- var names = GetType().Assembly.GetManifestResourceNames().Where(i => i.IndexOf("SatIp.ini", StringComparison.OrdinalIgnoreCase) != -1).ToList();
+ return new List();
+ //var names = GetType().Assembly.GetManifestResourceNames().Where(i => i.IndexOf("SatIp.ini", StringComparison.OrdinalIgnoreCase) != -1).ToList();
- return names.Select(GetSatIniMappings).Where(i => i != null).DistinctBy(i => i.Value.Split('|')[0]).ToList();
+ //return names.Select(GetSatIniMappings).Where(i => i != null).DistinctBy(i => i.Value.Split('|')[0]).ToList();
}
public NameValuePair GetSatIniMappings(string resource)
{
- using (var stream = GetType().Assembly.GetManifestResourceStream(resource))
- {
- using (var reader = new StreamReader(stream))
- {
- var parser = new StreamIniDataParser();
- IniData data = parser.ReadData(reader);
+ return new NameValuePair();
+ //using (var stream = GetType().Assembly.GetManifestResourceStream(resource))
+ //{
+ // using (var reader = new StreamReader(stream))
+ // {
+ // var parser = new StreamIniDataParser();
+ // IniData data = parser.ReadData(reader);
- var satType1 = data["SATTYPE"]["1"];
- var satType2 = data["SATTYPE"]["2"];
+ // var satType1 = data["SATTYPE"]["1"];
+ // var satType2 = data["SATTYPE"]["2"];
- if (string.IsNullOrWhiteSpace(satType2))
- {
- return null;
- }
+ // if (string.IsNullOrWhiteSpace(satType2))
+ // {
+ // return null;
+ // }
- var srch = "SatIp.ini.";
- var filename = Path.GetFileName(resource);
+ // var srch = "SatIp.ini.";
+ // var filename = Path.GetFileName(resource);
- return new NameValuePair
- {
- Name = satType1 + " " + satType2,
- Value = satType2 + "|" + filename.Substring(filename.IndexOf(srch) + srch.Length)
- };
- }
- }
+ // return new NameValuePair
+ // {
+ // Name = satType1 + " " + satType2,
+ // Value = satType2 + "|" + filename.Substring(filename.IndexOf(srch) + srch.Length)
+ // };
+ // }
+ //}
}
public Task> GetSatChannelScanResult(TunerHostInfo info, CancellationToken cancellationToken)
{
- return new TunerHosts.SatIp.ChannelScan(_logger).Scan(info, cancellationToken);
+ return Task.FromResult(new List());
+ //return new TunerHosts.SatIp.ChannelScan(_logger).Scan(info, cancellationToken);
}
public Task> GetChannelsForListingsProvider(string id, CancellationToken cancellationToken)
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
similarity index 97%
rename from MediaBrowser.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
rename to Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
index 79d321e7e2..e0a35686ec 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
@@ -15,7 +15,7 @@ using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Dlna;
-namespace MediaBrowser.Server.Implementations.LiveTv
+namespace Emby.Server.Implementations.LiveTv
{
public class LiveTvMediaSourceProvider : IMediaSourceProvider
{
@@ -164,7 +164,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
// Null this out so that it will be treated like a live stream
mediaSource.RunTimeTicks = null;
- var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == Model.Entities.MediaStreamType.Audio);
+ var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaBrowser.Model.Entities.MediaStreamType.Audio);
if (audioStream == null || audioStream.Index == -1)
{
@@ -175,7 +175,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
mediaSource.DefaultAudioStreamIndex = audioStream.Index;
}
- var videoStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == Model.Entities.MediaStreamType.Video);
+ var videoStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaBrowser.Model.Entities.MediaStreamType.Video);
if (videoStream != null)
{
if (!videoStream.BitRate.HasValue)
diff --git a/MediaBrowser.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs b/Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs
similarity index 97%
rename from MediaBrowser.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs
rename to Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs
index bf0ed90eab..f2806292d0 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs
+++ b/Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs
@@ -7,7 +7,7 @@ using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Model.Tasks;
-namespace MediaBrowser.Server.Implementations.LiveTv
+namespace Emby.Server.Implementations.LiveTv
{
public class RefreshChannelsScheduledTask : IScheduledTask, IConfigurableScheduledTask
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
similarity index 99%
rename from MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
rename to Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
index 0fe74798f5..ad43a611b8 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
@@ -15,7 +15,7 @@ using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Serialization;
-namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
+namespace Emby.Server.Implementations.LiveTv.TunerHosts
{
public abstract class BaseTunerHost
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs
similarity index 98%
rename from MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs
rename to Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs
index f039da9274..f2e48fbc0f 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs
@@ -14,7 +14,7 @@ using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Serialization;
-namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
+namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
public class HdHomerunDiscovery : IServerEntryPoint
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
similarity index 98%
rename from MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
rename to Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
index a32f4cca23..2d75367d96 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
@@ -24,7 +24,7 @@ using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Net;
-namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
+namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
public class HdHomerunHost : BaseTunerHost, ITunerHost, IConfigurableTunerHost
{
@@ -59,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
private string GetChannelId(TunerHostInfo info, Channels i)
{
- var id = ChannelIdPrefix + i.GuideNumber.ToString(CultureInfo.InvariantCulture);
+ var id = ChannelIdPrefix + i.GuideNumber;
if (info.DataVersion >= 1)
{
@@ -97,7 +97,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return lineup.Select(i => new ChannelInfo
{
Name = i.GuideName,
- Number = i.GuideNumber.ToString(CultureInfo.InvariantCulture),
+ Number = i.GuideNumber,
Id = GetChannelId(info, i),
IsFavorite = i.Favorite,
TunerHostId = info.Id,
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunLiveStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunLiveStream.cs
similarity index 95%
rename from MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunLiveStream.cs
rename to Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunLiveStream.cs
index 7bb4dc92e0..1e8057f875 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunLiveStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunLiveStream.cs
@@ -10,14 +10,8 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo;
-using MediaBrowser.Server.Implementations.LiveTv.EmbyTV;
-using System.Collections.Generic;
-using System.Linq;
-using MediaBrowser.Common.Extensions;
-using MediaBrowser.Common.IO;
-using MediaBrowser.Controller.IO;
-namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
+namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
public class HdHomerunLiveStream : LiveStream, IDirectStreamProvider
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
similarity index 98%
rename from MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
rename to Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
index b85b3810a3..756c3377c6 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
@@ -19,9 +19,8 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Server.Implementations.LiveTv.EmbyTV;
-namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
+namespace Emby.Server.Implementations.LiveTv.TunerHosts
{
public class M3UTunerHost : BaseTunerHost, ITunerHost, IConfigurableTunerHost
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
similarity index 98%
rename from MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
rename to Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
index 3bfe902dfb..8784d57531 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
@@ -14,7 +14,7 @@ using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Logging;
-namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
+namespace Emby.Server.Implementations.LiveTv.TunerHosts
{
public class M3uParser
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs
similarity index 97%
rename from MediaBrowser.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs
rename to Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs
index 8ff3fd6c17..360a2cee78 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs
@@ -7,7 +7,7 @@ using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Logging;
-namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
+namespace Emby.Server.Implementations.LiveTv.TunerHosts
{
public class MulticastStream
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs
similarity index 97%
rename from MediaBrowser.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs
rename to Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs
index c1566b9006..7605641b22 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs
@@ -8,7 +8,7 @@ using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Logging;
-namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
+namespace Emby.Server.Implementations.LiveTv.TunerHosts
{
public class QueueStream
{
diff --git a/MediaBrowser.Server.Implementations/Session/HttpSessionController.cs b/Emby.Server.Implementations/Session/HttpSessionController.cs
similarity index 99%
rename from MediaBrowser.Server.Implementations/Session/HttpSessionController.cs
rename to Emby.Server.Implementations/Session/HttpSessionController.cs
index f54c452cca..cea5d9b406 100644
--- a/MediaBrowser.Server.Implementations/Session/HttpSessionController.cs
+++ b/Emby.Server.Implementations/Session/HttpSessionController.cs
@@ -12,7 +12,7 @@ using System.Net;
using System.Threading;
using System.Threading.Tasks;
-namespace MediaBrowser.Server.Implementations.Session
+namespace Emby.Server.Implementations.Session
{
public class HttpSessionController : ISessionController, IDisposable
{
diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
similarity index 99%
rename from MediaBrowser.Server.Implementations/Session/SessionManager.cs
rename to Emby.Server.Implementations/Session/SessionManager.cs
index 6d86ff0919..960fe07397 100644
--- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -30,8 +30,9 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Net;
+using MediaBrowser.Model.Threading;
-namespace MediaBrowser.Server.Implementations.Session
+namespace Emby.Server.Implementations.Session
{
///
/// Class SessionManager
@@ -61,6 +62,7 @@ namespace MediaBrowser.Server.Implementations.Session
private readonly IAuthenticationRepository _authRepo;
private readonly IDeviceManager _deviceManager;
+ private readonly ITimerFactory _timerFactory;
///
/// The _active connections
@@ -94,7 +96,7 @@ namespace MediaBrowser.Server.Implementations.Session
private readonly SemaphoreSlim _sessionLock = new SemaphoreSlim(1, 1);
- public SessionManager(IUserDataManager userDataManager, ILogger logger, ILibraryManager libraryManager, IUserManager userManager, IMusicManager musicManager, IDtoService dtoService, IImageProcessor imageProcessor, IJsonSerializer jsonSerializer, IServerApplicationHost appHost, IHttpClient httpClient, IAuthenticationRepository authRepo, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager)
+ public SessionManager(IUserDataManager userDataManager, ILogger logger, ILibraryManager libraryManager, IUserManager userManager, IMusicManager musicManager, IDtoService dtoService, IImageProcessor imageProcessor, IJsonSerializer jsonSerializer, IServerApplicationHost appHost, IHttpClient httpClient, IAuthenticationRepository authRepo, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, ITimerFactory timerFactory)
{
_userDataManager = userDataManager;
_logger = logger;
@@ -109,6 +111,7 @@ namespace MediaBrowser.Server.Implementations.Session
_authRepo = authRepo;
_deviceManager = deviceManager;
_mediaSourceManager = mediaSourceManager;
+ _timerFactory = timerFactory;
_deviceManager.DeviceOptionsUpdated += _deviceManager_DeviceOptionsUpdated;
}
@@ -503,13 +506,13 @@ namespace MediaBrowser.Server.Implementations.Session
return users;
}
- private Timer _idleTimer;
+ private ITimer _idleTimer;
private void StartIdleCheckTimer()
{
if (_idleTimer == null)
{
- _idleTimer = new Timer(CheckForIdlePlayback, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5));
+ _idleTimer = _timerFactory.Create(CheckForIdlePlayback, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5));
}
}
private void StopIdleCheckTimer()
diff --git a/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
similarity index 99%
rename from MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs
rename to Emby.Server.Implementations/Session/SessionWebSocketListener.cs
index 9d30135a78..336c2caee4 100644
--- a/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs
+++ b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
@@ -11,7 +11,7 @@ using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Model.Services;
-namespace MediaBrowser.Server.Implementations.Session
+namespace Emby.Server.Implementations.Session
{
///
/// Class SessionWebSocketListener
diff --git a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs b/Emby.Server.Implementations/Session/WebSocketController.cs
similarity index 99%
rename from MediaBrowser.Server.Implementations/Session/WebSocketController.cs
rename to Emby.Server.Implementations/Session/WebSocketController.cs
index 765664299e..f0ff0b5ddd 100644
--- a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs
+++ b/Emby.Server.Implementations/Session/WebSocketController.cs
@@ -11,7 +11,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-namespace MediaBrowser.Server.Implementations.Session
+namespace Emby.Server.Implementations.Session
{
public class WebSocketController : ISessionController, IDisposable
{
diff --git a/Emby.Server.Implementations/project.json b/Emby.Server.Implementations/project.json
index 9d80f8ce42..0f4463ed2e 100644
--- a/Emby.Server.Implementations/project.json
+++ b/Emby.Server.Implementations/project.json
@@ -1,6 +1,7 @@
{
"supports": {},
"dependencies": {
+ "Emby.XmlTv": "1.0.0.63",
"MediaBrowser.Naming": "1.0.0.59",
"UniversalDetector": "1.0.1"
},
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs
index 8dca261a38..55101ce10f 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs
@@ -4,6 +4,7 @@ using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using Emby.Server.Implementations.LiveTv.TunerHosts;
using MediaBrowser.Model.IO;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
@@ -20,7 +21,6 @@ using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Server.Implementations.LiveTv.EmbyTV;
namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
{
diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
index 9289f3506b..6118e15016 100644
--- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
+++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
@@ -144,32 +144,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -188,8 +162,8 @@
-
+
@@ -212,12 +186,6 @@
-
-
- Code
-
-
-
@@ -227,6 +195,10 @@
+
+ {e383961b-9356-4d5d-8233-9a1079d03055}
+ Emby.Server.Implementations
+
{9142EEFA-7570-41E1-BFCC-468BB571AF2F}
MediaBrowser.Common
@@ -360,175 +332,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -570,6 +373,175 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
index 19b8ad2f97..077a589384 100644
--- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
+++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
@@ -62,7 +62,6 @@ using MediaBrowser.Server.Implementations.Localization;
using MediaBrowser.Server.Implementations.Notifications;
using MediaBrowser.Server.Implementations.Persistence;
using MediaBrowser.Server.Implementations.Security;
-using MediaBrowser.Server.Implementations.Session;
using MediaBrowser.Server.Implementations.Social;
using MediaBrowser.Server.Implementations.Sync;
using MediaBrowser.Server.Startup.Common.FFMpeg;
@@ -108,11 +107,13 @@ using Emby.Server.Implementations.Devices;
using Emby.Server.Implementations.Dto;
using Emby.Server.Implementations.FileOrganization;
using Emby.Server.Implementations.Library;
+using Emby.Server.Implementations.LiveTv;
using Emby.Server.Implementations.MediaEncoder;
using Emby.Server.Implementations.Notifications;
using Emby.Server.Implementations.Persistence;
using Emby.Server.Implementations.Playlists;
using Emby.Server.Implementations.ServerManager;
+using Emby.Server.Implementations.Session;
using Emby.Server.Implementations.Sync;
using Emby.Server.Implementations.TV;
using Emby.Server.Implementations.Updates;
@@ -644,7 +645,7 @@ namespace MediaBrowser.Server.Startup.Common
MediaSourceManager = new MediaSourceManager(ItemRepository, UserManager, LibraryManager, LogManager.GetLogger("MediaSourceManager"), JsonSerializer, FileSystemManager, UserDataManager, TimerFactory);
RegisterSingleInstance(MediaSourceManager);
- SessionManager = new SessionManager(UserDataManager, LogManager.GetLogger("SessionManager"), LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager);
+ SessionManager = new SessionManager(UserDataManager, LogManager.GetLogger("SessionManager"), LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager, TimerFactory);
RegisterSingleInstance(SessionManager);
var dlnaManager = new DlnaManager(XmlSerializer, FileSystemManager, ApplicationPaths, LogManager.GetLogger("Dlna"), JsonSerializer, this);