update recordings

This commit is contained in:
Luke Pulverenti 2015-08-15 20:41:55 -04:00
parent e376c31436
commit f6dcef0cfd
2 changed files with 7 additions and 19 deletions

View file

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

View file

@ -1,7 +1,6 @@
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.LiveTv;
using System; using System;
using System.Text;
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{ {
@ -44,7 +43,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{ {
fancyName += "_(" + info.ProductionYear + ")"; fancyName += "_(" + info.ProductionYear + ")";
} }
if (info.IsSeries) if (info.IsSeries && !string.IsNullOrWhiteSpace(info.EpisodeTitle))
{ {
fancyName += "_" + info.EpisodeTitle.Replace("Season: ", "S").Replace(" Episode: ", "E"); 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"); fancyName += "_" + info.OriginalAirDate.Value.ToString("yyyy-MM-dd");
} }
return RemoveSpecialCharacters(fancyName) + ".ts"; return 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();
} }
} }
} }