Current API Version: 1.0.1 PyPI
Current API functions:
connect()
: Starts the connection to VLC on specified host and portsend(command)
: Sends command to VLCdisconnect()
: Disconnects from VLCshutdown()
: Ends the connection and shuts down VLCis_alive()
: Returns True if the connection is alive else Falselist_commands()
: Lists supported commands that can be executed by VLC
- Open VLC Media Player
- Click Tools on Menu Bar
- Click on Preferences
- On the bottom left of popup window, under 'show settings' click on All
- In the left menu expand 'Interfaces' and click on Main Interfaces
- IMPORTANT: In main interfaces, checkmark on 'Telnet'
- Expand 'Main Interfaces' on the left pane and click on 'Lua'
- On the right pane configure 'Lua Telnet'
- Lua Interface:
dummy
- Host:
localhost
or127.0.0.1
for same computer or set remote IP - Port:
4212
is default, you can leave it as is or configure any other port if required - Password: Set your password
- Lua Interface:
- Click on Save
from PyVLC.PyVLC import PyVLC
The library works asynchronously hence you will need to explicitly import asyncio
(import asyncio
) for asynchronous functioning and call the object functions with async/await syntax.
Example:
from PyVLC.PyVLC import PyVLC
import asyncio
VLC = PyVLC()
async def runner():
await VLC.connect()
while True:
com = input("VLC> ")
if com == "quit" or com == "exit":
await VLC.disconnect()
break
await VLC.send(com)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(runner())
This project is distributed under the MIT License. See LICENSE for details.