The Free Software Media System - Server Backend & API
fix mapping multiple tuner channels to same epg channel
Luke Pulverenti0ee1a0d7bd82
diff --git a/Emby.Common.Implementations/BaseApplicationHost.cs b/Emby.Common.Implementations/BaseApplicationHost.csindex 147a43fa18..f534335116 100644--- a/Emby.Common.Implementations/BaseApplicationHost.cs+++ b/Emby.Common.Implementations/BaseApplicationHost.cs@@ -873,7 +873,13 @@ return null;/// Gets or sets a value indicating whether this instance can self update./// </summary>/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>- public abstract bool CanSelfUpdate { get; }+ public virtual bool CanSelfUpdate+ {+ get+ {+ return false;+ }+ }/// <summary>/// Checks for update.diff --git a/Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.csindex de528a94f3..f0518f69ed 100644--- a/Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs+++ b/Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs@@ -379,7 +379,7 @@ namespace Emby.Common.Implementations.ScheduledTasks/// <exception cref="System.InvalidOperationException">Cannot execute a Task that is already running</exception>public async Task Execute(TaskExecutionOptions options){- var task = ExecuteInternal(options);+ var task = Task.Run(async () => await ExecuteInternal(options).ConfigureAwait(false));_currentTask = task;diff --git a/Emby.Server.Core/ApplicationHost.cs b/Emby.Server.Core/ApplicationHost.csindex 2163c4e478..c3d88eeab1 100644--- a/Emby.Server.Core/ApplicationHost.cs+++ b/Emby.Server.Core/ApplicationHost.cs@@ -312,7 +312,13 @@ namespace Emby.Server.Core}}- public abstract bool SupportsRunningAsService { get; }+ public virtual bool SupportsRunningAsService+ {+ get+ {+ return false;+ }+ }/// <summary>/// Gets the name.@@ -326,14 +332,26 @@ namespace Emby.Server.Core}}- public abstract bool IsRunningAsService { get; }+ public virtual bool IsRunningAsService+ {+ get+ {+ return false;+ }+ }private Assembly GetAssembly(Type type){return type.GetTypeInfo().Assembly;}- public abstract bool SupportsAutoRunAtStartup { get; }+ public virtual bool SupportsAutoRunAtStartup+ {+ get+ {+ return EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows;+ }+ }private void SetBaseExceptionMessage(){@@ -716,7 +734,13 @@ namespace Emby.Server.Coreawait ((UserManager)UserManager).Initialize().ConfigureAwait(false);}- protected abstract bool SupportsDualModeSockets { get; }+ protected virtual bool SupportsDualModeSockets+ {+ get+ {+ return true;+ }+ }private ICertificate GetCertificate(string certificateLocation){@@ -761,7 +785,75 @@ namespace Emby.Server.Corereturn new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, ImageEncoder, maxConcurrentImageProcesses, () => LibraryManager, TimerFactory);}- protected abstract FFMpegInstallInfo GetFfmpegInstallInfo();+ protected virtual FFMpegInstallInfo GetFfmpegInstallInfo()+ {+ var info = new FFMpegInstallInfo();++ // Windows builds: http://ffmpeg.zeranoe.com/builds/+ // Linux builds: http://johnvansickle.com/ffmpeg/+ // OS X builds: http://ffmpegmac.net/+ // OS X x64: http://www.evermeet.cx/ffmpeg/++ if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Linux)+ {+ info.FFMpegFilename = "ffmpeg";+ info.FFProbeFilename = "ffprobe";+ info.ArchiveType = "7z";+ info.Version = "20160215";+ info.DownloadUrls = GetLinuxDownloadUrls();+ }+ else if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows)+ {+ info.FFMpegFilename = "ffmpeg.exe";+ info.FFProbeFilename = "ffprobe.exe";+ info.Version = "20160410";+ info.ArchiveType = "7z";+ info.DownloadUrls = GetWindowsDownloadUrls();+ }++ // No version available - user requirement+ info.DownloadUrls = new string[] { };++ return info;+ }++ private string[] GetWindowsDownloadUrls()+ {+ switch (EnvironmentInfo.SystemArchitecture)+ {+ case Architecture.X64:+ return new[]+ {+ "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win64.7z"+ };+ case Architecture.X86:+ return new[]+ {+ "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win32.7z"+ };+ }++ return new string[] { };+ }++ private string[] GetLinuxDownloadUrls()+ {+ switch (EnvironmentInfo.SystemArchitecture)+ {+ case Architecture.X64:+ return new[]+ {+ "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-64bit-static.7z"+ };+ case Architecture.X86:+ return new[]+ {+ "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z"+ };+ }++ return new string[] { };+ }/// <summary>/// Registers the media encoder.@@ -1489,7 +1581,10 @@ namespace Emby.Server.Core}}- protected abstract void AuthorizeServer();+ protected virtual void AuthorizeServer()+ {+ throw new NotImplementedException();+ }public event EventHandler HasUpdateAvailableChanged;@@ -1565,7 +1660,10 @@ namespace Emby.Server.Core}}- protected abstract void ConfigureAutoRunInternal(bool autorun);+ protected virtual void ConfigureAutoRunInternal(bool autorun)+ {+ throw new NotImplementedException();+ }/// <summary>/// This returns localhost in the case of no external dns, and the hostname if the@@ -1631,7 +1729,10 @@ namespace Emby.Server.CoreEnableLoopbackInternal(appName);}- protected abstract void EnableLoopbackInternal(string appName);+ protected virtual void EnableLoopbackInternal(string appName)+ {++ }private void RegisterModules(){diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.csindex 30fa68d956..1f72ebd54b 100644--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs@@ -2872,7 +2872,8 @@ namespace Emby.Server.Implementations.Data}if (string.Equals(name, ItemSortBy.IsFavoriteOrLiked, StringComparison.OrdinalIgnoreCase)){- return new Tuple<string, bool>("IsFavorite", true);+ // (Select Case When Abs(COALESCE(ProductionYear, 0) - @ItemProductionYear) < 10 Then 2 Else 0 End )+ return new Tuple<string, bool>("(Select Case When IsFavorite is null Then 0 Else IsFavorite End )", true);}if (string.Equals(name, ItemSortBy.IsFolder, StringComparison.OrdinalIgnoreCase)){diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.csindex 5b0bd8bbc9..8248124944 100644--- a/Emby.Server.Implementations/Dto/DtoService.cs+++ b/Emby.Server.Implementations/Dto/DtoService.cs@@ -492,7 +492,7 @@ namespace Emby.Server.Implementations.Dto}}- //if (!(item is LiveTvProgram))+ if (!(item is LiveTvProgram)){dto.PlayAccess = item.GetPlayAccess(user);}@@ -1420,7 +1420,7 @@ namespace Emby.Server.Implementations.Dto{dto.AirDays = series.AirDays;dto.AirTime = series.AirTime;- dto.SeriesStatus = series.Status;+ dto.Status = series.Status.HasValue ? series.Status.Value.ToString() : null;}// Add SeasonInfodiff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.csindex 7aae0d68a5..1fc3dcd72f 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs@@ -986,6 +986,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVforeach (var program in programs){program.ChannelId = channelId;++ if (provider.Item2.EnableNewProgramIds)+ {+ program.Id += "_" + channelId;+ }}if (programs.Count > 0)diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.csindex 0d7a26553a..f76735030a 100644--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs@@ -81,12 +81,6 @@ namespace Emby.Server.Implementations.LiveTv.Listingsreturn programsInfo;}- if (string.IsNullOrWhiteSpace(info.ListingsId))- {- _logger.Warn("ListingsId is null, returning empty program list");- return programsInfo;- }-var dates = GetScheduleRequestDates(startDateUtc, endDateUtc);string stationID = channelId;@@ -156,7 +150,7 @@ namespace Emby.Server.Implementations.LiveTv.ListingsprogramDetails.Where(p => p.hasImageArtwork).Select(p => p.programID).ToList();- var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken);+ var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false);var schedules = dailySchedules.SelectMany(d => d.programs);foreach (ScheduleDirect.Program schedule in schedules)diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.csindex a89acf6479..c22bb11710 100644--- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs+++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs@@ -168,7 +168,6 @@ namespace Emby.Server.Implementations.LiveTv.ListingsEpisodeNumber = p.Episode == null ? null : p.Episode.Episode,EpisodeTitle = episodeTitle,Genres = p.Categories,- Id = String.Format("{0}_{1:O}", p.ChannelId, p.StartDate), // Construct an id from the channel and start date,StartDate = GetDate(p.StartDate),Name = p.Title,Overview = p.Description,@@ -208,6 +207,9 @@ namespace Emby.Server.Implementations.LiveTv.ListingsprogramInfo.ShowId = uniqueString.GetMD5().ToString("N");}+ // Construct an id from the channel and start date+ programInfo.Id = String.Format("{0}_{1:O}", p.ChannelId, p.StartDate);+if (programInfo.IsMovie){programInfo.IsSeries = false;diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.csindex d5ea0d4930..887784213b 100644--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs@@ -598,10 +598,6 @@ namespace Emby.Server.Implementations.LiveTvitem.ParentId = channel.Id;//item.ChannelType = channelType;- if (!string.Equals(item.ServiceName, serviceName, StringComparison.Ordinal))- {- forceUpdate = true;- }item.ServiceName = serviceName;item.Audio = info.Audio;@@ -1311,7 +1307,7 @@ namespace Emby.Server.Implementations.LiveTvvar isKids = false;var iSSeries = false;- var channelPrograms = await service.GetProgramsAsync(GetItemExternalId(currentChannel), start, end, cancellationToken).ConfigureAwait(false);+ var channelPrograms = (await service.GetProgramsAsync(GetItemExternalId(currentChannel), start, end, cancellationToken).ConfigureAwait(false)).ToList();var existingPrograms = _libraryManager.GetItemList(new InternalItemsQuery{@@ -1409,7 +1405,7 @@ namespace Emby.Server.Implementations.LiveTvdouble percent = numComplete;percent /= allChannelsList.Count;- progress.Report(80 * percent + 10);+ progress.Report(85 * percent + 15);}progress.Report(100);@@ -1884,7 +1880,7 @@ namespace Emby.Server.Implementations.LiveTv: _tvDtoService.GetInternalTimerId(service.Name, info.TimerId).ToString("N");dto.StartDate = info.StartDate;- dto.RecordingStatus = info.Status;+ dto.Status = info.Status.ToString();dto.IsRepeat = info.IsRepeat;dto.EpisodeTitle = info.EpisodeTitle;dto.IsMovie = info.IsMovie;@@ -2865,6 +2861,7 @@ namespace Emby.Server.Implementations.LiveTv{info.Id = Guid.NewGuid().ToString("N");config.ListingProviders.Add(info);+ info.EnableNewProgramIds = true;}else{diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.csindex 1c7c0828c3..bc9d01254b 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs@@ -9,17 +9,14 @@ using MediaBrowser.Model.MediaInfo;using MediaBrowser.Model.Serialization;using System;using System.Collections.Generic;-using System.Globalization;using System.IO;using System.Linq;using System.Threading;using System.Threading.Tasks;using MediaBrowser.Model.IO;using MediaBrowser.Common.Extensions;-using MediaBrowser.Common.IO;using MediaBrowser.Controller;using MediaBrowser.Controller.Configuration;-using MediaBrowser.Controller.IO;using MediaBrowser.Controller.MediaEncoding;using MediaBrowser.Model.Configuration;using MediaBrowser.Model.Net;@@ -66,7 +63,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunreturn id;}- private async Task<IEnumerable<Channels>> GetLineup(TunerHostInfo info, CancellationToken cancellationToken)+ private async Task<List<Channels>> GetLineup(TunerHostInfo info, CancellationToken cancellationToken){var options = new HttpRequestOptions{@@ -74,7 +71,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunCancellationToken = cancellationToken,BufferContent = false};- using (var stream = await _httpClient.Get(options))+ using (var stream = await _httpClient.Get(options).ConfigureAwait(false)){var lineup = JsonSerializer.DeserializeFromStream<List<Channels>>(stream) ?? new List<Channels>();@@ -127,7 +124,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunCacheMode = CacheMode.Unconditional,TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds),BufferContent = false- }))++ }).ConfigureAwait(false)){var response = JsonSerializer.DeserializeFromStream<DiscoverResponse>(stream);@@ -169,7 +167,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunCancellationToken = cancellationToken,TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds),BufferContent = false- }))++ }).ConfigureAwait(false)){var tuners = new List<LiveTvTunerInfo>();using (var sr = new StreamReader(stream, System.Text.Encoding.UTF8))@@ -536,7 +535,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunUrl = string.Format("{0}/discover.json", GetApiUrl(info, false)),CancellationToken = CancellationToken.None,BufferContent = false- }))++ }).ConfigureAwait(false)){var response = JsonSerializer.DeserializeFromStream<DiscoverResponse>(stream);diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.csindex a7e1b3cf3b..df83d4341f 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs@@ -74,10 +74,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsOnFinished = OnFinished};- var initial = _sharedBuffer.ToList();var list = new List<byte>();-- foreach (var bytes in initial)+ foreach (var bytes in _sharedBuffer){list.AddRange(bytes);}diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.csindex a3d43a3f9b..dcaf7c676e 100644--- a/MediaBrowser.Api/ItemUpdateService.cs+++ b/MediaBrowser.Api/ItemUpdateService.cs@@ -401,10 +401,21 @@ namespace MediaBrowser.Apivar series = item as Series;if (series != null){- series.Status = request.SeriesStatus;+ series.Status = GetSeriesStatus(request);series.AirDays = request.AirDays;series.AirTime = request.AirTime;}}++ private SeriesStatus? GetSeriesStatus(BaseItemDto item)+ {+ if (string.IsNullOrEmpty(item.Status))+ {+ return null;+ }++ return (SeriesStatus)Enum.Parse(typeof(SeriesStatus), item.Status, true);++ }}}diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csprojindex db5914f81d..6c8c6b2ab4 100644--- a/MediaBrowser.Api/MediaBrowser.Api.csproj+++ b/MediaBrowser.Api/MediaBrowser.Api.csproj@@ -173,10 +173,6 @@<Project>{17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}</Project><Name>MediaBrowser.Controller</Name></ProjectReference>- <ProjectReference Include="..\MediaBrowser.MediaEncoding\MediaBrowser.MediaEncoding.csproj">- <Project>{0bd82fa6-eb8a-4452-8af5-74f9c3849451}</Project>- <Name>MediaBrowser.MediaEncoding</Name>- </ProjectReference><ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj"><Project>{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}</Project><Name>MediaBrowser.Model</Name>diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.csindex e561b3f467..e1559cabf9 100644--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs@@ -22,7 +22,6 @@ using System.Threading.Tasks;using MediaBrowser.Common.Net;using MediaBrowser.Controller;using MediaBrowser.Controller.Net;-using MediaBrowser.MediaEncoding.Encoder;using MediaBrowser.Model.Diagnostics;namespace MediaBrowser.Api.Playbackdiff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.csindex 4fb936340e..912d60889d 100644--- a/MediaBrowser.Api/Playback/StreamState.cs+++ b/MediaBrowser.Api/Playback/StreamState.cs@@ -13,7 +13,7 @@ using System.Globalization;using System.IO;using System.Linq;using System.Threading;-using MediaBrowser.MediaEncoding.Encoder;+using MediaBrowser.Controller.MediaEncoding;namespace MediaBrowser.Api.Playback{diff --git a/MediaBrowser.Api/Playback/UniversalAudioService.cs b/MediaBrowser.Api/Playback/UniversalAudioService.csindex a52ae1df4c..e50d0f2c54 100644--- a/MediaBrowser.Api/Playback/UniversalAudioService.cs+++ b/MediaBrowser.Api/Playback/UniversalAudioService.cs@@ -199,9 +199,9 @@ namespace MediaBrowser.Api.Playbackif (isHeadRequest){- return service.Head(newRequest);+ return await service.Head(newRequest).ConfigureAwait(false);}- return service.Get(newRequest);+ return await service.Get(newRequest).ConfigureAwait(false);}else{@@ -239,9 +239,9 @@ namespace MediaBrowser.Api.Playbackif (isHeadRequest){- return service.Head(newRequest);+ return await service.Head(newRequest).ConfigureAwait(false);}- return service.Get(newRequest);+ return await service.Get(newRequest).ConfigureAwait(false);}}}diff --git a/MediaBrowser.Api/Sync/SyncHelper.cs b/MediaBrowser.Api/Sync/SyncHelper.csindex 60df2bb1e9..116cd8060e 100644--- a/MediaBrowser.Api/Sync/SyncHelper.cs+++ b/MediaBrowser.Api/Sync/SyncHelper.cs@@ -37,7 +37,7 @@ namespace MediaBrowser.Api.Syncoptions.Add(SyncJobOption.ItemLimit);break;}- if (item.IsFolderItem && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre)+ if ((item.IsFolder ?? false) && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre){options.Add(SyncJobOption.Quality);options.Add(SyncJobOption.Profile);@@ -57,7 +57,7 @@ namespace MediaBrowser.Api.Sync{if (item.SupportsSync ?? false){- if (item.IsFolderItem || item.IsGameGenre || item.IsMusicGenre || item.IsGenre || item.IsArtist || item.IsStudio || item.IsPerson)+ if ((item.IsFolder ?? false) || item.IsGameGenre || item.IsMusicGenre || item.IsGenre || item.IsArtist || item.IsStudio || item.IsPerson){options.Add(SyncJobOption.SyncNewContent);options.Add(SyncJobOption.ItemLimit);diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csprojindex 28229f8a7e..db5a5009c1 100644--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj@@ -184,6 +184,8 @@<Compile Include="LiveTv\TimerInfo.cs" /><Compile Include="LiveTv\TunerChannelMapping.cs" /><Compile Include="MediaEncoding\ChapterImageRefreshOptions.cs" />+ <Compile Include="MediaEncoding\EncodingHelper.cs" />+ <Compile Include="MediaEncoding\EncodingJobInfo.cs" /><Compile Include="MediaEncoding\EncodingJobOptions.cs" /><Compile Include="MediaEncoding\IEncodingManager.cs" /><Compile Include="MediaEncoding\ImageEncodingOptions.cs" />diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cssimilarity index 99%rename from MediaBrowser.MediaEncoding/Encoder/EncodingHelper.csrename to MediaBrowser.Controller/MediaEncoding/EncodingHelper.csindex ed95529641..c6cbc89860 100644--- a/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs@@ -3,22 +3,16 @@ using System.Collections.Generic;using System.Globalization;using System.IO;using System.Linq;-using System.Text;using System.Threading;-using System.Threading.Tasks;-using MediaBrowser.Common.Configuration;using MediaBrowser.Controller.Configuration;-using MediaBrowser.Controller.Library;-using MediaBrowser.Controller.MediaEncoding;using MediaBrowser.Model.Configuration;using MediaBrowser.Model.Dlna;using MediaBrowser.Model.Dto;using MediaBrowser.Model.Entities;using MediaBrowser.Model.IO;-using MediaBrowser.Model.Logging;using MediaBrowser.Model.MediaInfo;-namespace MediaBrowser.MediaEncoding.Encoder+namespace MediaBrowser.Controller.MediaEncoding{public class EncodingHelper{diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cssimilarity index 96%rename from MediaBrowser.MediaEncoding/Encoder/EncodingJobInfo.csrename to MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.csindex 20a9817a33..a18b864324 100644--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobInfo.cs+++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs@@ -1,11 +1,7 @@using System;using System.Collections.Generic;using System.Globalization;-using System.Linq;-using System.Text;-using System.Threading.Tasks;using MediaBrowser.Controller.Entities;-using MediaBrowser.Controller.MediaEncoding;using MediaBrowser.Model.Dlna;using MediaBrowser.Model.Dto;using MediaBrowser.Model.Entities;@@ -13,7 +9,7 @@ using MediaBrowser.Model.IO;using MediaBrowser.Model.Logging;using MediaBrowser.Model.MediaInfo;-namespace MediaBrowser.MediaEncoding.Encoder+namespace MediaBrowser.Controller.MediaEncoding{// For now, a common base class until the API and MediaEncoding classes are unifiedpublic class EncodingJobInfodiff --git a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csprojindex 5eac1a16dd..63e789a59d 100644--- a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj+++ b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj@@ -50,10 +50,8 @@<Compile Include="Configuration\EncodingConfigurationFactory.cs" /><Compile Include="Encoder\AudioEncoder.cs" /><Compile Include="Encoder\BaseEncoder.cs" />- <Compile Include="Encoder\EncodingHelper.cs" /><Compile Include="Encoder\EncodingJob.cs" /><Compile Include="Encoder\EncodingJobFactory.cs" />- <Compile Include="Encoder\EncodingJobInfo.cs" /><Compile Include="Encoder\EncodingUtils.cs" /><Compile Include="Encoder\EncoderValidator.cs" /><Compile Include="Encoder\FontConfigLoader.cs" />diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.csindex ff3f0be592..f8e1ca1b40 100644--- a/MediaBrowser.Model/Dto/BaseItemDto.cs+++ b/MediaBrowser.Model/Dto/BaseItemDto.cs@@ -342,15 +342,6 @@ namespace MediaBrowser.Model.Dto/// <value><c>true</c> if this instance is folder; otherwise, <c>false</c>.</value>public bool? IsFolder { get; set; }- [IgnoreDataMember]- public bool IsFolderItem- {- get- {- return IsFolder ?? false;- }- }-/// <summary>/// Gets or sets the parent id./// </summary>@@ -458,56 +449,6 @@ namespace MediaBrowser.Model.Dto/// <value>The status.</value>public string Status { get; set; }- [IgnoreDataMember]- public SeriesStatus? SeriesStatus- {- get- {- if (string.IsNullOrEmpty(Status))- {- return null;- }-- return (SeriesStatus)Enum.Parse(typeof(SeriesStatus), Status, true);- }- set- {- if (value == null)- {- Status = null;- }- else- {- Status = value.Value.ToString();- }- }- }-- [IgnoreDataMember]- public RecordingStatus? RecordingStatus- {- get- {- if (string.IsNullOrEmpty(Status))- {- return null;- }-- return (RecordingStatus)Enum.Parse(typeof(RecordingStatus), Status, true);- }- set- {- if (value == null)- {- Status = null;- }- else- {- Status = value.Value.ToString();- }- }- }-/// <summary>/// Gets or sets the air time./// </summary>@@ -650,19 +591,6 @@ namespace MediaBrowser.Model.Dtoreturn IsType(type.Name);}- /// <summary>- /// Gets or sets a value indicating whether [supports playlists].- /// </summary>- /// <value><c>true</c> if [supports playlists]; otherwise, <c>false</c>.</value>- [IgnoreDataMember]- public bool SupportsPlaylists- {- get- {- return RunTimeTicks.HasValue || IsFolderItem || IsGenre || IsMusicGenre || IsArtist;- }- }-/// <summary>/// Determines whether the specified type is type./// </summary>@@ -876,56 +804,6 @@ namespace MediaBrowser.Model.Dto/// <value>The series timer identifier.</value>public string SeriesTimerId { get; set; }- /// <summary>- /// Gets a value indicating whether this instance can resume.- /// </summary>- /// <value><c>true</c> if this instance can resume; otherwise, <c>false</c>.</value>- [IgnoreDataMember]- public bool CanResume- {- get { return UserData != null && UserData.PlaybackPositionTicks > 0; }- }-- /// <summary>- /// Gets the resume position ticks.- /// </summary>- /// <value>The resume position ticks.</value>- [IgnoreDataMember]- public long ResumePositionTicks- {- get { return UserData == null ? 0 : UserData.PlaybackPositionTicks; }- }-- /// <summary>- /// Gets the backdrop count.- /// </summary>- /// <value>The backdrop count.</value>- [IgnoreDataMember]- public int BackdropCount- {- get { return BackdropImageTags == null ? 0 : BackdropImageTags.Count; }- }-- /// <summary>- /// Gets the screenshot count.- /// </summary>- /// <value>The screenshot count.</value>- [IgnoreDataMember]- public int ScreenshotCount- {- get { return ScreenshotImageTags == null ? 0 : ScreenshotImageTags.Count; }- }-- /// <summary>- /// Gets a value indicating whether this instance has banner.- /// </summary>- /// <value><c>true</c> if this instance has banner; otherwise, <c>false</c>.</value>- [IgnoreDataMember]- public bool HasBanner- {- get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Banner); }- }-/// <summary>/// Gets a value indicating whether this instance has art./// </summary>@@ -976,46 +854,6 @@ namespace MediaBrowser.Model.Dtoget { return ImageTags != null && ImageTags.ContainsKey(ImageType.Primary); }}- /// <summary>- /// Gets a value indicating whether this instance has disc image.- /// </summary>- /// <value><c>true</c> if this instance has disc image; otherwise, <c>false</c>.</value>- [IgnoreDataMember]- public bool HasDiscImage- {- get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Disc); }- }-- /// <summary>- /// Gets a value indicating whether this instance has box image.- /// </summary>- /// <value><c>true</c> if this instance has box image; otherwise, <c>false</c>.</value>- [IgnoreDataMember]- public bool HasBoxImage- {- get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Box); }- }-- /// <summary>- /// Gets a value indicating whether this instance has box image.- /// </summary>- /// <value><c>true</c> if this instance has box image; otherwise, <c>false</c>.</value>- [IgnoreDataMember]- public bool HasBoxRearImage- {- get { return ImageTags != null && ImageTags.ContainsKey(ImageType.BoxRear); }- }-- /// <summary>- /// Gets a value indicating whether this instance has menu image.- /// </summary>- /// <value><c>true</c> if this instance has menu image; otherwise, <c>false</c>.</value>- [IgnoreDataMember]- public bool HasMenuImage- {- get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Menu); }- }-/// <summary>/// Gets a value indicating whether this instance is video./// </summary>@@ -1056,16 +894,6 @@ namespace MediaBrowser.Model.Dtoget { return StringHelper.EqualsIgnoreCase(Type, "Person"); }}- /// <summary>- /// Gets a value indicating whether this instance is root.- /// </summary>- /// <value><c>true</c> if this instance is root; otherwise, <c>false</c>.</value>- [IgnoreDataMember]- public bool IsRoot- {- get { return StringHelper.EqualsIgnoreCase(Type, "AggregateFolder"); }- }-[IgnoreDataMember]public bool IsMusicGenre{diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.csindex 5cf52e0efe..e2c6b0503a 100644--- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs+++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs@@ -48,15 +48,6 @@ namespace MediaBrowser.Model.LiveTvpublic bool ImportFavoritesOnly { get; set; }public bool AllowHWTranscoding { get; set; }public bool IsEnabled { get; set; }- public string M3UUrl { get; set; }- public string InfoUrl { get; set; }- public string FriendlyName { get; set; }- public int Tuners { get; set; }- public string DiseqC { get; set; }- public string SourceA { get; set; }- public string SourceB { get; set; }- public string SourceC { get; set; }- public string SourceD { get; set; }public bool EnableTvgId { get; set; }public TunerHostInfo()@@ -85,6 +76,7 @@ namespace MediaBrowser.Model.LiveTvpublic string[] MovieCategories { get; set; }public NameValuePair[] ChannelMappings { get; set; }public string MoviePrefix { get; set; }+ public bool EnableNewProgramIds { get; set; }public ListingsProviderInfo(){diff --git a/MediaBrowser.Server.Mono/MonoAppHost.cs b/MediaBrowser.Server.Mono/MonoAppHost.csindex 932e2d6cda..93ced11861 100644--- a/MediaBrowser.Server.Mono/MonoAppHost.cs+++ b/MediaBrowser.Server.Mono/MonoAppHost.cs@@ -26,63 +26,6 @@ namespace MediaBrowser.Server.Mono}}- public override bool CanSelfUpdate- {- get- {- return false;- }- }-- protected override FFMpegInstallInfo GetFfmpegInstallInfo()- {- var info = new FFMpegInstallInfo();-- // Windows builds: http://ffmpeg.zeranoe.com/builds/- // Linux builds: http://johnvansickle.com/ffmpeg/- // OS X builds: http://ffmpegmac.net/- // OS X x64: http://www.evermeet.cx/ffmpeg/-- var environment = (MonoEnvironmentInfo) EnvironmentInfo;-- if (environment.IsBsd)- {-- }- else if (environment.OperatingSystem == Model.System.OperatingSystem.Linux)- {- info.FFMpegFilename = "ffmpeg";- info.FFProbeFilename = "ffprobe";- info.ArchiveType = "7z";- info.Version = "20160215";- info.DownloadUrls = GetDownloadUrls();- }-- // No version available - user requirement- info.DownloadUrls = new string[] { };-- return info;- }-- private string[] GetDownloadUrls()- {- switch (EnvironmentInfo.SystemArchitecture)- {- case Architecture.X64:- return new[]- {- "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-64bit-static.7z"- };- case Architecture.X86:- return new[]- {- "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z"- };- }-- return new string[] { };- }-protected override void RestartInternal(){MainClass.Restart(StartupOptions);@@ -137,40 +80,5 @@ namespace MediaBrowser.Server.Monoreturn new Version(1, 0);}-- protected override void AuthorizeServer()- {- throw new NotImplementedException();- }-- protected override void ConfigureAutoRunInternal(bool autorun)- {- throw new NotImplementedException();- }-- protected override void EnableLoopbackInternal(string appName)- {- }-- public override bool SupportsRunningAsService- {- get- {- return false;- }- }-- public override bool SupportsAutoRunAtStartup- {- get { return false; }- }-- public override bool IsRunningAsService- {- get- {- return false;- }- }}}diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.csindex 0e3f684b52..c42cd0396e 100644--- a/MediaBrowser.ServerApplication/MainStartup.cs+++ b/MediaBrowser.ServerApplication/MainStartup.cs@@ -324,7 +324,7 @@ namespace MediaBrowser.ServerApplication/// <param name="options">The options.</param>private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, bool runService, StartupOptions options){- var fileSystem = new ManagedFileSystem(logManager.GetLogger("FileSystem"), true, true, true, appPaths.TempDirectory);+ var fileSystem = new ManagedFileSystem(logManager.GetLogger("FileSystem"), true, true, false, appPaths.TempDirectory);fileSystem.AddShortcutHandler(new LnkShortcutHandler());fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));diff --git a/MediaBrowser.ServerApplication/WindowsAppHost.cs b/MediaBrowser.ServerApplication/WindowsAppHost.csindex ec66923aaa..9d19525b4b 100644--- a/MediaBrowser.ServerApplication/WindowsAppHost.cs+++ b/MediaBrowser.ServerApplication/WindowsAppHost.cs@@ -27,38 +27,6 @@ namespace MediaBrowser.ServerApplicationget { return MainStartup.IsRunningAsService; }}- protected override FFMpegInstallInfo GetFfmpegInstallInfo()- {- var info = new FFMpegInstallInfo();-- info.FFMpegFilename = "ffmpeg.exe";- info.FFProbeFilename = "ffprobe.exe";- info.Version = "20160410";- info.ArchiveType = "7z";- info.DownloadUrls = GetDownloadUrls();-- return info;- }-- private string[] GetDownloadUrls()- {- switch (EnvironmentInfo.SystemArchitecture)- {- case Architecture.X64:- return new[]- {- "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win64.7z"- };- case Architecture.X86:- return new[]- {- "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win32.7z"- };- }-- return new string[] { };- }-protected override void RestartInternal(){MainStartup.Restart();@@ -94,7 +62,7 @@ namespace MediaBrowser.ServerApplicationprotected override void ConfigureAutoRunInternal(bool autorun){- var startupPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup);+ var startupPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Startup);if (autorun && !MainStartup.IsRunningAsService){@@ -121,14 +89,6 @@ namespace MediaBrowser.ServerApplication}}- protected override bool SupportsDualModeSockets- {- get- {- return true;- }- }-protected override void EnableLoopbackInternal(string appName){LoopUtil.Run(appName);@@ -150,14 +110,6 @@ namespace MediaBrowser.ServerApplication}}- public override bool SupportsAutoRunAtStartup- {- get- {- return true;- }- }-public override bool CanSelfUpdate{get@@ -165,61 +117,5 @@ namespace MediaBrowser.ServerApplicationreturn MainStartup.CanSelfUpdate;}}-- public bool PortsRequireAuthorization(string applicationPath)- {- var appNameSrch = Path.GetFileName(applicationPath);-- var startInfo = new ProcessStartInfo- {- FileName = "netsh",-- Arguments = "advfirewall firewall show rule \"" + appNameSrch + "\"",-- CreateNoWindow = true,- UseShellExecute = false,- WindowStyle = ProcessWindowStyle.Hidden,- ErrorDialog = false,- RedirectStandardOutput = true- };-- using (var process = Process.Start(startInfo))- {- process.Start();-- try- {- var data = process.StandardOutput.ReadToEnd() ?? string.Empty;-- if (data.IndexOf("Block", StringComparison.OrdinalIgnoreCase) != -1)- {- Logger.Info("Found potential windows firewall rule blocking Emby Server: " + data);- }-- //var parts = data.Split('\n');-- //return parts.Length > 4;- //return Confirm();- return false;- }- catch (Exception ex)- {- Logger.ErrorException("Error querying windows firewall", ex);-- // Hate having to do this- try- {- process.Kill();- }- catch (Exception ex1)- {- Logger.ErrorException("Error killing process", ex1);- }-- throw;- }- }- }-}}diff --git a/src/Emby.Server/Program.cs b/src/Emby.Server/Program.csindex fde2ab7b2e..5e55cfa290 100644--- a/src/Emby.Server/Program.cs+++ b/src/Emby.Server/Program.cs@@ -193,7 +193,7 @@ namespace Emby.Server/// <param name="options">The options.</param>private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, StartupOptions options, EnvironmentInfo environmentInfo){- var fileSystem = new ManagedFileSystem(logManager.GetLogger("FileSystem"), true, true, true, appPaths.TempDirectory);+ var fileSystem = new ManagedFileSystem(logManager.GetLogger("FileSystem"), true, true, false, appPaths.TempDirectory);fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));