sane-bt: add --freeleech and --archive flags to control torrent location
This commit is contained in:
parent
afe27fd9cb
commit
5f47372f6a
|
@ -15,6 +15,8 @@ class MediaMeta:
|
|||
prefix: str | None
|
||||
author: str | None
|
||||
type_: "film" | "show" | "book" | "audiobook" | "vn" # TODO: use enumeration
|
||||
freeleech: bool
|
||||
archive: bool
|
||||
|
||||
@classmethod
|
||||
def add_arguments(self, parser: ArgumentParser):
|
||||
|
@ -25,6 +27,8 @@ class MediaMeta:
|
|||
parser.add_argument("--audiobook", help="AudiobookTitle")
|
||||
parser.add_argument("--vn", help="VisualNovelTitle (for comics/manga)")
|
||||
parser.add_argument("--author", help="FirstnameLastname")
|
||||
parser.add_argument("--freeleech", action="store_true", help="not interested in the data, only in seeding")
|
||||
parser.add_argument("--archive", action="store_true", help="not interested in the data, except for archival")
|
||||
|
||||
@classmethod
|
||||
def from_arguments(self, args: Namespace) -> Self:
|
||||
|
@ -45,11 +49,14 @@ class MediaMeta:
|
|||
type_ = "vn"
|
||||
title = args.vn
|
||||
assert type_ is not None, "no torrent type specified!"
|
||||
assert not (args.freeleech and args.archive), "--freeleech and --archive are mutually exclusive"
|
||||
return MediaMeta(
|
||||
title=title,
|
||||
prefix=args.prefix,
|
||||
author=args.author,
|
||||
type_=type_,
|
||||
freeleech=args.freeleech,
|
||||
archive=args.archive,
|
||||
)
|
||||
|
||||
@property
|
||||
|
@ -63,7 +70,15 @@ class MediaMeta:
|
|||
)[self.type_]
|
||||
|
||||
def fs_path(self, base: str="/var/lib/uninsane/media/"):
|
||||
return os.path.join(base, self.prefix or "", self.type_path, self.author or "", self.title or "")
|
||||
return os.path.join(
|
||||
base,
|
||||
self.prefix or "",
|
||||
"archive" if self.archive else "",
|
||||
"freeleech" if self.freeleech else "",
|
||||
self.type_path,
|
||||
self.author or "",
|
||||
self.title or "",
|
||||
)
|
||||
|
||||
|
||||
def dry_check_output(args: list[str]) -> bytes:
|
||||
|
|
Loading…
Reference in New Issue
Block a user