Skip to content

Commit a1e4b90

Browse files
committed
play: allow selecting a specific season of media
1 parent 526c984 commit a1e4b90

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

amt/args.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def setup_subparsers(state, sub_parsers):
100100
sub_consume_parsers.add_argument("--shuffle", "-s", default=False, action="store_const", const=True)
101101
sub_consume_parsers.add_argument("--stream-index", "-q", default=0, type=int)
102102
sub_consume_parsers.add_argument("--volume", default=False, action="store_const", const=True)
103+
sub_consume_parsers.add_argument("--season", dest="season_number", type=int)
103104
sub_consume_parsers.add_argument("--raw", default=False, action="store_const", const=True)
104105
sub_consume_parsers.add_argument("--special", default=None, action="store_const", const=True)
105106
sub_consume_parsers.add_argument("--nospecial", default=None, dest="special", action="store_const", const=False)

amt/media_reader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,15 @@ def maybe_resolve_media_type(self, media_data, media_type_filter=None):
471471
media_data["media_type"] = media_type.value
472472
media_data["media_type_name"] = media_type.name
473473

474-
def play(self, name=None, media_type=None, shuffle=False, limit=None, num_list=None, stream_index=0, raw=False, special=None, any_unread=False, force_abs=False, force_stream=False, volume=False, batch_size=1, **download_chapter_args):
474+
def play(self, name=None, media_type=None, shuffle=False, limit=None, num_list=None, season_number=None, stream_index=0, raw=False, special=None, any_unread=False, force_abs=False, force_stream=False, volume=False, batch_size=1, **download_chapter_args):
475475
num = 0
476476
batch = []
477477
server_media_chapters = []
478478
for info in self.get_chapters(name, media_type=media_type, num_list=num_list, limit=limit, shuffle=shuffle, any_unread=any_unread, force_abs=force_abs, volume=volume, null_terminate=True):
479479
if info:
480480
server, media_data, chapter = info
481+
if season_number is not None and chapter["volume_number"] != season_number:
482+
continue
481483
if special is not None and chapter["special"] != special:
482484
continue
483485
self.maybe_resolve_media_type(media_data, media_type)

0 commit comments

Comments
 (0)