Browse Source

fix mapping multiple tuner channels to same epg channel

Luke Pulverenti 8 years ago
parent
commit
0ee1a0d7bd
27 changed files with 170 additions and 446 deletions
  1. 7 1
      Emby.Common.Implementations/BaseApplicationHost.cs
  2. 1 1
      Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
  3. 109 8
      Emby.Server.Core/ApplicationHost.cs
  4. 2 1
      Emby.Server.Implementations/Data/SqliteItemRepository.cs
  5. 2 2
      Emby.Server.Implementations/Dto/DtoService.cs
  6. 5 0
      Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
  7. 1 7
      Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
  8. 3 1
      Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
  9. 4 7
      Emby.Server.Implementations/LiveTv/LiveTvManager.cs
  10. 8 8
      Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
  11. 1 3
      Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs
  12. 12 1
      MediaBrowser.Api/ItemUpdateService.cs
  13. 0 4
      MediaBrowser.Api/MediaBrowser.Api.csproj
  14. 0 1
      MediaBrowser.Api/Playback/BaseStreamingService.cs
  15. 1 1
      MediaBrowser.Api/Playback/StreamState.cs
  16. 4 4
      MediaBrowser.Api/Playback/UniversalAudioService.cs
  17. 2 2
      MediaBrowser.Api/Sync/SyncHelper.cs
  18. 2 0
      MediaBrowser.Controller/MediaBrowser.Controller.csproj
  19. 1 7
      MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
  20. 1 5
      MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
  21. 0 2
      MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj
  22. 0 172
      MediaBrowser.Model/Dto/BaseItemDto.cs
  23. 1 9
      MediaBrowser.Model/LiveTv/LiveTvOptions.cs
  24. 0 92
      MediaBrowser.Server.Mono/MonoAppHost.cs
  25. 1 1
      MediaBrowser.ServerApplication/MainStartup.cs
  26. 1 105
      MediaBrowser.ServerApplication/WindowsAppHost.cs
  27. 1 1
      src/Emby.Server/Program.cs

+ 7 - 1
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.

+ 1 - 1
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;
 

+ 109 - 8
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.Core
             await ((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.Core
             return 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.Core
             EnableLoopbackInternal(appName);
         }
 
-        protected abstract void EnableLoopbackInternal(string appName);
+        protected virtual void EnableLoopbackInternal(string appName)
+        {
+            
+        }
 
         private void RegisterModules()
         {

+ 2 - 1
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))
             {

+ 2 - 2
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 SeasonInfo

+ 5 - 0
Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs

@@ -986,6 +986,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
                 foreach (var program in programs)
                 {
                     program.ChannelId = channelId;
+
+                    if (provider.Item2.EnableNewProgramIds)
+                    {
+                        program.Id += "_" + channelId;
+                    }
                 }
 
                 if (programs.Count > 0)

+ 1 - 7
Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs

@@ -81,12 +81,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
                 return 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.Listings
                         programDetails.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)

+ 3 - 1
Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs

@@ -168,7 +168,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
                 EpisodeNumber = 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.Listings
                 programInfo.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;

+ 4 - 7
Emby.Server.Implementations/LiveTv/LiveTvManager.cs

@@ -598,10 +598,6 @@ namespace Emby.Server.Implementations.LiveTv
             item.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.LiveTv
                     var 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.LiveTv
                 double 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
             {

+ 8 - 8
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.HdHomerun
             return 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.HdHomerun
                 CancellationToken = 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.HdHomerun
                     CacheMode = 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.HdHomerun
                 CancellationToken = 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.HdHomerun
                     Url = string.Format("{0}/discover.json", GetApiUrl(info, false)),
                     CancellationToken = CancellationToken.None,
                     BufferContent = false
-                }))
+
+                }).ConfigureAwait(false))
                 {
                     var response = JsonSerializer.DeserializeFromStream<DiscoverResponse>(stream);
 

+ 1 - 3
Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs

@@ -74,10 +74,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
                 OnFinished = OnFinished
             };
 
-            var initial = _sharedBuffer.ToList();
             var list = new List<byte>();
-
-            foreach (var bytes in initial)
+            foreach (var bytes in _sharedBuffer)
             {
                 list.AddRange(bytes);
             }

+ 12 - 1
MediaBrowser.Api/ItemUpdateService.cs

@@ -401,10 +401,21 @@ namespace MediaBrowser.Api
             var 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);
+
+        }
     }
 }

+ 0 - 4
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>

+ 0 - 1
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.Playback

+ 1 - 1
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
 {

+ 4 - 4
MediaBrowser.Api/Playback/UniversalAudioService.cs

@@ -199,9 +199,9 @@ namespace MediaBrowser.Api.Playback
 
                 if (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.Playback
 
                 if (isHeadRequest)
                 {
-                    return service.Head(newRequest);
+                    return await service.Head(newRequest).ConfigureAwait(false);
                 }
-                return service.Get(newRequest);
+                return await service.Get(newRequest).ConfigureAwait(false);
             }
         }
     }

+ 2 - 2
MediaBrowser.Api/Sync/SyncHelper.cs

@@ -37,7 +37,7 @@ namespace MediaBrowser.Api.Sync
                         options.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);

+ 2 - 0
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" />

+ 1 - 7
MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs → 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
     {

+ 1 - 5
MediaBrowser.MediaEncoding/Encoder/EncodingJobInfo.cs → 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 unified
     public class EncodingJobInfo

+ 0 - 2
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" />

+ 0 - 172
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.Dto
             return 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.Dto
             get { 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.Dto
             get { 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
         {

+ 1 - 9
MediaBrowser.Model/LiveTv/LiveTvOptions.cs

@@ -48,15 +48,6 @@ namespace MediaBrowser.Model.LiveTv
         public 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.LiveTv
         public string[] MovieCategories { get; set; }
         public NameValuePair[] ChannelMappings { get; set; }
         public string MoviePrefix { get; set; }
+        public bool EnableNewProgramIds { get; set; }
 
         public ListingsProviderInfo()
         {

+ 0 - 92
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.Mono
 
             return 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;
-            }
-        }
     }
 }

+ 1 - 1
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));
 

+ 1 - 105
MediaBrowser.ServerApplication/WindowsAppHost.cs

@@ -27,38 +27,6 @@ namespace MediaBrowser.ServerApplication
             get { 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.ServerApplication
 
         protected 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.ServerApplication
                 return 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;
-                }
-            }
-        }
-
     }
 }

+ 1 - 1
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));