Skip to content

Commit

Permalink
Support seek to specific time from cli command
Browse files Browse the repository at this point in the history
  • Loading branch information
palaviv committed Oct 30, 2016
1 parent 65e25ca commit 0261896
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions caster.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,17 @@ def get_args():
' When not given first one found is used.',
default=None)
parser.add_argument('--subtitles', help='subtitles', default=None)
parser.add_argument('--seek', help='media starting position in seconds', default=0)
return parser.parse_args()


def main():
args = get_args()

file_path = args.file

device_name = args.device

subs = args.subtitles
seek = args.seek

if device_name:
dev = pychromecast.get_chromecasts_as_dict()[device_name]
Expand All @@ -146,7 +146,8 @@ def main():
mc = dev.media_controller

media_url = "http://{IP}:{PORT}/{URI}".format(IP=server_ip, PORT=server.server_port, URI=file_path)
mc.play_media(media_url, 'video/mp4', title=os.path.basename(file_path), subtitles=subtitles_url)
mc.play_media(media_url, 'video/mp4', title=os.path.basename(file_path), subtitles=subtitles_url,
current_time=seek)
mc.update_status(blocking=True)
mc.enable_subtitle(1)

Expand Down

0 comments on commit 0261896

Please sign in to comment.