mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-22 22:14:44 -04:00
New: Search for new editions from goodreads when identifying
This commit is contained in:
@@ -48,7 +48,7 @@ class SelectAuthorModalContentConnector extends Component {
|
||||
id,
|
||||
author,
|
||||
book: undefined,
|
||||
bookReleaseId: undefined,
|
||||
foreignEditionId: undefined,
|
||||
rejections: []
|
||||
});
|
||||
});
|
||||
|
||||
@@ -64,7 +64,7 @@ class SelectBookModalContentConnector extends Component {
|
||||
this.props.updateInteractiveImportItem({
|
||||
id,
|
||||
book,
|
||||
editionId: undefined,
|
||||
foreignEditionId: undefined,
|
||||
rejections: []
|
||||
});
|
||||
});
|
||||
|
||||
@@ -34,8 +34,6 @@ class SelectBookRow extends Component {
|
||||
render() {
|
||||
const {
|
||||
title,
|
||||
disambiguation,
|
||||
bookType,
|
||||
releaseDate,
|
||||
statistics,
|
||||
monitored,
|
||||
@@ -48,8 +46,6 @@ class SelectBookRow extends Component {
|
||||
totalBookCount
|
||||
} = statistics;
|
||||
|
||||
const extendedTitle = disambiguation ? `${title} (${disambiguation})` : title;
|
||||
|
||||
return (
|
||||
<TableRow
|
||||
onClick={this.onPress}
|
||||
@@ -69,15 +65,7 @@ class SelectBookRow extends Component {
|
||||
if (name === 'title') {
|
||||
return (
|
||||
<TableRowCell key={name}>
|
||||
{extendedTitle}
|
||||
</TableRowCell>
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'bookType') {
|
||||
return (
|
||||
<TableRowCell key={name}>
|
||||
{bookType}
|
||||
{title}
|
||||
</TableRowCell>
|
||||
);
|
||||
}
|
||||
@@ -121,8 +109,6 @@ class SelectBookRow extends Component {
|
||||
SelectBookRow.propTypes = {
|
||||
id: PropTypes.number.isRequired,
|
||||
title: PropTypes.string.isRequired,
|
||||
disambiguation: PropTypes.string.isRequired,
|
||||
bookType: PropTypes.string.isRequired,
|
||||
releaseDate: PropTypes.string.isRequired,
|
||||
onBookSelect: PropTypes.func.isRequired,
|
||||
statistics: PropTypes.object.isRequired,
|
||||
|
||||
@@ -20,13 +20,14 @@ class SelectEditionModalContentConnector extends Component {
|
||||
//
|
||||
// Listeners
|
||||
|
||||
onEditionSelect = (bookId, editionId) => {
|
||||
onEditionSelect = (bookId, foreignEditionId) => {
|
||||
console.log(`book: ${bookId} id: ${foreignEditionId} ${typeof foreignEditionId}`);
|
||||
const ids = this.props.importIdsByBook[bookId];
|
||||
|
||||
ids.forEach((id) => {
|
||||
this.props.updateInteractiveImportItem({
|
||||
id,
|
||||
editionId,
|
||||
foreignEditionId,
|
||||
disableReleaseSwitching: true,
|
||||
tracks: [],
|
||||
rejections: []
|
||||
|
||||
@@ -13,7 +13,7 @@ class SelectEditionRow extends Component {
|
||||
// Listeners
|
||||
|
||||
onInputChange = ({ name, value }) => {
|
||||
this.props.onEditionSelect(parseInt(name), parseInt(value));
|
||||
this.props.onEditionSelect(parseInt(name), value);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -49,6 +49,9 @@ class SelectEditionRow extends Component {
|
||||
if (bookEdition.isbn13) {
|
||||
extras.push(bookEdition.isbn13);
|
||||
}
|
||||
if (bookEdition.asin) {
|
||||
extras.push(bookEdition.asin);
|
||||
}
|
||||
if (bookEdition.format) {
|
||||
extras.push(bookEdition.format);
|
||||
}
|
||||
@@ -61,7 +64,7 @@ class SelectEditionRow extends Component {
|
||||
}
|
||||
|
||||
return {
|
||||
key: bookEdition.id,
|
||||
key: bookEdition.foreignEditionId,
|
||||
value
|
||||
};
|
||||
});
|
||||
@@ -114,9 +117,9 @@ class SelectEditionRow extends Component {
|
||||
|
||||
SelectEditionRow.propTypes = {
|
||||
id: PropTypes.number.isRequired,
|
||||
matchedEditionId: PropTypes.number.isRequired,
|
||||
matchedEditionId: PropTypes.string.isRequired,
|
||||
title: PropTypes.string.isRequired,
|
||||
disambiguation: PropTypes.string.isRequired,
|
||||
disambiguation: PropTypes.string,
|
||||
editions: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
onEditionSelect: PropTypes.func.isRequired,
|
||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired
|
||||
|
||||
@@ -115,9 +115,9 @@ class InteractiveImportModalContent extends Component {
|
||||
const selectedItems = _.filter(this.props.items, (x) => _.includes(selectedIds, x.id));
|
||||
|
||||
const inconsistent = _(selectedItems)
|
||||
.map((x) => ({ bookId: x.book ? x.book.id : 0, releaseId: x.EditionId }))
|
||||
.map((x) => ({ bookId: x.book ? x.book.id : 0, foreignEditionId: x.ForeignEditionId }))
|
||||
.groupBy('bookId')
|
||||
.mapValues((book) => _(book).groupBy((x) => x.releaseId).values().value().length)
|
||||
.mapValues((book) => _(book).groupBy((x) => x.foreignEditionId).values().value().length)
|
||||
.values()
|
||||
.some((x) => x !== undefined && x > 1);
|
||||
|
||||
@@ -271,6 +271,8 @@ class InteractiveImportModalContent extends Component {
|
||||
|
||||
const selectedIds = this.getSelectedIds();
|
||||
const selectedItem = selectedIds.length ? _.find(items, { id: selectedIds[0] }) : null;
|
||||
const importIdsByBook = _.chain(items).filter((x) => x.book).groupBy((x) => x.book.id).mapValues((x) => x.map((y) => y.id)).value();
|
||||
const editions = _.chain(items).filter((x) => x.book).keyBy((x) => x.book.id).mapValues((x) => ({ matchedEditionId: x.foreignEditionId, book: x.book })).values().value();
|
||||
const errorMessage = getErrorMessage(error, 'Unable to load manual import items');
|
||||
|
||||
const bulkSelectOptions = [
|
||||
@@ -475,8 +477,8 @@ class InteractiveImportModalContent extends Component {
|
||||
|
||||
<SelectEditionModal
|
||||
isOpen={selectModalOpen === EDITION}
|
||||
importIdsByBook={_.chain(items).filter((x) => x.book).groupBy((x) => x.book.id).mapValues((x) => x.map((y) => y.id)).value()}
|
||||
books={_.chain(items).filter((x) => x.book).keyBy((x) => x.book.id).mapValues((x) => ({ matchedEditionId: x.editionId, book: x.book })).values().value()}
|
||||
importIdsByBook={importIdsByBook}
|
||||
books={editions}
|
||||
onModalClose={this.onSelectModalClose}
|
||||
/>
|
||||
|
||||
|
||||
+2
-2
@@ -127,7 +127,7 @@ class InteractiveImportModalContentConnector extends Component {
|
||||
const {
|
||||
author,
|
||||
book,
|
||||
editionId,
|
||||
foreignEditionId,
|
||||
quality,
|
||||
disableReleaseSwitching
|
||||
} = item;
|
||||
@@ -151,7 +151,7 @@ class InteractiveImportModalContentConnector extends Component {
|
||||
path: item.path,
|
||||
authorId: author.id,
|
||||
bookId: book.id,
|
||||
editionId,
|
||||
foreignEditionId,
|
||||
quality,
|
||||
downloadId: this.props.downloadId,
|
||||
disableReleaseSwitching
|
||||
|
||||
Reference in New Issue
Block a user