refactor(worker): add types and rewrite docstring
This commit is contained in:
parent
7184fb3235
commit
11c55d26dc
|
@ -5,6 +5,7 @@ import traceback
|
||||||
from cgi import parse_header
|
from cgi import parse_header
|
||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Optional
|
||||||
from urllib.parse import urlsplit
|
from urllib.parse import urlsplit
|
||||||
|
|
||||||
import mutagen
|
import mutagen
|
||||||
|
@ -21,24 +22,24 @@ logger = get_task_logger(__name__)
|
||||||
|
|
||||||
@worker.task(name="podcast-download", acks_late=True)
|
@worker.task(name="podcast-download", acks_late=True)
|
||||||
def podcast_download(
|
def podcast_download(
|
||||||
id,
|
id: int,
|
||||||
url,
|
url: str,
|
||||||
podcast_name,
|
podcast_name: str,
|
||||||
album_override,
|
album_override: bool,
|
||||||
track_title,
|
track_title: Optional[str],
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Download a podcast episode
|
Download a podcast episode.
|
||||||
|
|
||||||
:param id: episode unique ID
|
Args:
|
||||||
:param url: download url for the episode
|
id: Episode ID.
|
||||||
:param podcast_name: Name of podcast to be added to id3 metadata for smartblock
|
url: Episode download url.
|
||||||
:param album_override: Passing whether to override the album id3 even if it exists
|
podcast_name: Podcast name to save to the metadata.
|
||||||
:param track_title: Passing the title of the episode from feed to override the metadata
|
album_override: Whether to override the album metadata.
|
||||||
|
track_title: Episode title to override the title metadata.
|
||||||
|
|
||||||
:return: JSON formatted string of a dictionary of download statuses
|
Returns:
|
||||||
and file identifiers (for successful uploads)
|
Status of the podcast download as JSON string.
|
||||||
:rtype: string
|
|
||||||
"""
|
"""
|
||||||
# Object to store file IDs, episode IDs, and download status
|
# Object to store file IDs, episode IDs, and download status
|
||||||
# (important if there's an error before the file is posted)
|
# (important if there's an error before the file is posted)
|
||||||
|
|
Loading…
Reference in New Issue