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

1 1

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

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more