DEV Community

Cover image for Day 12 - Automatically resume last played video in vlc - 100 days 100 python scripts
Ganesh Raja
Ganesh Raja

Posted on

Day 12 - Automatically resume last played video in vlc - 100 days 100 python scripts

Day 12: resume_vlc

If you are annoyed by opening recently played videos again and again it's the script for you. You can schdule this script so whenever you open your system it will automatically resume that last player vlc video with the paused seconds.

import configparser from constants import configFilePath #Vlc configuarion file path import os, urllib.parse configParser = configparser.RawConfigParser() configParser.read([configFilePath]) recent=configParser["RecentsMRL"] last_watched=recent["list"].split(",") time_list=recent["times"].split(",") if len(last_watched) >0 and len(time_list): p=(urllib.parse.urlparse(last_watched[0])) finalPath = urllib.parse.unquote(p.path) last_stopped_seconds=int(time_list[0])/1000 if last_stopped_seconds >5: last_stopped_seconds=last_stopped_seconds-5 # Go back 5 secs  os.system("vlc --start-time="+str(last_stopped_seconds)+" '"+finalPath+"'") 
Enter fullscreen mode Exit fullscreen mode

Please Visit my Git Repo to check out all the previous day challenges.

https://github.com/ganeshraja10/automated-python-scripts

Top comments (0)