diff --git a/catt/cli.py b/catt/cli.py index b1667f0..267ebf9 100644 --- a/catt/cli.py +++ b/catt/cli.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import click + from .controllers import get_stream_info, CastController, Cache @@ -44,12 +45,24 @@ def rewind(seconds): CastController().rewind(seconds) +@cli.command(short_help="Fastforward a video by SECS seconds.") +@click.argument("seconds", type=click.INT, required=False, default=30, metavar="SECS") +def ffwd(seconds): + CastController().ffwd(seconds) + + @cli.command(short_help="Seek the video to SECS seconds.") @click.argument("seconds", type=click.INT, metavar="SECS") def seek(seconds): CastController().seek(seconds) +@cli.command(short_help="Set the volume to LVL [0-1].") +@click.argument("level", type=click.FLOAT, required=False, default=0.5, metavar="LVL") +def volume(level): + CastController().volume(level) + + @cli.command(short_help="Show some information about the currently-playing video.") def status(): CastController().status() diff --git a/catt/controllers.py b/catt/controllers.py index 0571dcc..e35cb1b 100644 --- a/catt/controllers.py +++ b/catt/controllers.py @@ -86,6 +86,13 @@ def rewind(self, seconds): pos = self.cast.media_controller.status.current_time self.seek(pos - seconds) + def ffwd(self, seconds): + pos = self.cast.media_controller.status.current_time + self.seek(pos + seconds) + + def volume(self, level): + self.cast.set_volume(level) + def status(self): status = self.cast.media_controller.status.__dict__ if not status["duration"]: