aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/LiveTv
diff options
context:
space:
mode:
authorEric Reed <ebr@mediabrowser3.com>2016-02-26 10:10:49 -0500
committerEric Reed <ebr@mediabrowser3.com>2016-02-26 10:10:49 -0500
commitf70339dbeb2bf089d8c92e92564e55353b67f1c4 (patch)
tree0ad1130561249d01a55e61046d3beda2eee45ab1 /MediaBrowser.Server.Implementations/LiveTv
parent084bd47413f9ad3ca14501c1318dfe5cc97da919 (diff)
parent78f5152ddbf21fa5434af9831ec9909428ec9b79 (diff)
Merge branch 'dev' of https://github.com/MediaBrowser/Emby into dev
Diffstat (limited to 'MediaBrowser.Server.Implementations/LiveTv')
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs38
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs3
2 files changed, 32 insertions, 9 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index f0c7a34d9a..1fbd3cb3e5 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -300,17 +300,20 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
}
}
- try
- {
- _fileSystem.DeleteFile(remove.Path);
- }
- catch (DirectoryNotFoundException)
+ if (!string.IsNullOrWhiteSpace(remove.Path))
{
+ try
+ {
+ _fileSystem.DeleteFile(remove.Path);
+ }
+ catch (DirectoryNotFoundException)
+ {
- }
- catch (FileNotFoundException)
- {
+ }
+ catch (FileNotFoundException)
+ {
+ }
}
_recordingProvider.Delete(remove);
}
@@ -726,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");
@@ -859,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)
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs
index 92a33993a9..0a03e60fae 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs
@@ -90,7 +90,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
await _liveTvManager.SaveTunerHost(new TunerHostInfo
{
Type = HdHomerunHost.DeviceType,
- Url = url
+ Url = url,
+ DataVersion = 1
}).ConfigureAwait(false);
}