Skip to content Skip to sidebar Skip to footer

How To Control Vlc With Python When Already Open

I have a code that will successfully open VLC, fullscreen it, add media, etc, all in one line -like this (excerpt from longer code): p = subprocess.Popen(['C:/Program Files (x86)/V

Solution 1:

I did a python module to solve this; televlc

    ~$ pip install televlc

Creating a vlc instance and interface, then connecting

import televlc

    # Initialize the vlc object
    vlc = televlc.VLC()

    # Open a VLC instance and create the telnet interface
    vlc.start_telnet_interface()

    # Connect to the telnet interface
    vlc.connect_to_telnet_interface()

    # Run a command (volume up)
    vlc.do(["volup", "50"])

    # Disconnect from telnet interfac
    vlc.disconnect_from_telnet_interface()
    # or
    vlc.do(["exit"])
    # or end VLC instance and telnet interface
    vlc.do(["shutdown"])

Connecting to an existing vlc instance and interface

this is the command to create the existing instance and interface outside the script

    ~$ vlc --extraintf --telnet --telnet-password myPassword --telnet-host myHost --telnet-port myPort
import televlc

    # Set the interface data
    PASSWORD = myPassword
    HOST = myHost
    PORT = myPort

    # Initialize the vlc object
    vlc = televlc.VLC(PASSWORD, HOST, PORT)

    # Run a command
    command = ["volup", "50"]
    vlc.do(command)

    # Quit
    vlc.disconnect_from_telnet_interface()

Post a Comment for "How To Control Vlc With Python When Already Open"