|
|
|
@ -17,6 +17,7 @@ namespace ErsatzTV.Scanner.Core.Metadata; |
|
|
|
public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScanner |
|
|
|
public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScanner |
|
|
|
{ |
|
|
|
{ |
|
|
|
private readonly IClient _client; |
|
|
|
private readonly IClient _client; |
|
|
|
|
|
|
|
private readonly IFallbackMetadataProvider _fallbackMetadataProvider; |
|
|
|
private readonly ILibraryRepository _libraryRepository; |
|
|
|
private readonly ILibraryRepository _libraryRepository; |
|
|
|
private readonly ILocalFileSystem _localFileSystem; |
|
|
|
private readonly ILocalFileSystem _localFileSystem; |
|
|
|
private readonly ILocalMetadataProvider _localMetadataProvider; |
|
|
|
private readonly ILocalMetadataProvider _localMetadataProvider; |
|
|
|
@ -40,6 +41,7 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan |
|
|
|
IFFmpegPngService ffmpegPngService, |
|
|
|
IFFmpegPngService ffmpegPngService, |
|
|
|
ITempFilePool tempFilePool, |
|
|
|
ITempFilePool tempFilePool, |
|
|
|
IClient client, |
|
|
|
IClient client, |
|
|
|
|
|
|
|
IFallbackMetadataProvider fallbackMetadataProvider, |
|
|
|
ILogger<TelevisionFolderScanner> logger) : base( |
|
|
|
ILogger<TelevisionFolderScanner> logger) : base( |
|
|
|
localFileSystem, |
|
|
|
localFileSystem, |
|
|
|
localStatisticsProvider, |
|
|
|
localStatisticsProvider, |
|
|
|
@ -59,6 +61,7 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan |
|
|
|
_libraryRepository = libraryRepository; |
|
|
|
_libraryRepository = libraryRepository; |
|
|
|
_mediator = mediator; |
|
|
|
_mediator = mediator; |
|
|
|
_client = client; |
|
|
|
_client = client; |
|
|
|
|
|
|
|
_fallbackMetadataProvider = fallbackMetadataProvider; |
|
|
|
_logger = logger; |
|
|
|
_logger = logger; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -228,7 +231,7 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Option<int> maybeSeasonNumber = SeasonNumberForFolder(seasonFolder); |
|
|
|
Option<int> maybeSeasonNumber = _fallbackMetadataProvider.GetSeasonNumberForFolder(seasonFolder); |
|
|
|
foreach (int seasonNumber in maybeSeasonNumber) |
|
|
|
foreach (int seasonNumber in maybeSeasonNumber) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Either<BaseError, Season> maybeSeason = await _televisionRepository |
|
|
|
Either<BaseError, Season> maybeSeason = await _televisionRepository |
|
|
|
@ -579,19 +582,4 @@ public class TelevisionFolderScanner : LocalFolderScanner, ITelevisionFolderScan |
|
|
|
.Filter(f => _localFileSystem.FileExists(f)) |
|
|
|
.Filter(f => _localFileSystem.FileExists(f)) |
|
|
|
.HeadOrNone(); |
|
|
|
.HeadOrNone(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static Option<int> SeasonNumberForFolder(string folder) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (int.TryParse(folder.Split(" ").Last(), out int seasonNumber)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return seasonNumber; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (folder.EndsWith("specials", StringComparison.OrdinalIgnoreCase)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return None; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|