initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import logging
|
||||
import typing
|
||||
from pathlib import Path
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
Payload = typing.TypedDict(
|
||||
"Payload",
|
||||
{
|
||||
"gid": str,
|
||||
"num_files": int,
|
||||
"path": str,
|
||||
"files": list[typing.TypedDict("File", {"path": str, "size": int})],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def main(payload: Payload):
|
||||
logging.info("got {torrent}", torrent=payload)
|
||||
path = Path(payload["path"])
|
||||
@@ -0,0 +1,26 @@
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def main(payload: dict = None):
|
||||
if not payload:
|
||||
payload = {}
|
||||
|
||||
links: list[dict] = payload.get("links", [])
|
||||
if not links:
|
||||
logger.info("No links, exiting")
|
||||
return
|
||||
|
||||
logger.info("Got %d links", len(links))
|
||||
|
||||
for it in links:
|
||||
download_path = Path(it["download_path"])
|
||||
url: str = it.get("url", it.get("content_url"))
|
||||
logger.info("Processing downloaded link {url} at {path}", path=download_path, url=url)
|
||||
|
||||
if download_path.suffix.lower() in {".zip", ".rar"}:
|
||||
logger.info("Got an imageset!")
|
||||
|
||||
# raise Exception("oops!")
|
||||
Reference in New Issue
Block a user