EugeneDae / VLC-Scheduler

Basic automation & scheduling for VLC media player. [Currently not actively maintained].
MIT License
68 stars 18 forks source link
vlc vlc-media-player vlc-player

VLC Scheduler

DOWNLOAD / Windows & macOS / current version: 0.3.2.

Do you have a TV screen that plays media content non-stop? Do you want some of the content to play in the morning, and the rest during the rest of the day? Do you want to add new content to VLC as easily as dragging the file into a folder? VLC Scheduler, which is a tiny companion to the world’s best open source media player VLC, was made exactly for such purposes.

VLC Scheduler

VLC Scheduler works with directories rather than individual media files. It scans the directories specified in its configuration file for media content, composes its own playlist and “feeds” it to VLC file-by-file.

You can share a directory with TV screen content over the local network (for example, via SMB or FTP) with your coworkers or family members. When they add or remove media files, VLC Scheduler would track those changes and update its playlist accordingly.

Features

Caveats

Installation & configuration

  1. Download the latest version. vlcscheduler-win.zip is for Windows, vlcscheduler-mac.zip is for macOS. If you’re on Linux, see Running & building the script.
  2. Edit vlcscheduler.yaml as per your needs.

vlcscheduler.yaml

vlcscheduler.yaml must reside at the same level as the program itself. (Advanced users, who want to move the configuration file to another location, should set the environment variable VLCSCHEDULER_YAML to the full path that includes the filename of the configuration file).

macOS High Sierra/Mojave users: if you're getting the following error: FileNotFoundError: Cannot find <...> vlcscheduler.yaml in any of these places: <...>/T/AppTranslocation/<...>, see the solution here.

The configuration must be expressed in YAML — if you don’t know anything about this format, read up on it a bit.

The only required parameter is sources. In VLC Scheduler’s terms, a source is a path to the directory with media files, followed by the parameters that define how VLC Scheduler should play those media files.

Minimal configuration example:

sources:
    - path: C:\Users\Administrator\Desktop\Videos

Now, let’s set playing_time:

sources:
    - path: C:\Users\Administrator\Desktop\Videos
      playing_time: 09:00-22:00

Not hard, right? See also example.yaml.

Per source configuration

These parameters are set for each source individually.

path(required) absolute path to the directory with media files. ~/ and variables are not supported.

playing_time: HH:MM-HH:MM(optional) the time interval during which the media files from the directory should be played. Use 24-hour clock. Example: playing_time: 09:00-22:00 (from 9 AM to 10 PM).

shuffle: true/false(optional) if set to true, shuffles the media files from each directory. If set to false, VLC Scheduler will get the files in alphabetic order. Default: false.

recursive: true/false(optional) if set to true, recurses into subfolders of each directory. Default is value of global config media_recursive which is itself defaulted to false.

special: true/false(optional) if set to true, marks a directory as special. Special directories are meant to stay empty most of the time. When a media file is added to such directory, VLC Scheduler puts aside all non-special content and only plays that file until it’s removed from its directory. Default: false.

item_play_duration: seconds(optional) how much screen time each media file (an image or a video) should be given.

Example: item_play_duration: 120 (120 seconds = 2 minutes).

play_every_minutes: minutes(optional) the content will be played only after X minutes. Such content is internally referred to as “ads”. If there is no content other than the “ads”, VLC Scheduler won’t play anything. VLC Scheduler doesn’t “pause” the currently playing media file to play “ads” — instead it waits for the media file to complete. The use of this parameter in conjunction with special: true is not supported. Example: play_every_minutes: 30.

General configuration

These parameters are set globally.

source_mixing_function: "function_name"(optional) If you don’t want VLC Scheduler to ensure equal occurrence of the sources in the playlist, change this to chain. Default value: zip_equally.

media_extensions: [...](optional) a list of filename extensions that defines the kinds of media files that VLC Scheduler should be looking for when scanning the directories listed in sources. Note that each filename extension should be prepended with a dot and written in lowercase. Note that VLC Scheduler does not understand that .jpeg and .jpg belong to the same file format. Example: media_extensions: ['.mp4', '.avi', '.jpeg', '.jpg']. For the default list of extensions see defaults.py.

media_recursive: true/false(optional) sets the default value for recursion of all sources. Default: false

playlist_extensions: [...](optional) a list of filename extensions that defines the kinds of playlist files that VLC Scheduler should be looking for when scanning the directories listed in sources. Note that each filename extension should be prepended with a dot and written in lowercase. Example: playlist_extensions: ['.xspf', '.m3u']. For the default list of extensions see defaults.py.

ignore_playing_time_if_playlist_is_empty: true/false(optional) if set to true, VLC Scheduler will ignore playing_time of the sources if the playlist is empty. Default value: false.

image_play_duration: seconds(optional) how long an image should be displayed on the screen if item_play_duration is not set for the source. Default value: 60.

vlc(optional) a dictionary of VLC-related parameters.

ping_urls(optional) a list of URLs to ping with the filename being started. Sends a JSON body as an HTTP POST. The JSON is simply {"name": "FILE_PATH"}.

vlc:
    # Path to VLC
    path: '/Applications/VLC.app/Contents/MacOS/VLC'

    # VLC HTTP server host — change only if you know what you’re doing
    host: '127.0.0.1'

    # VLC HTTP server port — change only if you know what you’re doing
    port: 8080

    # VLC HTTP server password — change if you need more security
    password: 'vlcremote'

    # Extra interfaces — change only if you know what you’re doing
    extraintf: 'http,luaintf'

Running & building the script

(Advanced users only).

Python

Check your Python version with: python3 --version.

If you want to make a binary, make sure to have Python 3.6 (see https://www.python.org/downloads/), because PyInstaller, the tool used to make VLC Scheduler into a binary, does not support Python 3.7 yet (as of writing).

If you just want to run VLC Scheduler as a Python script, you can use either Python 3.6 or 3.7.

Running

  1. Check if you already have virtualenv: virtualenv --version. If you don’t:

    pip3 install virtualenv
  2. Download and extract the source code (or do git clone) and cd into the directory.

  3. Create a new virtual environment and activate it.

    macOS or any other *nix:

    virtualenv venv --python=python3
    source venv/bin/activate

    Windows:

    virtualenv venv --python=python3
    call venv\Scripts\activate
  4. Install the dependencies:

    pip install -r requirements.pip
  5. Create vlcscheduler.yaml and add at least one path to sources.

  6. Run the script:

    python src/vlcscheduler.py

Building

On Windows:

Make.bat

On macOS:

make

In theory make should also work on Linux, but it hasn’t been tested.

If everything goes fine, you will find either vlcscheduler.exe (on Windows) or VLC Scheduler.app (on macOS) in dist directory.

Credits & license

Created by Eugene / Dae (dae@dae.me).

VLC folder icon by scafer31000.

License: MIT, see LICENSE.

Special thanks to: