Fix bug where title not found
This commit is contained in:
@ -1,7 +1,10 @@
|
|||||||
from titlecase import titlecase
|
from titlecase import titlecase
|
||||||
|
|
||||||
def parse_readcomicsonline_uri(uri: str) -> tuple:
|
def parse_readcomicsonline_uri(uri: str) -> tuple:
|
||||||
path = uri.split("comic/")[1]
|
try:
|
||||||
|
path = uri.split("comic/")[1]
|
||||||
|
except IndexError:
|
||||||
|
return "", "", ""
|
||||||
|
|
||||||
parts = path.split('/')
|
parts = path.split('/')
|
||||||
title = ""
|
title = ""
|
||||||
|
|||||||
@ -263,15 +263,25 @@ def manual_scrobble_book(
|
|||||||
|
|
||||||
if READCOMICSONLINE_URL in title:
|
if READCOMICSONLINE_URL in title:
|
||||||
title, volume, page = parse_readcomicsonline_uri(title)
|
title, volume, page = parse_readcomicsonline_uri(title)
|
||||||
|
if not title:
|
||||||
|
logger.info(
|
||||||
|
"[scrobblers] manual book scrobble request failed",
|
||||||
|
extra={
|
||||||
|
"title": title,
|
||||||
|
"user_id": user_id,
|
||||||
|
"media_type": Scrobble.MediaType.BOOK,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
title = f"{title} - Issue {volume}"
|
title = f"{title} - Issue {volume}"
|
||||||
|
|
||||||
if not page:
|
if not page:
|
||||||
page = 1
|
page = 1
|
||||||
|
|
||||||
log = BookLogData(page_data=BookPageLogData(page_number=page, start_ts=int(timezone.now().timestamp())))
|
|
||||||
logger.info("[scrobblers] Book page included in scrobble, should update!")
|
logger.info("[scrobblers] Book page included in scrobble, should update!")
|
||||||
|
|
||||||
source = READCOMICSONLINE_URL
|
source = READCOMICSONLINE_URL.replace("https://", "")
|
||||||
|
|
||||||
# TODO: Check for scrobble of this book already and if so, update the page count
|
# TODO: Check for scrobble of this book already and if so, update the page count
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user