Skip to main content

Mopidy extension for YouTube

Project description

Latest PyPI version CircleCI build status Test coverage

Mopidy extension that plays sound from YouTube.

Installation

Install from PyPI by running:

python3 -m pip install Mopidy-Youtube

Install from github by running:

python3 -m pip install https://github.com/natumbri/mopidy-youtube/archive/develop.zip

Make sure you already have the GStreamer plugins, especially the “bad” collection of plugins. For example, on Debian/Ubuntu you can install it by running:

sudo apt-get install gstreamer1.0-plugins-bad

Configuration

Before starting Mopidy, you must add configuration for Mopidy-YouTube to your Mopidy configuration file:

[youtube]
enabled = true

If you want modipy-youtube to use the YouTube API, before starting Mopidy, you must add your Google API key to your Mopidy configuration file and set api_enabled = true:

[youtube]
youtube_api_key = <api key you got from Google>
api_enabled = true

If you want modipy-youtube to use YouTube Muisc, instead of regular YouTube, set musicapi_enabled = true:

[youtube]
musicapi_enabled = true

Other configuration options are:

[youtube]
threads_max = 16            : number of parallel threads to run
search_results = 15         : maximum number of search results to return
playlist_max_videos = 20    : maximum number of videos in a playlist to return

mopidy-youtube can automatically play ‘related’ tracks after the last track in the play queue is played. If you want mopidy-youtube to autoplay related videos, set autoplay_enabled = true:

[youtube]
autoplay_enabled = true

If autoplay is enabled, other options are:

strict_autoplay = [true/false]
max_autoplay_length = [maximum length of track in seconds or None]
max_degrees_of_separation = [defaults to 3]

If the option strict_autoplay is set, the current tracklist is ignored and the most related video automatically played afterwards.

Max degrees of separation controls how distantly related to the track that triggered autoplay the autoplayed tracks can be.

Usage

Simply use search for filename in your MPD client or add YouTube URL or URI to playlist prefixed by yt: or youtube:.

Example video:

[yt|youtube]:<url to youtube video>
[yt|youtube]:video:<id>
[yt|youtube]:video/<title>.<id>

Example for playlist:

[yt|youtube]:<url to youtube playlist>
[yt|youtube]:playlist:<id>
[yt|youtube]:playlist/<title>.<id>

Troubleshooting

If the extension is slow, try setting lower values for threads_max, search_results and playlist_max_videos.

If resolving of URIs stops working, always try to update the youtube-dl library first.

Project resources

Credits

Project details


Download files

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

Files for Mopidy-YouTube, version 3.3
Filename, size File type Python version Upload date Hashes
Filename, size Mopidy_YouTube-3.3-py2-none-any.whl (34.9 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size Mopidy_YouTube-3.3-py3-none-any.whl (28.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size Mopidy-YouTube-3.3.tar.gz (1.8 MB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page