Browse Source

Merge pull request #1508 from MediaBrowser/dev

Dev
Luke 9 years ago
parent
commit
3e0a218076

+ 2 - 0
MediaBrowser.Api/Playback/Progressive/VideoService.cs

@@ -36,6 +36,7 @@ namespace MediaBrowser.Api.Playback.Progressive
     [Route("/Videos/{Id}/stream.wmv", "GET")]
     [Route("/Videos/{Id}/stream.wtv", "GET")]
     [Route("/Videos/{Id}/stream.mov", "GET")]
+    [Route("/Videos/{Id}/stream.iso", "GET")]
     [Route("/Videos/{Id}/stream", "GET")]
     [Route("/Videos/{Id}/stream.ts", "HEAD")]
     [Route("/Videos/{Id}/stream.webm", "HEAD")]
@@ -53,6 +54,7 @@ namespace MediaBrowser.Api.Playback.Progressive
     [Route("/Videos/{Id}/stream.wtv", "HEAD")]
     [Route("/Videos/{Id}/stream.m2ts", "HEAD")]
     [Route("/Videos/{Id}/stream.mov", "HEAD")]
+    [Route("/Videos/{Id}/stream.iso", "HEAD")]
     [Route("/Videos/{Id}/stream", "HEAD")]
     [Api(Description = "Gets a video stream")]
     public class GetVideoStream : VideoStreamRequest

+ 20 - 2
MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs

@@ -6,6 +6,7 @@ using ServiceStack;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using MediaBrowser.Controller.Configuration;
 
 namespace MediaBrowser.Api.ScheduledTasks
 {
@@ -90,12 +91,14 @@ namespace MediaBrowser.Api.ScheduledTasks
         /// <value>The task manager.</value>
         private ITaskManager TaskManager { get; set; }
 
+        private readonly IServerConfigurationManager _config;
+
         /// <summary>
         /// Initializes a new instance of the <see cref="ScheduledTaskService" /> class.
         /// </summary>
         /// <param name="taskManager">The task manager.</param>
-        /// <exception cref="System.ArgumentNullException">taskManager</exception>
-        public ScheduledTaskService(ITaskManager taskManager)
+        /// <exception cref="ArgumentNullException">taskManager</exception>
+        public ScheduledTaskService(ITaskManager taskManager, IServerConfigurationManager config)
         {
             if (taskManager == null)
             {
@@ -103,6 +106,7 @@ namespace MediaBrowser.Api.ScheduledTasks
             }
 
             TaskManager = taskManager;
+            _config = config;
         }
 
         /// <summary>
@@ -194,6 +198,20 @@ namespace MediaBrowser.Api.ScheduledTasks
                 throw new ResourceNotFoundException("Task not found");
             }
 
+            var hasKey = task.ScheduledTask as IHasKey;
+            if (hasKey != null)
+            {
+                if (string.Equals(hasKey.Key, "SystemUpdateTask", StringComparison.OrdinalIgnoreCase))
+                {
+                    // This is a hack for now just to get the update application function to work when auto-update is disabled
+                    if (!_config.Configuration.EnableAutoUpdate)
+                    {
+                        _config.Configuration.EnableAutoUpdate = true;
+                        _config.SaveConfiguration();
+                    }
+                }
+            }
+
             TaskManager.Execute(task);
         }
 

+ 2 - 1
MediaBrowser.Controller/Providers/DirectoryService.cs

@@ -63,7 +63,8 @@ namespace MediaBrowser.Controller.Providers
                 try
                 {
                     // using EnumerateFileSystemInfos doesn't handle reparse points (symlinks)
-					var list = _fileSystem.GetFileSystemEntries(path);
+					var list = _fileSystem.GetFileSystemEntries(path)
+                        .ToList();
 
                     // Seeing dupes on some users file system for some reason
                     foreach (var item in list)

+ 17 - 4
MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs

@@ -286,16 +286,29 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
             {
                 if (options.TvOptions.CopyOriginalFile && fileExists && IsSameEpisode(sourcePath, newPath))
                 {
-                    _logger.Info("File {0} already copied to new path {1}, stopping organization", sourcePath, newPath);
+                    var msg = string.Format("File '{0}' already copied to new path '{1}', stopping organization", sourcePath, newPath);
+                    _logger.Info(msg);
                     result.Status = FileSortingStatus.SkippedExisting;
-                    result.StatusMessage = string.Empty;
+                    result.StatusMessage = msg;
+                    return;
+                }
+
+                if (fileExists)
+                {
+                    var msg = string.Format("File '{0}' already exists as '{1}', stopping organization", sourcePath, newPath);
+                    _logger.Info(msg);
+                    result.Status = FileSortingStatus.SkippedExisting;
+                    result.StatusMessage = msg;
+                    result.TargetPath = newPath;
                     return;
                 }
 
-                if (fileExists || otherDuplicatePaths.Count > 0)
+                if (otherDuplicatePaths.Count > 0)
                 {
+                    var msg = string.Format("File '{0}' already exists as '{1}', stopping organization", sourcePath, otherDuplicatePaths);
+                    _logger.Info(msg);
                     result.Status = FileSortingStatus.SkippedExisting;
-                    result.StatusMessage = string.Empty;
+                    result.StatusMessage = msg;
                     result.DuplicatePaths = otherDuplicatePaths;
                     return;
                 }

+ 1 - 1
MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs

@@ -778,7 +778,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
                 try
                 {
                     // HDHR doesn't seem to release the tuner right away after first probing with ffmpeg
-                    await Task.Delay(3000, cancellationToken).ConfigureAwait(false);
+                    //await Task.Delay(3000, cancellationToken).ConfigureAwait(false);
 
                     var duration = recordingEndDate - DateTime.UtcNow;
 

+ 2 - 2
MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs

@@ -88,11 +88,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
             // MUST read both stdout and stderr asynchronously or a deadlock may occurr
             process.BeginOutputReadLine();
 
+            onStarted();
+
             // Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
             StartStreamingLog(process.StandardError.BaseStream, _logFileStream);
 
-            onStarted();
-
             // Wait for the file to exist before proceeeding
             while (!_hasExited)
             {

+ 16 - 15
MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs

@@ -96,30 +96,19 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
 
         private async Task<string> GetModelInfo(TunerHostInfo info, CancellationToken cancellationToken)
         {
-            string model = null;
-
             using (var stream = await _httpClient.Get(new HttpRequestOptions()
             {
-                Url = string.Format("{0}/", GetApiUrl(info, false)),
+                Url = string.Format("{0}/discover.json", GetApiUrl(info, false)),
                 CancellationToken = cancellationToken,
                 CacheLength = TimeSpan.FromDays(1),
                 CacheMode = CacheMode.Unconditional,
                 TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds)
             }))
             {
-                using (var sr = new StreamReader(stream, System.Text.Encoding.UTF8))
-                {
-                    while (!sr.EndOfStream)
-                    {
-                        string line = StripXML(sr.ReadLine());
-                        if (line.StartsWith("Model:")) { model = line.Replace("Model: ", ""); }
-                        //if (line.StartsWith("Device ID:")) { deviceID = line.Replace("Device ID: ", ""); }
-                        //if (line.StartsWith("Firmware:")) { firmware = line.Replace("Firmware: ", ""); }
-                    }
-                }
-            }
+                var response = JsonSerializer.DeserializeFromStream<DiscoverResponse>(stream);
 
-            return model;
+                return response.ModelNumber;
+            }
         }
 
         public async Task<List<LiveTvTunerInfo>> GetTunerInfos(TunerHostInfo info, CancellationToken cancellationToken)
@@ -438,5 +427,17 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
 
             return info.Any(i => i.Status == LiveTvTunerStatus.Available);
         }
+
+        public class DiscoverResponse
+        {
+            public string FriendlyName { get; set; }
+            public string ModelNumber { get; set; }
+            public string FirmwareName { get; set; }
+            public string FirmwareVersion { get; set; }
+            public string DeviceID { get; set; }
+            public string DeviceAuth { get; set; }
+            public string BaseURL { get; set; }
+            public string LineupURL { get; set; }
+        }
     }
 }