mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-22 22:14:44 -04:00
New: Unmapped files view (#888)
* New: Unmapped files view Displays all trackfiles that haven't been matched to a track. Generalised the file details component and adds it to the album details screen. * Add sorting by quality * New: MediaServiceTests & MediaRepoTests
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
@@ -20,9 +19,11 @@ namespace NzbDrone.Core.MediaFiles
|
||||
void Update(TrackFile trackFile);
|
||||
void Update(List<TrackFile> trackFile);
|
||||
void Delete(TrackFile trackFile, DeleteMediaFileReason reason);
|
||||
void DeleteMany(List<TrackFile> trackFiles, DeleteMediaFileReason reason);
|
||||
List<TrackFile> GetFilesByArtist(int artistId);
|
||||
List<TrackFile> GetFilesByAlbum(int albumId);
|
||||
List<TrackFile> GetFilesByRelease(int releaseId);
|
||||
List<TrackFile> GetUnmappedFiles();
|
||||
List<IFileInfo> FilterUnchangedFiles(List<IFileInfo> files, Artist artist, FilterFilesType filter);
|
||||
TrackFile Get(int id);
|
||||
List<TrackFile> Get(IEnumerable<int> ids);
|
||||
@@ -81,6 +82,17 @@ namespace NzbDrone.Core.MediaFiles
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteMany(List<TrackFile> trackFiles, DeleteMediaFileReason reason)
|
||||
{
|
||||
_mediaFileRepository.DeleteMany(trackFiles);
|
||||
|
||||
// publish events where trackfile was mapped to a track
|
||||
foreach (var trackFile in trackFiles.Where(x => x.AlbumId > 0))
|
||||
{
|
||||
_eventAggregator.PublishEvent(new TrackFileDeletedEvent(trackFile, reason));
|
||||
}
|
||||
}
|
||||
|
||||
public List<IFileInfo> FilterUnchangedFiles(List<IFileInfo> files, Artist artist, FilterFilesType filter)
|
||||
{
|
||||
_logger.Debug($"Filtering {files.Count} files for unchanged files");
|
||||
@@ -166,6 +178,11 @@ namespace NzbDrone.Core.MediaFiles
|
||||
return _mediaFileRepository.GetFilesByRelease(releaseId);
|
||||
}
|
||||
|
||||
public List<TrackFile> GetUnmappedFiles()
|
||||
{
|
||||
return _mediaFileRepository.GetUnmappedFiles();
|
||||
}
|
||||
|
||||
public void UpdateMediaInfo(List<TrackFile> trackFiles)
|
||||
{
|
||||
_mediaFileRepository.SetFields(trackFiles, t => t.MediaInfo);
|
||||
|
||||
Reference in New Issue
Block a user