Thank you for your donation!


Instruction Guide Play YouTube on Moode
#1
This is a simple how to on streaming YouTube on Moode.

Setup:

Code:
$ cd /home/pi

$ git clone https://github.com/duracell80/MoodeRadio-Get.git
$ cd scripts/yt-make
$ sudo chmod 755 ./install.sh
$ sudo ./install.sh

That's it you're all set!


Go to youtube.com on a desktop/laptop or tablet device find a video you want to listen to. 
Here's an example


  1. Knowing the IP address of your Moode Player ... Open a new browser tab
  2. Enter into the address bar of your browser the following then hit enter (you can copy paste the example below)
Code:
http://192.168.<your-ip>/yt-play/?type=cast&src=https://www.youtube.com/watch?v=c0KYU2j0TM4


Wait and your player will start playing that video as audio only!! That's it. You've successfully sent audio from YouTube to Moode! If you don't want to create playlists of your favourite YouTube pages you can stop reading this how-to now, you've successfully used this feature. If you're a bit more adventurous and want to start building playlists so you can launch them directly in Moode without using a browser anymore, continue on.

IF you are curious about how this works do this ...

Code:
http://192.168.2.7/yt-play/?type=info&src=https://www.youtube.com/watch?v=c0KYU2j0TM4

Then take a headache pill Smile

Playlists are groups of these URL's nothing more.





Build your own Playlists

Ok it gets really interesting now. Look in the RADIO or the Playlists folder. 

   

There are examples in both (in RADIO look at example-streaming.m3u, in Playlists look at YouTube_Load.m3u). If you're not comfortable writing a playlist from scratch you could copy paste one of the files and edit only the youtube.com sections to add your "Video ID" and change the track titles. Now Instead of using the IP address of your player as above use localhost and write the URL as:

Code:
http://localhost/yt-play/?type=stream&src=https://www.youtube.com/watch?v=c0KYU2j0TM4

  • Save the .m3u file you are editing
  • Run "mpc update" from the command line. 
  • Navigate to where the playlist is in Moode say you edited or copied the YouTube_Load playlist, use the first tab in Moode like:

   

  1. Next to the playlist name, just click the icon to bring up a menu then select Clear/Play.
  2. Wait about 30 seconds per item, because it's doing some stuff
  3. Your playlist will then start playing.

If after several hours or days you want to re-listen to the playlist, repeat step 1 (Clear/Play).

   

If you're curious in what's actually playing, it's playing from the YouTube_Play playlist. There's a bunch of gibberish in there, don't worry about it. If you delete the YouTube_Play playlist you may break the functionality if you don't use the src=-1 and src=1 lines in the M3U you'll have a more frustrating time (these run stuff so you don't have to). You can delete the YouTube_Load or keep it as an example. In the case of several hours passing on by after listening, do not play the YouTube_Play playlist, it will not work. Use the playlist you created.

Look at the Youtube URL itself the v= is the "Video ID" this and the track title is all you need to change in the example files!! It could not be any easier than that right? Creating a new list is as easy as copying an existing one and keeping it in your Playlist or RADIO folder using Windows Explorer or finder on a Mac. If you're not sure how to access Moode's file shares, please search the web on "how to access fileshares and network drives". It's worth knowing because this is how you can copy your own music to a USB drive attached to the pi.
  • That's it. It's real easy.
--

GitHub : @duracell80
Spotify : @duracell80
Reply
#2
Added support for actual YouTube Playlists as well. Take this YT page as an example. The list= section contains the list ID:

Code:
https://www.youtube.com/playlist?list=PLKK4T0Fm7nwGEZUZtQn7hbciVbN6hkVFl

Copy the list ID and do this in a browser on a laptop/tablet with the IP address of your player ...

Code:
http://192.168.2.227/yt-play/?type=list&src=PLKK4T0Fm7nwGEZUZtQn7hbciVbN6hkVFl

Wait a few seconds for the script to get the JSON and transfer the audio streams to YouTube_Play. If you're happy that you can cast YouTube Playlists from a browser to your player just stop now that's it, there's nothing else to do.

If however you want to collect these Playlists into a "Moode playlist" you can (it's optional), just change the IP address to localhost. There's an example called in Mahogany in RADIO called "yt-example-list.m3u" Here's what it looks like, it's pretty simple to then collect and share a bunch of interesting playlists. If you write a playlist save it in the Radio folder under _YouTube and to play it you do Clear/Play from the menu:

Code:
#EXTM3U

#EXTINF:-1, Contacting YouTube, Please Wait
http://localhost/yt-play/?type=list&src=PLKK4T0Fm7nwGEZUZtQn7hbciVbN6hkVFl
--

GitHub : @duracell80
Spotify : @duracell80
Reply


Forum Jump: