|
|
|
@ -18,6 +18,7 @@ public class MovieFolderScanner : LocalFolderScanner, IMovieFolderScanner |
|
|
|
private readonly IClient _client; |
|
|
|
private readonly IClient _client; |
|
|
|
private readonly IFallbackMetadataProvider _fallbackMetadataProvider; |
|
|
|
private readonly IFallbackMetadataProvider _fallbackMetadataProvider; |
|
|
|
private readonly ILibraryRepository _libraryRepository; |
|
|
|
private readonly ILibraryRepository _libraryRepository; |
|
|
|
|
|
|
|
private readonly IMediaItemRepository _mediaItemRepository; |
|
|
|
private readonly ILocalFileSystem _localFileSystem; |
|
|
|
private readonly ILocalFileSystem _localFileSystem; |
|
|
|
private readonly ILocalMetadataProvider _localMetadataProvider; |
|
|
|
private readonly ILocalMetadataProvider _localMetadataProvider; |
|
|
|
private readonly ILocalSubtitlesProvider _localSubtitlesProvider; |
|
|
|
private readonly ILocalSubtitlesProvider _localSubtitlesProvider; |
|
|
|
@ -64,6 +65,7 @@ public class MovieFolderScanner : LocalFolderScanner, IMovieFolderScanner |
|
|
|
_searchRepository = searchRepository; |
|
|
|
_searchRepository = searchRepository; |
|
|
|
_fallbackMetadataProvider = fallbackMetadataProvider; |
|
|
|
_fallbackMetadataProvider = fallbackMetadataProvider; |
|
|
|
_libraryRepository = libraryRepository; |
|
|
|
_libraryRepository = libraryRepository; |
|
|
|
|
|
|
|
_mediaItemRepository = mediaItemRepository; |
|
|
|
_mediator = mediator; |
|
|
|
_mediator = mediator; |
|
|
|
_client = client; |
|
|
|
_client = client; |
|
|
|
_logger = logger; |
|
|
|
_logger = logger; |
|
|
|
@ -79,6 +81,8 @@ public class MovieFolderScanner : LocalFolderScanner, IMovieFolderScanner |
|
|
|
{ |
|
|
|
{ |
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
List<string> allTrashedItems = await _mediaItemRepository.GetAllTrashedItems(libraryPath); |
|
|
|
|
|
|
|
|
|
|
|
decimal progressSpread = progressMax - progressMin; |
|
|
|
decimal progressSpread = progressMax - progressMin; |
|
|
|
|
|
|
|
|
|
|
|
var foldersCompleted = 0; |
|
|
|
var foldersCompleted = 0; |
|
|
|
@ -133,15 +137,25 @@ public class MovieFolderScanner : LocalFolderScanner, IMovieFolderScanner |
|
|
|
.Filter(f => f.Path == movieFolder) |
|
|
|
.Filter(f => f.Path == movieFolder) |
|
|
|
.HeadOrNone(); |
|
|
|
.HeadOrNone(); |
|
|
|
|
|
|
|
|
|
|
|
// skip folder if etag matches
|
|
|
|
bool etagMatches = await knownFolder.Map(f => f.Etag ?? string.Empty).IfNoneAsync(string.Empty) == etag; |
|
|
|
if (await knownFolder.Map(f => f.Etag ?? string.Empty).IfNoneAsync(string.Empty) == etag) |
|
|
|
if (etagMatches) |
|
|
|
{ |
|
|
|
{ |
|
|
|
continue; |
|
|
|
if (allFiles.Any(allTrashedItems.Contains)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_logger.LogDebug("Previously trashed items are now present in folder {Folder}", movieFolder); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// etag matches and no trashed items are now present, continue to next folder
|
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_logger.LogDebug( |
|
|
|
|
|
|
|
"UPDATE: Etag has changed for folder {Folder}", |
|
|
|
|
|
|
|
movieFolder); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_logger.LogDebug( |
|
|
|
|
|
|
|
"UPDATE: Etag has changed for folder {Folder}", |
|
|
|
|
|
|
|
movieFolder); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (string file in allFiles.OrderBy(identity)) |
|
|
|
foreach (string file in allFiles.OrderBy(identity)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|