mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 14:08:44 -04:00
Apply suggestions from code review
Co-authored-by: BaronGreenback <jimcartlidge@yahoo.co.uk>
This commit is contained in:
parent
195a6261c4
commit
496923719c
2 changed files with 5 additions and 5 deletions
|
@ -33,7 +33,7 @@ namespace Emby.Naming.AudioBook
|
||||||
{
|
{
|
||||||
var audioBookResolver = new AudioBookResolver(_options);
|
var audioBookResolver = new AudioBookResolver(_options);
|
||||||
|
|
||||||
// File with empty fullname will be sorted out here
|
// File with empty fullname will be sorted out here.
|
||||||
var audiobookFileInfos = files
|
var audiobookFileInfos = files
|
||||||
.Select(i => audioBookResolver.Resolve(i.FullName))
|
.Select(i => audioBookResolver.Resolve(i.FullName))
|
||||||
.OfType<AudioBookFileInfo>()
|
.OfType<AudioBookFileInfo>()
|
||||||
|
@ -139,8 +139,8 @@ namespace Emby.Naming.AudioBook
|
||||||
|
|
||||||
private AudioBookFileInfo FindMainAudioBookFile(List<AudioBookFileInfo> files, string name)
|
private AudioBookFileInfo FindMainAudioBookFile(List<AudioBookFileInfo> files, string name)
|
||||||
{
|
{
|
||||||
var main = files.Find(x => Path.GetFileNameWithoutExtension(x.Path) == name);
|
var main = files.Find(x => Path.GetFileNameWithoutExtension(x.Path).Equals(name));
|
||||||
main ??= files.FirstOrDefault(x => Path.GetFileNameWithoutExtension(x.Path) == "audiobook");
|
main ??= files.FirstOrDefault(x => Path.GetFileNameWithoutExtension(x.Path).Equals("audiobook"));
|
||||||
main ??= files.OrderBy(x => x.Container)
|
main ??= files.OrderBy(x => x.Container)
|
||||||
.ThenBy(x => x.Path)
|
.ThenBy(x => x.Path)
|
||||||
.First();
|
.First();
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace Emby.Naming.Video
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there's only one video, accept all trailers
|
// If there's only one video, accept all trailers
|
||||||
// Be lenient because people use all kinds of mishmash conventions with trailers
|
// Be lenient because people use all kinds of mishmash conventions with trailers.
|
||||||
if (list.Count == 1)
|
if (list.Count == 1)
|
||||||
{
|
{
|
||||||
var trailers = remainingFiles
|
var trailers = remainingFiles
|
||||||
|
@ -231,7 +231,7 @@ 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] == '-'
|
||||||
|| testFilename[0] == '_'
|
|| testFilename[0].Equals( '_')
|
||||||
|| string.IsNullOrWhiteSpace(Regex.Replace(testFilename, @"\[([^]]*)\]", string.Empty));
|
|| string.IsNullOrWhiteSpace(Regex.Replace(testFilename, @"\[([^]]*)\]", string.Empty));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue