mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-19 09:45:47 -04:00
Finish most of skeleton
This commit is contained in:
parent
b5a442c042
commit
34277a3c67
26 changed files with 2357 additions and 1791 deletions
32
src/media.py
Normal file
32
src/media.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class Media(ABC):
|
||||
async def rip(self):
|
||||
await self.preprocess()
|
||||
await self.download()
|
||||
await self.postprocess()
|
||||
|
||||
@abstractmethod
|
||||
async def preprocess(self):
|
||||
"""Create directories, download cover art, etc."""
|
||||
raise NotImplemented
|
||||
|
||||
@abstractmethod
|
||||
async def download(self):
|
||||
"""Download and tag the actual audio files in the correct directories."""
|
||||
raise NotImplemented
|
||||
|
||||
@abstractmethod
|
||||
async def postprocess(self):
|
||||
"""Update database, run conversion, delete garbage files etc."""
|
||||
raise NotImplemented
|
||||
|
||||
|
||||
class Pending(ABC):
|
||||
"""A request to download a `Media` whose metadata has not been fetched."""
|
||||
|
||||
@abstractmethod
|
||||
async def resolve(self) -> Media:
|
||||
"""Fetch metadata and resolve into a downloadable `Media` object."""
|
||||
raise NotImplemented
|
Loading…
Add table
Add a link
Reference in a new issue