mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-25 22:36:59 -04:00
@@ -11,8 +11,8 @@ using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
namespace NzbDrone.Core.Extras
|
||||
{
|
||||
@@ -81,7 +81,6 @@ namespace NzbDrone.Core.Extras
|
||||
foreach (var matchingFilename in matchingFilenames)
|
||||
{
|
||||
// Filter out duplicate NFO files
|
||||
|
||||
if (matchingFilename.EndsWith(".nfo", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
if (hasNfo)
|
||||
|
||||
@@ -23,7 +23,6 @@ namespace NzbDrone.Core.Extras.Files
|
||||
|
||||
public abstract class ExtraFileManager<TExtraFile> : IManageExtraFiles
|
||||
where TExtraFile : ExtraFile, new()
|
||||
|
||||
{
|
||||
private readonly IConfigService _configService;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
|
||||
@@ -5,7 +5,8 @@ using NzbDrone.Core.Messaging.Events;
|
||||
|
||||
namespace NzbDrone.Core.Extras.Files
|
||||
{
|
||||
public interface IExtraFileRepository<TExtraFile> : IBasicRepository<TExtraFile> where TExtraFile : ExtraFile, new()
|
||||
public interface IExtraFileRepository<TExtraFile> : IBasicRepository<TExtraFile>
|
||||
where TExtraFile : ExtraFile, new()
|
||||
{
|
||||
void DeleteForArtist(int artistId);
|
||||
void DeleteForAlbum(int artistId, int albumId);
|
||||
|
||||
@@ -109,7 +109,6 @@ namespace NzbDrone.Core.Extras.Files
|
||||
{
|
||||
_logger.Debug("Removing track file from DB as part of cleanup routine, not deleting extra files from disk.");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
var artist = trackFile.Artist.Value;
|
||||
|
||||
@@ -4,10 +4,9 @@ using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Extras.Files;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Aggregation;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Aggregation;
|
||||
|
||||
namespace NzbDrone.Core.Extras.Lyrics
|
||||
{
|
||||
@@ -20,7 +19,7 @@ namespace NzbDrone.Core.Extras.Lyrics
|
||||
public ExistingLyricImporter(IExtraFileService<LyricFile> lyricFileService,
|
||||
IAugmentingService augmentingService,
|
||||
Logger logger)
|
||||
: base (lyricFileService)
|
||||
: base(lyricFileService)
|
||||
{
|
||||
_lyricFileService = lyricFileService;
|
||||
_augmentingService = augmentingService;
|
||||
@@ -72,13 +71,13 @@ namespace NzbDrone.Core.Extras.Lyrics
|
||||
}
|
||||
|
||||
var subtitleFile = new LyricFile
|
||||
{
|
||||
ArtistId = artist.Id,
|
||||
AlbumId = localTrack.Album.Id,
|
||||
TrackFileId = localTrack.Tracks.First().TrackFileId,
|
||||
RelativePath = artist.Path.GetRelativePath(possibleLyricFile),
|
||||
Extension = extension
|
||||
};
|
||||
{
|
||||
ArtistId = artist.Id,
|
||||
AlbumId = localTrack.Album.Id,
|
||||
TrackFileId = localTrack.Tracks.First().TrackFileId,
|
||||
RelativePath = artist.Path.GetRelativePath(possibleLyricFile),
|
||||
Extension = extension
|
||||
};
|
||||
|
||||
subtitleFiles.Add(subtitleFile);
|
||||
}
|
||||
@@ -89,7 +88,6 @@ namespace NzbDrone.Core.Extras.Lyrics
|
||||
|
||||
// Return files that were just imported along with files that were
|
||||
// previously imported so previously imported files aren't imported twice
|
||||
|
||||
return subtitleFiles.Concat(filterResult.PreviouslyImported);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Extras.Files;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Music;
|
||||
|
||||
namespace NzbDrone.Core.Extras.Lyrics
|
||||
|
||||
@@ -52,15 +52,19 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Roksbox
|
||||
{
|
||||
var filename = Path.GetFileName(path);
|
||||
|
||||
if (filename == null) return null;
|
||||
if (filename == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var parentdir = Directory.GetParent(path);
|
||||
|
||||
var metadata = new MetadataFile
|
||||
{
|
||||
ArtistId = artist.Id,
|
||||
Consumer = GetType().Name,
|
||||
RelativePath = artist.Path.GetRelativePath(path)
|
||||
};
|
||||
{
|
||||
ArtistId = artist.Id,
|
||||
Consumer = GetType().Name,
|
||||
RelativePath = artist.Path.GetRelativePath(path)
|
||||
};
|
||||
|
||||
//Series and season images are both named folder.jpg, only season ones sit in season folders
|
||||
if (Path.GetFileNameWithoutExtension(filename).Equals(parentdir.Name, StringComparison.InvariantCultureIgnoreCase))
|
||||
@@ -75,7 +79,6 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Roksbox
|
||||
{
|
||||
metadata.AlbumId = 0;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
metadata.AlbumId = Convert.ToInt32(seasonMatch.Groups["season"].Value);
|
||||
@@ -98,7 +101,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Roksbox
|
||||
{
|
||||
metadata.Type = MetadataType.TrackMetadata;
|
||||
return metadata;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -121,7 +124,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Roksbox
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
_logger.Debug("Generating Track Metadata for: {0}", trackFile.Path);
|
||||
|
||||
var xmlResult = string.Empty;
|
||||
@@ -162,13 +165,13 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Roksbox
|
||||
if (image == null)
|
||||
{
|
||||
_logger.Trace("Failed to find suitable Artist image for artist {0}.", artist.Name);
|
||||
return new List<ImageFileResult>(); ;
|
||||
return new List<ImageFileResult>();
|
||||
}
|
||||
|
||||
var source = _mediaCoverService.GetCoverPath(artist.Id, MediaCoverEntity.Artist, image.CoverType, image.Extension);
|
||||
var destination = Path.GetFileName(artist.Path) + Path.GetExtension(source);
|
||||
|
||||
return new List<ImageFileResult>{ new ImageFileResult(destination, source) };
|
||||
return new List<ImageFileResult> { new ImageFileResult(destination, source) };
|
||||
}
|
||||
|
||||
public override List<ImageFileResult> AlbumImages(Artist artist, Album album, string albumFolder)
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Roksbox
|
||||
|
||||
[FieldDefinition(2, Label = "Album Images", Type = FieldType.Checkbox, Section = MetadataSectionType.Image, HelpText = "Album Title.jpg")]
|
||||
public bool AlbumImages { get; set; }
|
||||
|
||||
|
||||
public bool IsValid => true;
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using NLog;
|
||||
@@ -44,21 +42,23 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Wdtv
|
||||
|
||||
_logger.Debug("Unknown track file metadata: {0}", metadataFile.RelativePath);
|
||||
return Path.Combine(artist.Path, metadataFile.RelativePath);
|
||||
|
||||
}
|
||||
|
||||
public override MetadataFile FindMetadataFile(Artist artist, string path)
|
||||
{
|
||||
var filename = Path.GetFileName(path);
|
||||
|
||||
if (filename == null) return null;
|
||||
if (filename == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var metadata = new MetadataFile
|
||||
{
|
||||
ArtistId = artist.Id,
|
||||
Consumer = GetType().Name,
|
||||
RelativePath = artist.Path.GetRelativePath(path)
|
||||
};
|
||||
{
|
||||
ArtistId = artist.Id,
|
||||
Consumer = GetType().Name,
|
||||
RelativePath = artist.Path.GetRelativePath(path)
|
||||
};
|
||||
|
||||
var parseResult = Parser.Parser.ParseMusicTitle(filename);
|
||||
|
||||
@@ -70,7 +70,6 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Wdtv
|
||||
metadata.Type = MetadataType.TrackMetadata;
|
||||
return metadata;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -141,7 +140,6 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Wdtv
|
||||
|
||||
public override List<ImageFileResult> TrackImages(Artist artist, TrackFile trackFile)
|
||||
{
|
||||
|
||||
return new List<ImageFileResult>();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Wdtv
|
||||
|
||||
[FieldDefinition(0, Label = "Track Metadata", Type = FieldType.Checkbox, Section = MetadataSectionType.Metadata)]
|
||||
public bool TrackMetadata { get; set; }
|
||||
|
||||
|
||||
public bool IsValid => true;
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
|
||||
@@ -52,7 +52,10 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
|
||||
{
|
||||
var filename = Path.GetFileName(path);
|
||||
|
||||
if (filename == null) return null;
|
||||
if (filename == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var metadata = new MetadataFile
|
||||
{
|
||||
@@ -163,7 +166,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
|
||||
doc.Save(xw);
|
||||
|
||||
_logger.Debug("Saving album.nfo for {0}", album.Title);
|
||||
|
||||
|
||||
var fileName = Path.Combine(albumPath, "album.nfo");
|
||||
|
||||
return new MetadataFileResult(fileName, doc.ToString());
|
||||
@@ -197,7 +200,6 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
|
||||
|
||||
public override List<ImageFileResult> TrackImages(Artist artist, TrackFile trackFile)
|
||||
{
|
||||
|
||||
return new List<ImageFileResult>();
|
||||
}
|
||||
|
||||
@@ -224,7 +226,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
|
||||
// var source = _mediaCoverService.GetCoverPath(album.ArtistId, image.CoverType, null, album.Id);
|
||||
string filename;
|
||||
|
||||
switch(image.CoverType)
|
||||
switch (image.CoverType)
|
||||
{
|
||||
case MediaCoverTypes.Cover:
|
||||
filename = "folder";
|
||||
@@ -246,6 +248,5 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
|
||||
{
|
||||
return Path.ChangeExtension(trackFilePath, "nfo");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using NzbDrone.Common.Disk;
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Extras.Files;
|
||||
using NzbDrone.Core.Extras.Metadata.Files;
|
||||
using NzbDrone.Core.Extras.Lyrics;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Extras.Metadata.Files;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Aggregation;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
namespace NzbDrone.Core.Extras.Metadata
|
||||
@@ -47,7 +47,6 @@ namespace NzbDrone.Core.Extras.Metadata
|
||||
foreach (var possibleMetadataFile in filterResult.FilesOnDisk)
|
||||
{
|
||||
// Don't process files that have known Subtitle file extensions (saves a bit of unecessary processing)
|
||||
|
||||
if (LyricFileExtensions.Extensions.Contains(Path.GetExtension(possibleMetadataFile)))
|
||||
{
|
||||
continue;
|
||||
@@ -83,7 +82,7 @@ namespace NzbDrone.Core.Extras.Metadata
|
||||
Artist = artist,
|
||||
Path = possibleMetadataFile
|
||||
};
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
_augmentingService.Augment(localTrack, false);
|
||||
@@ -105,7 +104,7 @@ namespace NzbDrone.Core.Extras.Metadata
|
||||
_logger.Debug("Extra file: {0} does not match existing files.", possibleMetadataFile);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
metadata.TrackFileId = localTrack.Tracks.First().TrackFileId;
|
||||
}
|
||||
|
||||
@@ -120,7 +119,6 @@ namespace NzbDrone.Core.Extras.Metadata
|
||||
|
||||
// Return files that were just imported along with files that were
|
||||
// previously imported so previously imported files aren't imported twice
|
||||
|
||||
return metadataFiles.Concat(filterResult.PreviouslyImported);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,4 @@ namespace NzbDrone.Core.Extras.Metadata.Files
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Extras.Metadata.Files;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
|
||||
namespace NzbDrone.Core.Extras.Metadata
|
||||
{
|
||||
|
||||
@@ -4,12 +4,13 @@ using System.IO;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Core.Extras.Metadata.Files;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
|
||||
namespace NzbDrone.Core.Extras.Metadata
|
||||
{
|
||||
public abstract class MetadataBase<TSettings> : IMetadata where TSettings : IProviderConfig, new()
|
||||
public abstract class MetadataBase<TSettings> : IMetadata
|
||||
where TSettings : IProviderConfig, new()
|
||||
{
|
||||
public abstract string Name { get; }
|
||||
|
||||
@@ -52,7 +53,10 @@ namespace NzbDrone.Core.Extras.Metadata
|
||||
public abstract List<ImageFileResult> AlbumImages(Artist artist, Album album, string albumPath);
|
||||
public abstract List<ImageFileResult> TrackImages(Artist artist, TrackFile trackFile);
|
||||
|
||||
public virtual object RequestAction(string action, IDictionary<string, string> query) { return null; }
|
||||
public virtual object RequestAction(string action, IDictionary<string, string> query)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
protected TSettings Settings => (TSettings)Definition.Settings;
|
||||
|
||||
|
||||
@@ -53,4 +53,4 @@ namespace NzbDrone.Core.Extras.Metadata
|
||||
return GetAvailableProviders().Where(n => ((MetadataDefinition)n.Definition).Enable).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,4 @@ namespace NzbDrone.Core.Extras.Metadata
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ using NzbDrone.Core.Extras.Metadata.Files;
|
||||
using NzbDrone.Core.Extras.Others;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Organizer;
|
||||
|
||||
namespace NzbDrone.Core.Extras.Metadata
|
||||
{
|
||||
@@ -79,7 +78,7 @@ namespace NzbDrone.Core.Extras.Metadata
|
||||
|
||||
files.AddIfNotNull(ProcessArtistMetadata(consumer, artist, consumerFiles));
|
||||
files.AddRange(ProcessArtistImages(consumer, artist, consumerFiles));
|
||||
|
||||
|
||||
var albumGroups = trackFiles.GroupBy(s => Path.GetDirectoryName(s.Path)).ToList();
|
||||
|
||||
foreach (var group in albumGroups)
|
||||
@@ -150,7 +149,6 @@ namespace NzbDrone.Core.Extras.Metadata
|
||||
|
||||
// TODO: Move EpisodeImage and EpisodeMetadata metadata files, instead of relying on consumers to do it
|
||||
// (Xbmc's EpisodeImage is more than just the extension)
|
||||
|
||||
foreach (var consumer in _metadataFactory.GetAvailableProviders())
|
||||
{
|
||||
foreach (var filePath in distinctTrackFilePaths)
|
||||
@@ -181,7 +179,6 @@ namespace NzbDrone.Core.Extras.Metadata
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (var trackFile in trackFiles)
|
||||
{
|
||||
var metadataFilesForConsumer = GetMetadataFilesForConsumer(consumer, metadataFiles).Where(m => m.TrackFileId == trackFile.Id).ToList();
|
||||
@@ -436,7 +433,6 @@ namespace NzbDrone.Core.Extras.Metadata
|
||||
result.Add(metadata);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -454,6 +450,7 @@ namespace NzbDrone.Core.Extras.Metadata
|
||||
{
|
||||
_diskProvider.CopyFile(image.Url, fullPath);
|
||||
}
|
||||
|
||||
_mediaFileAttributeService.SetFilePermissions(fullPath);
|
||||
}
|
||||
catch (WebException ex)
|
||||
@@ -492,7 +489,7 @@ namespace NzbDrone.Core.Extras.Metadata
|
||||
_recycleBinProvider.DeleteFile(path, subfolder);
|
||||
_metadataFileService.Delete(file.Id);
|
||||
}
|
||||
|
||||
|
||||
return matchingMetadataFiles.First();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -6,7 +5,6 @@ using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Extras.Files;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Aggregation;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
@@ -53,7 +51,7 @@ namespace NzbDrone.Core.Extras.Others
|
||||
Artist = artist,
|
||||
Path = possibleExtraFile
|
||||
};
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
_augmentingService.Augment(localTrack, false);
|
||||
@@ -93,7 +91,6 @@ namespace NzbDrone.Core.Extras.Others
|
||||
|
||||
// Return files that were just imported along with files that were
|
||||
// previously imported so previously imported files aren't imported twice
|
||||
|
||||
return extraFiles.Concat(filterResult.PreviouslyImported);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
||||
@@ -15,4 +15,4 @@ namespace NzbDrone.Core.Extras.Others
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Disk;
|
||||
|
||||
Reference in New Issue
Block a user