aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-07-05 21:48:13 -0700
committerFuwn <[email protected]>2025-07-05 21:48:13 -0700
commitc9ada40f096d7882765ee7ae2297d5b631202645 (patch)
tree83672b0e185b68cbdcede8ec47495b2bba36090a
parentfeat(schedule): Exact time flag (diff)
downloadoguri-c9ada40f096d7882765ee7ae2297d5b631202645.tar.xz
oguri-c9ada40f096d7882765ee7ae2297d5b631202645.zip
feat(schedule): Show all airing episodes by default
-rw-r--r--src/oguri/cli.py5
-rw-r--r--src/oguri/schedule.py7
2 files changed, 8 insertions, 4 deletions
diff --git a/src/oguri/cli.py b/src/oguri/cli.py
index c2224b9..39ed026 100644
--- a/src/oguri/cli.py
+++ b/src/oguri/cli.py
@@ -17,7 +17,8 @@ def cli():
@click.option(
"--exact", is_flag=True, help="Show exact airing times instead of relative times."
)
-def schedule(day, reverse, exact):
[email protected]("--first", is_flag=True, help="Show only first airing episodes.")
+def schedule(day, reverse, exact, first):
"""
Shows the airing schedule for a given day.
@@ -38,7 +39,7 @@ def schedule(day, reverse, exact):
'DAY must be "today", "tomorrow", "yesterday", or an integer.'
)
- asyncio.run(schedule_logic.show_schedule(days_offset, reverse, exact))
+ asyncio.run(schedule_logic.show_schedule(days_offset, reverse, exact, first))
def main_script():
diff --git a/src/oguri/schedule.py b/src/oguri/schedule.py
index ad718da..bfc12b9 100644
--- a/src/oguri/schedule.py
+++ b/src/oguri/schedule.py
@@ -12,7 +12,10 @@ from anilist_client.custom_queries import Query
async def show_schedule(
- days_offset: int, reverse_order: bool = False, exact_time: bool = False
+ days_offset: int,
+ reverse_order: bool = False,
+ exact_time: bool = False,
+ first_episode_only: bool = False,
):
client = Client(url="https://graphql.anilist.co")
start_of_day = datetime.now().replace(
@@ -22,7 +25,7 @@ async def show_schedule(
airing_schedules_query = Query.page().fields(
PageFields.airing_schedules(
airing_at_greater=int(start_of_day.timestamp()),
- episode=1,
+ episode=1 if first_episode_only else None,
airing_at_lesser=int(end_of_day.timestamp()),
).fields(
AiringScheduleFields.airing_at,