MPDTube: Difference between revisions

From NURDspace
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 10: Line 10:
== What ==
== What ==


A small program that runs on the [[SlabPi|SlabPI]] that takes input from [[MQTT]] and feeds it to youtube-dl which in turn puts the extracted audio into MPD.
A small program that runs on the [[Spacesound|Spacesound]] that takes input from [[MQTT]] and feeds it to youtube-dl which in turn puts the extracted audio into MPD.


== Where ==
== Where ==
Line 16: Line 16:


== Usage ==
== Usage ==
MQTT Server: arbiter.vm.nurd.space
MQTT Server: mqtt.vm.nurd.space


Send a MQTT message to the topic '''mpd/youtube-dl/play''', the video will be automatically downloaded and have the audio extracted and then put in MPD's current playlist. If random mode is enabled, the song will get the highest priority so that it gets played next, songs get added with the highest priority (256), once a song has already been queued with priority 256, the next song will be at priority 255 and so on. If MPD is in normal mode, it will put the song as the next in the list. And if MPD is not playing, it will start playing the song right away.
Send a MQTT message to the topic '''mpd/youtube-dl/play''', the video will be automatically downloaded and have the audio extracted and then put in MPD's current playlist. If random mode is enabled, the song will get the highest priority so that it gets played next, songs get added with the highest priority (256), once a song has already been queued with priority 256, the next song will be at priority 255 and so on. If MPD is in normal mode, it will put the song as the next in the list. And if MPD is not playing, it will start playing the song right away.
Line 22: Line 22:
If you want to monitor the output, you can as MPDTube publishes the information to mpd/youtube-dl/status/# (/info, /warning and /error).
If you want to monitor the output, you can as MPDTube publishes the information to mpd/youtube-dl/status/# (/info, /warning and /error).


You can now also use it on IRC with the command !mpdtube, although currently it does not report back anything but the plan is to add this soon!
You can now also use it on IRC with the command !mpdtube.


== Input ==
== Input ==
You can give anything that youtube-dl supports, which includes soundcloud. You can see a full list over [https://ytdl-org.github.io/youtube-dl/supportedsites.html here]. You can also search for youtube videos buy using '''ytsearch:kinderen voor kinderen''', it will pick the top most result.  
You can give anything that youtube-dl supports, which includes soundcloud. You can see a full list over [https://ytdl-org.github.io/youtube-dl/supportedsites.html here]. You can also search for youtube videos by using '''ytsearch:kinderen tegen kinderen''', it will pick the top most result.  
Although it seems that not everything works properly yet such as Pornhub.
Although it seems that not everything works properly yet such as Pornhub.


== Todo ==
== Omg it Died! ==  
- Spotify song to youtube integration? (Requires a user token, though)


- Proper queuing when not running in random mode
If mpdtube suddenly doesnt find anything anymore, probably youtube-dl needs a update. MPDTube doesnt have any methods for that yet so you need to do it manually :


- Add tags to the final files
as root on slabpi :
$ pip3 install youtube-dl --upgrade
$ service mpdtube restart


- Clean up older files after 30 days or so
== Todo ==
 
- rewrite this text
- Probably still need to fix when MPD is not in random mode
- Upload version 2 to github
 
- Update the githubz


== Source ==
== Source ==
You can get the source code [https://github.com/Melanpan/MPDTube here]
You can get the source code [https://github.com/Melanpan/MPDTube here]

Latest revision as of 18:48, 1 November 2022

mpdtube
Mpdtube.jpg
Participants Melan
Skills Python, Linux
Status Active
Niche Music
Purpose Infra
Tool No
Location
Cost
Tool category General

mpdtube Property "Tool Image" (as page type) with input value "File:{{{Picture}}}" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process. {{{Picture}}} {{#if:No | [[Tool Owner::{{{ProjectParticipants}}} | }} {{#if:No | [[Tool Cost::{{{Cost}}} | }}

What

A small program that runs on the Spacesound that takes input from MQTT and feeds it to youtube-dl which in turn puts the extracted audio into MPD.

Where

It runs in /home/pi/mpdtube and as a systemd service called mpdtube.

Usage

MQTT Server: mqtt.vm.nurd.space

Send a MQTT message to the topic mpd/youtube-dl/play, the video will be automatically downloaded and have the audio extracted and then put in MPD's current playlist. If random mode is enabled, the song will get the highest priority so that it gets played next, songs get added with the highest priority (256), once a song has already been queued with priority 256, the next song will be at priority 255 and so on. If MPD is in normal mode, it will put the song as the next in the list. And if MPD is not playing, it will start playing the song right away.

If you want to monitor the output, you can as MPDTube publishes the information to mpd/youtube-dl/status/# (/info, /warning and /error).

You can now also use it on IRC with the command !mpdtube.

Input

You can give anything that youtube-dl supports, which includes soundcloud. You can see a full list over here. You can also search for youtube videos by using ytsearch:kinderen tegen kinderen, it will pick the top most result. Although it seems that not everything works properly yet such as Pornhub.

Omg it Died!

If mpdtube suddenly doesnt find anything anymore, probably youtube-dl needs a update. MPDTube doesnt have any methods for that yet so you need to do it manually :

as root on slabpi : 

$ pip3 install youtube-dl --upgrade
$ service mpdtube restart

Todo

- rewrite this text

- Upload version 2 to github

Source

You can get the source code here