sane-bt-add: support "--other $NAME" torrent types
This commit is contained in:
@@ -14,10 +14,11 @@ logger = logging.getLogger(__name__)
|
|||||||
TORRENT_DIR="/var/media/torrents"
|
TORRENT_DIR="/var/media/torrents"
|
||||||
|
|
||||||
class MediaType(Enum):
|
class MediaType(Enum):
|
||||||
Film = "film"
|
|
||||||
Show = "show"
|
|
||||||
Book = "book"
|
|
||||||
Audiobook = "audiobook"
|
Audiobook = "audiobook"
|
||||||
|
Book = "book"
|
||||||
|
Film = "film"
|
||||||
|
Other = "other"
|
||||||
|
Show = "show"
|
||||||
VisualNovel = "vn" # manga/comics
|
VisualNovel = "vn" # manga/comics
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -31,32 +32,38 @@ class MediaMeta:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument("--prefix", help="additional path component before anything implied by the other options (but after the base media dir")
|
|
||||||
parser.add_argument("--film", help="Film.Title-year")
|
|
||||||
parser.add_argument("--show", help="Show.Title")
|
|
||||||
parser.add_argument("--book", help="Book.Title")
|
|
||||||
parser.add_argument("--audiobook", help="Audiobook.Title")
|
parser.add_argument("--audiobook", help="Audiobook.Title")
|
||||||
|
parser.add_argument("--book", help="Book.Title")
|
||||||
|
parser.add_argument("--film", help="Film.Title-year")
|
||||||
|
parser.add_argument("--other", help="Name")
|
||||||
|
parser.add_argument("--show", help="Show.Title")
|
||||||
parser.add_argument("--vn", help="Visual.Novel.Title (for comics/manga)")
|
parser.add_argument("--vn", help="Visual.Novel.Title (for comics/manga)")
|
||||||
|
|
||||||
parser.add_argument("--author", help="Firstname.Lastname")
|
parser.add_argument("--author", help="Firstname.Lastname")
|
||||||
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")
|
parser.add_argument("--archive", action="store_true", help="not interested in the data, except for archival")
|
||||||
|
parser.add_argument("--freeleech", action="store_true", help="not interested in the data, only in seeding")
|
||||||
|
parser.add_argument("--prefix", help="additional path component before anything implied by the other options (but after the base media dir)")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_arguments(self, args: Namespace) -> Self:
|
def from_arguments(self, args: Namespace) -> Self:
|
||||||
title = None
|
title = None
|
||||||
type_ = None
|
type_ = None
|
||||||
if args.film:
|
|
||||||
type_ = MediaType.Film
|
|
||||||
title = args.film
|
|
||||||
if args.show != None:
|
|
||||||
type_ = MediaType.Show
|
|
||||||
title = args.show
|
|
||||||
if args.book != None:
|
|
||||||
type_ = MediaType.Book
|
|
||||||
title = args.book
|
|
||||||
if args.audiobook != None:
|
if args.audiobook != None:
|
||||||
type_ = MediaType.Audiobook
|
type_ = MediaType.Audiobook
|
||||||
title = args.audiobook
|
title = args.audiobook
|
||||||
|
if args.book != None:
|
||||||
|
type_ = MediaType.Book
|
||||||
|
title = args.book
|
||||||
|
if args.film:
|
||||||
|
type_ = MediaType.Film
|
||||||
|
title = args.film
|
||||||
|
if args.other:
|
||||||
|
type_ = MediaType.Other
|
||||||
|
title = args.other
|
||||||
|
if args.show != None:
|
||||||
|
type_ = MediaType.Show
|
||||||
|
title = args.show
|
||||||
if args.vn != None:
|
if args.vn != None:
|
||||||
type_ = MediaType.VisualNovel
|
type_ = MediaType.VisualNovel
|
||||||
title = args.vn
|
title = args.vn
|
||||||
@@ -74,10 +81,11 @@ class MediaMeta:
|
|||||||
@property
|
@property
|
||||||
def type_path(self) -> str:
|
def type_path(self) -> str:
|
||||||
return {
|
return {
|
||||||
MediaType.Film: "Videos/Film/",
|
|
||||||
MediaType.Show: "Videos/Shows/",
|
|
||||||
MediaType.Book: "Books/Books/",
|
|
||||||
MediaType.Audiobook: "Books/Audiobooks/",
|
MediaType.Audiobook: "Books/Audiobooks/",
|
||||||
|
MediaType.Book: "Books/Books/",
|
||||||
|
MediaType.Film: "Videos/Film/",
|
||||||
|
MediaType.Other: "Other/",
|
||||||
|
MediaType.Show: "Videos/Shows/",
|
||||||
MediaType.VisualNovel: "Books/Visual/",
|
MediaType.VisualNovel: "Books/Visual/",
|
||||||
}[self.type_]
|
}[self.type_]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user