mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge pull request #2667 from crobibero/emby-naming-warnings
Fix warnings in Emby.Naming
This commit is contained in:
commit
bd4269cb59
@ -37,7 +37,7 @@ namespace Emby.Naming.AudioBook
|
|||||||
/// <value>The type.</value>
|
/// <value>The type.</value>
|
||||||
public bool IsDirectory { get; set; }
|
public bool IsDirectory { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc />
|
||||||
public int CompareTo(AudioBookFileInfo other)
|
public int CompareTo(AudioBookFileInfo other)
|
||||||
{
|
{
|
||||||
if (ReferenceEquals(this, other))
|
if (ReferenceEquals(this, other))
|
||||||
|
@ -29,11 +29,7 @@ namespace Emby.Naming.AudioBook
|
|||||||
// Filter out all extras, otherwise they could cause stacks to not be resolved
|
// Filter out all extras, otherwise they could cause stacks to not be resolved
|
||||||
// See the unit test TestStackedWithTrailer
|
// See the unit test TestStackedWithTrailer
|
||||||
var metadata = audiobookFileInfos
|
var metadata = audiobookFileInfos
|
||||||
.Select(i => new FileSystemMetadata
|
.Select(i => new FileSystemMetadata { FullName = i.Path, IsDirectory = i.IsDirectory });
|
||||||
{
|
|
||||||
FullName = i.Path,
|
|
||||||
IsDirectory = i.IsDirectory
|
|
||||||
});
|
|
||||||
|
|
||||||
var stackResult = new StackResolver(_options)
|
var stackResult = new StackResolver(_options)
|
||||||
.ResolveAudioBooks(metadata);
|
.ResolveAudioBooks(metadata);
|
||||||
@ -42,11 +38,7 @@ namespace Emby.Naming.AudioBook
|
|||||||
{
|
{
|
||||||
var stackFiles = stack.Files.Select(i => audioBookResolver.Resolve(i, stack.IsDirectoryStack)).ToList();
|
var stackFiles = stack.Files.Select(i => audioBookResolver.Resolve(i, stack.IsDirectoryStack)).ToList();
|
||||||
stackFiles.Sort();
|
stackFiles.Sort();
|
||||||
var info = new AudioBookInfo
|
var info = new AudioBookInfo { Files = stackFiles, Name = stack.Name };
|
||||||
{
|
|
||||||
Files = stackFiles,
|
|
||||||
Name = stack.Name
|
|
||||||
};
|
|
||||||
|
|
||||||
yield return info;
|
yield return info;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,8 @@ namespace Emby.Naming.Subtitles
|
|||||||
IsForced = _options.SubtitleForcedFlags.Any(i => flags.Contains(i, StringComparer.OrdinalIgnoreCase))
|
IsForced = _options.SubtitleForcedFlags.Any(i => flags.Contains(i, StringComparer.OrdinalIgnoreCase))
|
||||||
};
|
};
|
||||||
|
|
||||||
var parts = flags.Where(i => !_options.SubtitleDefaultFlags.Contains(i, StringComparer.OrdinalIgnoreCase) && !_options.SubtitleForcedFlags.Contains(i, StringComparer.OrdinalIgnoreCase))
|
var parts = flags.Where(i => !_options.SubtitleDefaultFlags.Contains(i, StringComparer.OrdinalIgnoreCase)
|
||||||
|
&& !_options.SubtitleForcedFlags.Contains(i, StringComparer.OrdinalIgnoreCase))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// Should have a name, language and file extension
|
// Should have a name, language and file extension
|
||||||
|
@ -18,7 +18,13 @@ namespace Emby.Naming.TV
|
|||||||
_options = options;
|
_options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EpisodePathParserResult Parse(string path, bool isDirectory, bool? isNamed = null, bool? isOptimistic = null, bool? supportsAbsoluteNumbers = null, bool fillExtendedInfo = true)
|
public EpisodePathParserResult Parse(
|
||||||
|
string path,
|
||||||
|
bool isDirectory,
|
||||||
|
bool? isNamed = null,
|
||||||
|
bool? isOptimistic = null,
|
||||||
|
bool? supportsAbsoluteNumbers = null,
|
||||||
|
bool fillExtendedInfo = true)
|
||||||
{
|
{
|
||||||
// Added to be able to use regex patterns which require a file extension.
|
// Added to be able to use regex patterns which require a file extension.
|
||||||
// There were no failed tests without this block, but to be safe, we can keep it until
|
// There were no failed tests without this block, but to be safe, we can keep it until
|
||||||
@ -64,7 +70,7 @@ namespace Emby.Naming.TV
|
|||||||
{
|
{
|
||||||
result.SeriesName = result.SeriesName
|
result.SeriesName = result.SeriesName
|
||||||
.Trim()
|
.Trim()
|
||||||
.Trim(new[] { '_', '.', '-' })
|
.Trim('_', '.', '-')
|
||||||
.Trim();
|
.Trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace Emby.Naming.TV
|
|||||||
public int? SeasonNumber { get; set; }
|
public int? SeasonNumber { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether this <see cref="SeasonPathParserResult"/> is success.
|
/// Gets or sets a value indicating whether this <see cref="SeasonPathParserResult" /> is success.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if success; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if success; otherwise, <c>false</c>.</value>
|
||||||
public bool Success { get; set; }
|
public bool Success { get; set; }
|
||||||
|
@ -21,31 +21,24 @@ namespace Emby.Naming.Video
|
|||||||
|
|
||||||
public IEnumerable<FileStack> ResolveDirectories(IEnumerable<string> files)
|
public IEnumerable<FileStack> ResolveDirectories(IEnumerable<string> files)
|
||||||
{
|
{
|
||||||
return Resolve(files.Select(i => new FileSystemMetadata
|
return Resolve(files.Select(i => new FileSystemMetadata { FullName = i, IsDirectory = true }));
|
||||||
{
|
|
||||||
FullName = i,
|
|
||||||
IsDirectory = true
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<FileStack> ResolveFiles(IEnumerable<string> files)
|
public IEnumerable<FileStack> ResolveFiles(IEnumerable<string> files)
|
||||||
{
|
{
|
||||||
return Resolve(files.Select(i => new FileSystemMetadata
|
return Resolve(files.Select(i => new FileSystemMetadata { FullName = i, IsDirectory = false }));
|
||||||
{
|
|
||||||
FullName = i,
|
|
||||||
IsDirectory = false
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<FileStack> ResolveAudioBooks(IEnumerable<FileSystemMetadata> files)
|
public IEnumerable<FileStack> ResolveAudioBooks(IEnumerable<FileSystemMetadata> files)
|
||||||
{
|
{
|
||||||
foreach (var directory in files.GroupBy(file => file.IsDirectory ? file.FullName : Path.GetDirectoryName(file.FullName)))
|
var groupedDirectoryFiles = files.GroupBy(file =>
|
||||||
|
file.IsDirectory
|
||||||
|
? file.FullName
|
||||||
|
: Path.GetDirectoryName(file.FullName));
|
||||||
|
|
||||||
|
foreach (var directory in groupedDirectoryFiles)
|
||||||
{
|
{
|
||||||
var stack = new FileStack()
|
var stack = new FileStack { Name = Path.GetFileName(directory.Key), IsDirectoryStack = false };
|
||||||
{
|
|
||||||
Name = Path.GetFileName(directory.Key),
|
|
||||||
IsDirectoryStack = false
|
|
||||||
};
|
|
||||||
foreach (var file in directory)
|
foreach (var file in directory)
|
||||||
{
|
{
|
||||||
if (file.IsDirectory)
|
if (file.IsDirectory)
|
||||||
|
@ -77,7 +77,9 @@ namespace Emby.Naming.Video
|
|||||||
/// Gets the file name without extension.
|
/// Gets the file name without extension.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The file name without extension.</value>
|
/// <value>The file name without extension.</value>
|
||||||
public string FileNameWithoutExtension => !IsDirectory ? System.IO.Path.GetFileNameWithoutExtension(Path) : System.IO.Path.GetFileName(Path);
|
public string FileNameWithoutExtension => !IsDirectory
|
||||||
|
? System.IO.Path.GetFileNameWithoutExtension(Path)
|
||||||
|
: System.IO.Path.GetFileName(Path);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
@ -33,11 +33,7 @@ namespace Emby.Naming.Video
|
|||||||
// See the unit test TestStackedWithTrailer
|
// See the unit test TestStackedWithTrailer
|
||||||
var nonExtras = videoInfos
|
var nonExtras = videoInfos
|
||||||
.Where(i => i.ExtraType == null)
|
.Where(i => i.ExtraType == null)
|
||||||
.Select(i => new FileSystemMetadata
|
.Select(i => new FileSystemMetadata { FullName = i.Path, IsDirectory = i.IsDirectory });
|
||||||
{
|
|
||||||
FullName = i.Path,
|
|
||||||
IsDirectory = i.IsDirectory
|
|
||||||
});
|
|
||||||
|
|
||||||
var stackResult = new StackResolver(_options)
|
var stackResult = new StackResolver(_options)
|
||||||
.Resolve(nonExtras).ToList();
|
.Resolve(nonExtras).ToList();
|
||||||
@ -57,11 +53,7 @@ namespace Emby.Naming.Video
|
|||||||
|
|
||||||
info.Year = info.Files[0].Year;
|
info.Year = info.Files[0].Year;
|
||||||
|
|
||||||
var extraBaseNames = new List<string>
|
var extraBaseNames = new List<string> { stack.Name, Path.GetFileNameWithoutExtension(stack.Files[0]) };
|
||||||
{
|
|
||||||
stack.Name,
|
|
||||||
Path.GetFileNameWithoutExtension(stack.Files[0])
|
|
||||||
};
|
|
||||||
|
|
||||||
var extras = GetExtras(remainingFiles, extraBaseNames);
|
var extras = GetExtras(remainingFiles, extraBaseNames);
|
||||||
|
|
||||||
@ -83,10 +75,7 @@ namespace Emby.Naming.Video
|
|||||||
|
|
||||||
foreach (var media in standaloneMedia)
|
foreach (var media in standaloneMedia)
|
||||||
{
|
{
|
||||||
var info = new VideoInfo(media.Name)
|
var info = new VideoInfo(media.Name) { Files = new List<VideoFileInfo> { media } };
|
||||||
{
|
|
||||||
Files = new List<VideoFileInfo> { media }
|
|
||||||
};
|
|
||||||
|
|
||||||
info.Year = info.Files[0].Year;
|
info.Year = info.Files[0].Year;
|
||||||
|
|
||||||
@ -222,8 +211,8 @@ namespace Emby.Naming.Video
|
|||||||
{
|
{
|
||||||
testFilename = testFilename.Substring(folderName.Length).Trim();
|
testFilename = testFilename.Substring(folderName.Length).Trim();
|
||||||
return string.IsNullOrEmpty(testFilename)
|
return string.IsNullOrEmpty(testFilename)
|
||||||
|| testFilename[0] == '-'
|
|| testFilename[0] == '-'
|
||||||
|| string.IsNullOrWhiteSpace(Regex.Replace(testFilename, @"\[([^]]*)\]", string.Empty));
|
|| string.IsNullOrWhiteSpace(Regex.Replace(testFilename, @"\[([^]]*)\]", string.Empty));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -239,7 +228,8 @@ namespace Emby.Naming.Video
|
|||||||
|
|
||||||
return remainingFiles
|
return remainingFiles
|
||||||
.Where(i => i.ExtraType == null)
|
.Where(i => i.ExtraType == null)
|
||||||
.Where(i => baseNames.Any(b => i.FileNameWithoutExtension.StartsWith(b, StringComparison.OrdinalIgnoreCase)))
|
.Where(i => baseNames.Any(b =>
|
||||||
|
i.FileNameWithoutExtension.StartsWith(b, StringComparison.OrdinalIgnoreCase)))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ namespace MediaBrowser.Model.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The image path.</value>
|
/// <value>The image path.</value>
|
||||||
public string ImagePath { get; set; }
|
public string ImagePath { get; set; }
|
||||||
|
|
||||||
public DateTime ImageDateModified { get; set; }
|
public DateTime ImageDateModified { get; set; }
|
||||||
|
|
||||||
public string ImageTag { get; set; }
|
public string ImageTag { get; set; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user