mirror of
https://github.com/fergalmoran/Readarr.git
synced 2025-12-22 17:40:10 +00:00
@@ -5,6 +5,7 @@ namespace NzbDrone.Core.ImportLists.Readarr
|
|||||||
public class ReadarrAuthor
|
public class ReadarrAuthor
|
||||||
{
|
{
|
||||||
public string AuthorName { get; set; }
|
public string AuthorName { get; set; }
|
||||||
|
public int Id { get; set; }
|
||||||
public string ForeignAuthorId { get; set; }
|
public string ForeignAuthorId { get; set; }
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
public List<MediaCover.MediaCover> Images { get; set; }
|
public List<MediaCover.MediaCover> Images { get; set; }
|
||||||
@@ -30,6 +31,7 @@ namespace NzbDrone.Core.ImportLists.Readarr
|
|||||||
public List<MediaCover.MediaCover> Images { get; set; }
|
public List<MediaCover.MediaCover> Images { get; set; }
|
||||||
public bool Monitored { get; set; }
|
public bool Monitored { get; set; }
|
||||||
public ReadarrAuthor Author { get; set; }
|
public ReadarrAuthor Author { get; set; }
|
||||||
|
public int AuthorId { get; set; }
|
||||||
public List<ReadarrEdition> Editions { get; set; }
|
public List<ReadarrEdition> Editions { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,20 +35,28 @@ namespace NzbDrone.Core.ImportLists.Readarr
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var remoteBooks = _readarrV1Proxy.GetBooks(Settings);
|
var remoteBooks = _readarrV1Proxy.GetBooks(Settings);
|
||||||
|
var remoteAuthors = _readarrV1Proxy.GetAuthors(Settings);
|
||||||
|
|
||||||
|
var authorDict = remoteAuthors.ToDictionary(x => x.Id);
|
||||||
|
|
||||||
foreach (var remoteBook in remoteBooks)
|
foreach (var remoteBook in remoteBooks)
|
||||||
{
|
{
|
||||||
if ((!Settings.ProfileIds.Any() || Settings.ProfileIds.Contains(remoteBook.Author.QualityProfileId)) &&
|
var remoteAuthor = authorDict[remoteBook.AuthorId];
|
||||||
(!Settings.TagIds.Any() || Settings.TagIds.Any(x => remoteBook.Author.Tags.Any(y => y == x))) &&
|
|
||||||
remoteBook.Monitored && remoteBook.Author.Monitored)
|
if ((!Settings.ProfileIds.Any() || Settings.ProfileIds.Contains(remoteAuthor.QualityProfileId)) &&
|
||||||
|
(!Settings.TagIds.Any() || Settings.TagIds.Any(x => remoteAuthor.Tags.Any(y => y == x))) &&
|
||||||
|
remoteBook.Monitored && remoteAuthor.Monitored)
|
||||||
{
|
{
|
||||||
authorsAndBooks.Add(new ImportListItemInfo
|
authorsAndBooks.Add(new ImportListItemInfo
|
||||||
{
|
{
|
||||||
BookGoodreadsId = remoteBook.ForeignBookId,
|
BookGoodreadsId = remoteBook.ForeignBookId,
|
||||||
Book = remoteBook.Title,
|
Book = remoteBook.Title,
|
||||||
EditionGoodreadsId = remoteBook.Editions.Single(x => x.Monitored).ForeignEditionId,
|
|
||||||
Author = remoteBook.Author.AuthorName,
|
// ToDo: Fix me. Edition is no longer in the book resource; rethink edition logic
|
||||||
AuthorGoodreadsId = remoteBook.Author.ForeignAuthorId
|
// Bandaid fix for now...This will cause the imported book to possibly not be same edition as the source
|
||||||
|
// EditionGoodreadsId = remoteBook.Editions.Single(x => x.Monitored).ForeignEditionId,
|
||||||
|
Author = remoteAuthor.AuthorName,
|
||||||
|
AuthorGoodreadsId = remoteAuthor.ForeignAuthorId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,6 +65,7 @@ namespace NzbDrone.Core.ImportLists.Readarr
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
_logger.Warn("List Import Sync Task Failed for List [{0}]", Definition.Name);
|
||||||
_importListStatusService.RecordFailure(Definition.Id);
|
_importListStatusService.RecordFailure(Definition.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user