Jelajahi Sumber

update recordings

Luke Pulverenti 9 tahun lalu
induk
melakukan
f6dcef0cfd

+ 5 - 3
MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs

@@ -1,6 +1,7 @@
 using MediaBrowser.Common;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.IO;
 using MediaBrowser.Common.Net;
 using MediaBrowser.Controller.Drawing;
 using MediaBrowser.Controller.LiveTv;
@@ -33,6 +34,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
         private readonly TimerManager _timerProvider;
 
         private readonly LiveTvManager _liveTvManager;
+        private IFileSystem _fileSystem;
 
         public static EmbyTV Current;
 
@@ -481,14 +483,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
             var recordPath = RecordingPath;
             if (info.IsMovie)
             {
-                recordPath = Path.Combine(recordPath, "Movies", RecordingHelper.RemoveSpecialCharacters(info.Name));
+                recordPath = Path.Combine(recordPath, "Movies", _fileSystem.GetValidFilename(info.Name));
             }
             else
             {
-                recordPath = Path.Combine(recordPath, "TV", RecordingHelper.RemoveSpecialCharacters(info.Name));
+                recordPath = Path.Combine(recordPath, "TV", _fileSystem.GetValidFilename(info.Name));
             }
 
-            recordPath = Path.Combine(recordPath, RecordingHelper.GetRecordingName(timer, info));
+            recordPath = Path.Combine(recordPath, _fileSystem.GetValidFilename(RecordingHelper.GetRecordingName(timer, info)));
             Directory.CreateDirectory(Path.GetDirectoryName(recordPath));
 
             var recording = _recordingProvider.GetAll().FirstOrDefault(x => string.Equals(x.ProgramId, info.Id, StringComparison.OrdinalIgnoreCase));

+ 2 - 16
MediaBrowser.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs

@@ -1,7 +1,6 @@
 using MediaBrowser.Common.Extensions;
 using MediaBrowser.Controller.LiveTv;
 using System;
-using System.Text;
 
 namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
 {
@@ -44,7 +43,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
             {
                 fancyName += "_(" + info.ProductionYear + ")";
             }
-            if (info.IsSeries)
+            if (info.IsSeries && !string.IsNullOrWhiteSpace(info.EpisodeTitle))
             {
                 fancyName += "_" + info.EpisodeTitle.Replace("Season: ", "S").Replace(" Episode: ", "E");
             }
@@ -56,20 +55,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
             {
                 fancyName += "_" + info.OriginalAirDate.Value.ToString("yyyy-MM-dd");
             }
-            return RemoveSpecialCharacters(fancyName) + ".ts";
-        }
-
-        public static string RemoveSpecialCharacters(string str)
-        {
-            StringBuilder sb = new StringBuilder();
-            foreach (char c in str)
-            {
-                if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '.' || c == '_' || c == '-' || c == ' ')
-                {
-                    sb.Append(c);
-                }
-            }
-            return sb.ToString();
+            return fancyName + ".ts";
         }
     }
 }