Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jo1gi committed Nov 10, 2023
1 parent 0a99020 commit 318882c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
10 changes: 0 additions & 10 deletions audiobookdl/output/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,6 @@ def gen_output_location(template: str, metadata: AudiobookMetadata, remove_chars
return formatted


def get_extension(path: str) -> str:
"""
Get extension from path
:param path: Path to get extension from
:returns: Extension of path
"""
return os.path.splitext(path)[1][1:]


def _fix_output(title: str) -> str:
"""Returns title without characters system can't handle"""
title = title.replace("/", "-")
Expand Down
5 changes: 4 additions & 1 deletion audiobookdl/sources/storytel.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ def get_book_id(url: str) -> str:
:param url: Url to book
:returns: Id of book from url
"""
return parse_url(url).path.split("-")[-1]
parsed = parse_url(url)
if parsed.path is None:
raise DataNotPresent
return parsed.path.split("-")[-1]

def download_bookshelf(self):
"""Download bookshelf data"""
Expand Down
3 changes: 2 additions & 1 deletion tests/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"https://www.audiobooks.com/book/stream/413879": "Audiobooksdotcom",
"https://www.bookbeat.no/bok/somethingsomething-999999": "BookBeat",
"https://ereolen.dk/ting/object/870970-basis%3A53978223": "Ereolen",
"https://www.everand.com/listen/579426746": "Everand",
"https://www.chirpbooks.com/player/11435746": "Chirp",
"https://librivox.org/library-of-the-worlds-best-literature-ancient-and-modern-volume-3-by-various/": "Librivox",
"https://www.nextory.no/bok/somethingsomethingsomething-99999999/": "Nextory",
"https://ofs-d2b6150a9dec641552f953da2637d146.listen.overdrive.com/?d=...": "Overdrive",
"https://www.scribd.com/listen/579426746": "Scribd",
"https://www.scribd.com/listen/579426746": "Everand",
"https://www.storytel.com/no/nn/books/somethingsomething-9999999": "Storytel",
}

Expand Down

0 comments on commit 318882c

Please sign in to comment.