Resource icon

OBS Python VLC Song Information Query 20190610

Dagnus' rewrite from Hawezo's VLC Current Song script.

Latest version: 20190610

Installation Instructions

Python
  1. Install Python 3.6 64bits version (
    • Find the latest Python 64bit 3.6.x version here: https://www.python.org/downloads/
    • During installation, make sure to select adding Python to your PATH environment variable.
  2. Install Python's requests module:
    • Launch a windows command prompt
    • Install requests by typing: pip install requests
VLC
You need to configure VLC to expose its web interface so that the OBS script can access it.
  1. Install VLC 64bit if you haven't already done so: https://www.videolan.org/vlc/index.html
  2. Once install proceed with activating VLC's web interface:
    • Go to Tools > Preferences
    • Select "All" under Show settings
    • Go to Interface > Main interfaces
    • Check Web under Extra interface modules
    • Go to Interface > Main Interfaces > Lua
    • Set a Password under Lua HTTP
    • Set Source directory to something similar to C:\Program Files\VideoLAN\VLC\lua\http. If you installed VLC to its default location, this should be correct, otherwise you need to find VLC's install location and point to the same VLC\lua\http subdirectory as above.
    • Save settings and restart VLC
  3. The installation should be complete if you can access http://localhost:8080/requests/status.json in your browser.
OBS
  1. Download the script to a location where it will not move around.
  2. Launch OBS
  3. Go to Tools > Scripts
  4. Go to Python Settings and set your Python Install Path
  5. Go back to Scripts
  6. Add the script using the + button in the bottom left.
  7. Set in HTTP Username and HTTP Password what you configured in VLC before.
  8. Set HTTP URL if you have an unusual installation
OBS Script configuration
Once you have configured all the above, you should be good to go. Here are the options available to you:
  • Text Source: Select from your already created Text Sources where the song information will be displayed. This is basically the output of the script for the song information.
  • Song String: This is the field you use to describe what you want to display. VLC exposes through its web interface different meta tags for the currently playing songs. Because songs can have arbitrary tags, I can't provide an exhaustive list of tags available, but the following are common enough: %title, %artist, %album, %filename.
    You can combine these as you want in the Song String field to define the script output format. For example: Now Playing: %title - %artist
    If you want to find additional tags you can display for the song currently playing, you can check the data exposed in http://localhost:8080/requests/status.json under information > category > meta. Any word in Song String starting with a % will try to be replaced with a matching tag.
  • Image Source: Select from your already created Image Sources where the song cover art (if there is one) will be displayed.
  • Update Interval: This allows you to control how often the script will check VLC for a song change (in seconds).
There is a performance problem when VLC is not opened and the script tries to connect to its web interface. It will lead to the OBS interface becoming unresponsive for 2-3 seconds when that happens.
To help make it less of a problem, the script will double its update interval at each failure until it manages to connect. You can reset the update interval by modifying this value in the script configuration screen.
If it manages to connect again, the configured update interval will be restored.
Author
Dagnus
Downloads
2,688
Views
4,216
First release
Last update
Rating
0.00 star(s) 0 ratings
Top