[books] Add utility urls to model and scrobbles

This commit is contained in:
2025-10-22 14:18:01 -04:00
parent 8faf0296a6
commit 050add8543
9 changed files with 161 additions and 23 deletions

View File

@ -29,7 +29,12 @@ from scrobbles.constants import (
)
from scrobbles.models import Scrobble
from scrobbles.notifications import ScrobbleNtfyNotification
from scrobbles.utils import convert_to_seconds, extract_domain
from scrobbles.utils import (
convert_to_seconds,
extract_domain,
remove_last_part,
next_url_if_exists,
)
from sports.models import SportEvent
from sports.thesportsdb import lookup_event_from_thesportsdb
from tasks.models import Task
@ -260,7 +265,7 @@ def manual_scrobble_book(
log = {}
source = "Vrobbler"
page = None
url = None
url = ""
if READCOMICSONLINE_URL in title:
url = title
@ -287,7 +292,7 @@ def manual_scrobble_book(
# TODO: Check for scrobble of this book already and if so, update the page count
book = Book.find_or_create(title, enrich=True)
book = Book.find_or_create(title, url=url, enrich=True)
scrobble_dict = {
"user_id": user_id,
@ -312,8 +317,7 @@ def manual_scrobble_book(
if action == "stop":
if url:
scrobble.log["resume_url"] = url
scrobble.log["restart_url"] = remove_last_part(url)
scrobble.log["resume_url"] = next_url_if_exists(url)
scrobble.save(update_fields=["log"])
scrobble.stop(force_finish=True)