Method, Variable, Class Renames in Readarr.Core

Co-Authored-By: ta264 <ta264@users.noreply.github.com>
This commit is contained in:
Qstick
2020-05-12 22:48:46 -04:00
parent 56aedcc467
commit 8547af9fae
572 changed files with 6584 additions and 6597 deletions
@@ -5,58 +5,58 @@ using NLog;
using NzbDrone.Common.Disk;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Instrumentation.Extensions;
using NzbDrone.Core.Books;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Music;
namespace NzbDrone.Core.MediaFiles
{
public interface IUpdateTrackFileService
public interface IUpdateBookFileService
{
void ChangeFileDateForFile(BookFile trackFile, Author artist, Book book);
void ChangeFileDateForFile(BookFile bookFile, Author author, Book book);
}
public class UpdateTrackFileService : IUpdateTrackFileService,
IHandle<ArtistScannedEvent>
public class UpdateTrackFileService : IUpdateBookFileService,
IHandle<AuthorScannedEvent>
{
private readonly IDiskProvider _diskProvider;
private readonly IAlbumService _albumService;
private readonly IBookService _bookService;
private readonly IConfigService _configService;
private readonly Logger _logger;
private static readonly DateTime EpochTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public UpdateTrackFileService(IDiskProvider diskProvider,
IConfigService configService,
IAlbumService albumService,
IBookService bookService,
Logger logger)
{
_diskProvider = diskProvider;
_configService = configService;
_albumService = albumService;
_bookService = bookService;
_logger = logger;
}
public void ChangeFileDateForFile(BookFile trackFile, Author artist, Book book)
public void ChangeFileDateForFile(BookFile bookFile, Author author, Book book)
{
ChangeFileDate(trackFile, book);
ChangeFileDate(bookFile, book);
}
private bool ChangeFileDate(BookFile trackFile, Book album)
private bool ChangeFileDate(BookFile bookFile, Book book)
{
var trackFilePath = trackFile.Path;
var trackFilePath = bookFile.Path;
switch (_configService.FileDate)
{
case FileDateType.AlbumReleaseDate:
{
if (!album.ReleaseDate.HasValue)
if (!book.ReleaseDate.HasValue)
{
_logger.Debug("Could not create valid date to change file [{0}]", trackFilePath);
return false;
}
var relDate = album.ReleaseDate.Value;
var relDate = book.ReleaseDate.Value;
// avoiding false +ve checks and set date skewing by not using UTC (Windows)
var oldDateTime = _diskProvider.FileGetLastWrite(trackFilePath);
@@ -89,16 +89,16 @@ namespace NzbDrone.Core.MediaFiles
return false;
}
public void Handle(ArtistScannedEvent message)
public void Handle(AuthorScannedEvent message)
{
if (_configService.FileDate == FileDateType.None)
{
return;
}
var books = _albumService.GetArtistAlbumsWithFiles(message.Artist);
var books = _bookService.GetAuthorBooksWithFiles(message.Author);
var trackFiles = new List<BookFile>();
var bookFiles = new List<BookFile>();
var updated = new List<BookFile>();
foreach (var book in books)
@@ -106,7 +106,7 @@ namespace NzbDrone.Core.MediaFiles
var files = book.BookFiles.Value;
foreach (var file in files)
{
trackFiles.Add(file);
bookFiles.Add(file);
if (ChangeFileDate(file, book))
{
updated.Add(file);
@@ -116,11 +116,11 @@ namespace NzbDrone.Core.MediaFiles
if (updated.Any())
{
_logger.ProgressDebug("Changed file date for {0} files of {1} in {2}", updated.Count, trackFiles.Count, message.Artist.Name);
_logger.ProgressDebug("Changed file date for {0} files of {1} in {2}", updated.Count, bookFiles.Count, message.Author.Name);
}
else
{
_logger.ProgressDebug("No file dates changed for {0}", message.Artist.Name);
_logger.ProgressDebug("No file dates changed for {0}", message.Author.Name);
}
}
}