aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-02-25 23:09:42 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-02-25 23:09:42 -0500
commit2c3113ced75cfb95ccb11745069402b69eb16224 (patch)
tree34e4a4af9fdaf09e963c6089cb9ac7907de5d01d /MediaBrowser.Server.Implementations
parent1661c211528db1241974cb0efaf818d6d07a5d7d (diff)
add image download setting
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index ba3998262..1fbd3cb3e 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -729,6 +729,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
var recordingFileName = _fileSystem.GetValidFilename(RecordingHelper.GetRecordingName(timer, info)).Trim() + ".ts";
recordPath = Path.Combine(recordPath, recordingFileName);
+ recordPath = EnsureFileUnique(recordPath);
_fileSystem.CreateDirectory(Path.GetDirectoryName(recordPath));
var recordingId = info.Id.GetMD5().ToString("N");
@@ -862,6 +863,24 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
}
}
+ private string EnsureFileUnique(string path)
+ {
+ var originalPath = path;
+ var index = 1;
+
+ while (_fileSystem.FileExists(path))
+ {
+ var parent = Path.GetDirectoryName(originalPath);
+ var name = Path.GetFileNameWithoutExtension(originalPath);
+ name += "-" + index.ToString(CultureInfo.InvariantCulture);
+
+ path = Path.ChangeExtension(Path.Combine(parent, name), Path.GetExtension(originalPath));
+ index++;
+ }
+
+ return path;
+ }
+
private async Task<IRecorder> GetRecorder()
{
if (GetConfiguration().EnableRecordingEncoding)