parent
6b533ef2f9
commit
1ae0dc81f7
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Extras.Files
|
namespace NzbDrone.Core.Extras.Files
|
||||||
|
@ -12,5 +12,10 @@ namespace NzbDrone.Core.Extras.Files
|
||||||
public DateTime Added { get; set; }
|
public DateTime Added { get; set; }
|
||||||
public DateTime LastUpdated { get; set; }
|
public DateTime LastUpdated { get; set; }
|
||||||
public string Extension { get; set; }
|
public string Extension { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"[{Id}] {RelativePath}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -86,6 +86,8 @@ namespace NzbDrone.Core.Extras.Files
|
||||||
|
|
||||||
protected TExtraFile MoveFile(Series series, EpisodeFile episodeFile, TExtraFile extraFile, string fileNameSuffix = null)
|
protected TExtraFile MoveFile(Series series, EpisodeFile episodeFile, TExtraFile extraFile, string fileNameSuffix = null)
|
||||||
{
|
{
|
||||||
|
_logger.Trace("Renaming extra file: {0}", extraFile);
|
||||||
|
|
||||||
var newFolder = Path.GetDirectoryName(Path.Combine(series.Path, episodeFile.RelativePath));
|
var newFolder = Path.GetDirectoryName(Path.Combine(series.Path, episodeFile.RelativePath));
|
||||||
var filenameBuilder = new StringBuilder(Path.GetFileNameWithoutExtension(episodeFile.RelativePath));
|
var filenameBuilder = new StringBuilder(Path.GetFileNameWithoutExtension(episodeFile.RelativePath));
|
||||||
|
|
||||||
|
@ -103,9 +105,13 @@ namespace NzbDrone.Core.Extras.Files
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
_logger.Trace("Renaming extra file: {0} to {1}", extraFile, newFileName);
|
||||||
|
|
||||||
_diskProvider.MoveFile(existingFileName, newFileName);
|
_diskProvider.MoveFile(existingFileName, newFileName);
|
||||||
extraFile.RelativePath = series.Path.GetRelativePath(newFileName);
|
extraFile.RelativePath = series.Path.GetRelativePath(newFileName);
|
||||||
|
|
||||||
|
_logger.Trace("Renamed extra file from: {0}", extraFile);
|
||||||
|
|
||||||
return extraFile;
|
return extraFile;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Core.Extras.Files;
|
using NzbDrone.Core.Extras.Files;
|
||||||
using NzbDrone.Core.Languages;
|
using NzbDrone.Core.Languages;
|
||||||
|
|
||||||
|
@ -18,5 +18,10 @@ namespace NzbDrone.Core.Extras.Subtitles
|
||||||
public List<string> LanguageTags { get; set; }
|
public List<string> LanguageTags { get; set; }
|
||||||
|
|
||||||
private string LanguageTagsAsString => string.Join(".", LanguageTags);
|
private string LanguageTagsAsString => string.Join(".", LanguageTags);
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"[{Id}] {RelativePath} ({Language}{(LanguageTags.Count > 0 ? "." : "")}{LanguageTagsAsString}{Extension})";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,7 @@ namespace NzbDrone.Core.Extras.Subtitles
|
||||||
foreach (var subtitleFile in group)
|
foreach (var subtitleFile in group)
|
||||||
{
|
{
|
||||||
var suffix = GetSuffix(subtitleFile.Language, copy, subtitleFile.LanguageTags, groupCount > 1);
|
var suffix = GetSuffix(subtitleFile.Language, copy, subtitleFile.LanguageTags, groupCount > 1);
|
||||||
|
|
||||||
movedFiles.AddIfNotNull(MoveFile(series, episodeFile, subtitleFile, suffix));
|
movedFiles.AddIfNotNull(MoveFile(series, episodeFile, subtitleFile, suffix));
|
||||||
|
|
||||||
copy++;
|
copy++;
|
||||||
|
|
Loading…
Reference in New Issue