Fix bug in looking up book MD5 hash
This commit is contained in:
@ -129,7 +129,9 @@ def build_book_map(rows) -> dict:
|
|||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
book = Book.objects.filter(
|
book = Book.objects.filter(
|
||||||
koreader_md5__icontains=book_row[KoReaderBookColumn.MD5.value]
|
koreader_data_by_hash__icontains=book_row[
|
||||||
|
KoReaderBookColumn.MD5.value
|
||||||
|
]
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
if not book:
|
if not book:
|
||||||
@ -269,20 +271,20 @@ def build_scrobbles_from_book_map(
|
|||||||
book_id=book_id,
|
book_id=book_id,
|
||||||
user_id=user.id,
|
user_id=user.id,
|
||||||
).first()
|
).first()
|
||||||
if scrobble:
|
# if scrobble:
|
||||||
logger.info(
|
# logger.info(
|
||||||
f"Found existing scrobble {scrobble}, updating"
|
# f"Found existing scrobble {scrobble}, updating"
|
||||||
)
|
# )
|
||||||
scrobble.book_page_data = scrobble_page_data
|
# scrobble.book_page_data = scrobble_page_data
|
||||||
scrobble.playback_position_seconds = (
|
# scrobble.playback_position_seconds = (
|
||||||
scrobble.calc_reading_duration()
|
# scrobble.calc_reading_duration
|
||||||
)
|
# )
|
||||||
scrobble.save(
|
# scrobble.save(
|
||||||
update_fields=[
|
# update_fields=[
|
||||||
"book_page_data",
|
# "book_page_data",
|
||||||
"playback_position_seconds",
|
# "playback_position_seconds",
|
||||||
]
|
# ]
|
||||||
)
|
# )
|
||||||
if not scrobble:
|
if not scrobble:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Queueing scrobble for {book_id}, page {page_number}"
|
f"Queueing scrobble for {book_id}, page {page_number}"
|
||||||
|
|||||||
Reference in New Issue
Block a user