Skip to main content

Control VLC media player via telnet from Python

Project description

televlc

                                                      ######                 
                                                ##################           
             ###                                ##    #############          
            #####                               ###################          
           #######                                       ##########          
          ********                     ############################  ****** 
         ***********                  ############################# *********
        ##*********##                ##############################  *********
       ###############   <-------->  ############                 *************
      *##############*                #########   *****************************
     *******************               ######### *****************************
     *******************                ######## ***************************  
 ####******************####                     *********                    
########***********#########                    *******************          
############################                    *************    **          
############################                     *****************
                                                      *******

Python library to control VLC media player via telnet protocol

Installation

    ~$ pip install televlc

Usage

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

create the vlc instance and interface in the terminal

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

connect via python

    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()

Commands

command description
add XYZ add XYZ to playlist
enqueue XYZ queue XYZ to playlist
playlist show items currently in playlist
search [string] search for items in playlist (or reset search)
delete [X] delete item X in playlist
move [X][Y] move item X in playlist after Y
sort key sort the playlist
sd [sd] show services discovery or toggle
play play stream
stop stop stream
next next playlist item
prev previous playlist item
goto, gotoitem goto item at index
repeat [on off] toggle playlist repeat
loop [on off] toggle playlist loop
random [on off] toggle playlist random
clear clear the playlist
status current playlist status
title [X] set/get title in current item
title_n next title in current item
title_p previous title in current item
chapter [X] set/get chapter in current item
chapter_n next chapter in current item
chapter_p previous chapter in current item
seek X seek in seconds, for instance `seek 12'
pause toggle pause
fastforward set to maximum rate
rewind set to minimum rate
faster faster playing of stream
slower slower playing of stream
normal normal playing of stream
rate [playback_rate] set playback rate to value
frame play frame by frame
fullscreen, f, F [on off] toggle fullscreen
info [X] information about the current stream (or specified id)
stats show statistical information
get_time seconds elapsed since stream's beginning
is_playing 1 if a stream plays, 0 otherwise
get_title the title of the current stream
get_length the length of the current stream
volume [X] set/get audio volume
volup [X] raise audio volume X steps
voldown [X] lower audio volume X steps
achan [X] set/get stereo audio output mode
atrack [X] set/get audio track
vtrack [X] set/get video track
vratio [X] set/get video aspect ratio
vcrop, crop [X] set/get video crop
vzoom, zoom [X] set/get video zoom
vdeinterlace [X] set/get video deinterlace
vdeinterlace_mode [X] set/get video deinterlace mode
snapshot take video snapshot
strack [X] set/get subtitle track
vlm load the VLM
description describe this module
help, ? [pattern] a help message
longhelp [pattern] a longer help message
lock lock the telnet prompt
logout exit (if in a socket connection)
quit quit VLC (or logout if in a socket connection)
shutdown shutdown VLC

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

televlc-0.2-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file televlc-0.2-py3-none-any.whl.

File metadata

  • Download URL: televlc-0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5

File hashes

Hashes for televlc-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f110fdcd4068aaa4b40739972097f3a801fbd35f222248db3eb31d2d6d003c67
MD5 07ce0904f0d280480c2b76463631ef17
BLAKE2b-256 e48b85913fd2a2da9164dabc086da522ad404feed0a68d82deaeb95f930460e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page