Help Setting Up Ability to Play MP3s from Raspberry Pi in webCoRE


#1

I am trying to play MP3s from a USB flash drive connected to my Raspberry Pi. I don’t have a coding background, but can manage to do basic commands, etc.

Previously, I was using Netgear’s built-in “readyshare” service that allowed me to connect and play MP3s from a USB drive plugged into my router on my phone/PC/web browser. I just switched my router over to dd-wrt firmware, and want to move the USB drive to my Raspberry Pi 4.

I have the following already installed and able to use for this on my Raspberry Pi. I can play mp3’s from my phone/PC but not and web browser. I can’t figure out the correct URL and settings to use when playing a track in webCore.

  • SSH enabled
  • samba server running
  • vsftpd ftp server running
  • Kodi installed
  • Logitech Media Server w/ squeezebox and Chromecast add-in

Any help using one of the above to help accomplish this would be much appreciated!

P.S. There might be an easy fix to this, but I don’t know much other than just following others directions from the internet, and I’m stumped at this point. I don’t know if it’s an issue with the new dd-wrt install, or how I’ve set up my servers.


#2

I have struggled with this for years. I have all of my music files on a thumb drive plugged into my RPi. I use Kodi to play my files. I use the Kodi API. It took quite a while to figure all of this out (with lots of help from members here and the Kodi forum). But it works well now, even with playlists. If you are interested, I can assist you with this. Here is an example of a POST to my Kodi. I have a Playlist_Variable that is used based on which playlist I want. You can also just play individual songs.


#3

Thanks for the reply so quickly. I actually saw a post from you where this is mentioned via Kodi.

I would love any help you can offer to set this up that way. Honestly, I was hoping to figure out a way to just use a URL like before to make it easy, but the ability to play playlists is really cool.

I have Kodi installed, but only running when needed at this point. The usb drive is mounted to a specific folder within home/pi.


#4

I would start by reading through Kodi Application > JSON-RPC > Working JSON RPC API Examples (lots of stuff but very helpful). I don’t want to give you the idea that I understand all of this. I plagiarized most of the JSON stuff and I really don’t understand it all. I’m not a networking guy, so I struggle there as well. But what I have works well and I am happy to help you along.


#5

Thanks for the link. I forgot to mention I also have Logitech Media Server with Squeezelite running, and it accepts JSON-RPC as well. I read through the link you provided, and some LMS examples I found.

I’m trying to do the following for now: 1.call a specific mp3 to play an alert; 2. call a specific playlist to either just play or shuffle play. I’ve figure out #1 by using the LMS miniDLNA plugin, but I’d really like to do it all through JSON-RPC.

Do you have any working examples you could share that might help?


#6

I have plenty of working examples/help for you. When I get to my computer later I will post some things for you.


#7

First, I use this Kodi ST app. : https://community.smartthings.com/t/release-kodi-for-smartthings-beta/38305
It is Groovy, so not sure how much longer it will run on ST.
I was not able to get the webcore commands Play, Play track or playPlaylist to work for me (see below). It’s probably a syntax problem on my end. That is the reason I started using the Kodi API. You may have a different experience. However, several Kodi commands do work, like Next track, Previous track (see piston below)…so you can experiment.

I would start by playing a single file so that you can confirm that the path to your music is correct in your JSON. All of my music is in a folder (MUMPMUSIC) on my RPi and my playlists are in a folder within MUMPMUSIC. It is VERY easy to miss a { or } or " \ " in your JSON string. So pay special attention to your syntax.
This piston announces that someone is in my driveway. It plays a single mp3 file.

This piston plays a playlist…

The Kodi API has worked nearly flawlessly for me.There are MANY other options available for playing audio files, especially if you have something like the Bose system.

This piston uses Next track without doing an API call.


#8

This is helpful, especially the " \ " in the JSON string.

So, I’ve decided that since I use LMS more than Kodi and it’s JSON RPC capable as well, that I’d like to go that route. Below is a simple piston I’m trying to get working just to see if I can make a player play, but having no luck. Would anywhere in either webCoRE or LMS logs help me with this? I’ve based the string text from your examples, as well as this: https://gist.github.com/samtherussell/335bf9ba75363bd167d2470b8689d9f2


#9

I tried several DLNA ST smartapps when I was trying to get this to work. I had varied success with all of them. Ultimately, I settled on the Kodi API and my RPi system. I do not know anything about LMS. However, from the github site you posted above I see…

Once you have obtained the “id” of the music you want to play, you can set it to play on a squeezebox:

- [“playlistcontrol”, “cmd:”+<cmd>, “artist_id:”+<artist_id>]

- [“playlistcontrol”, “cmd:”+<cmd>, “album_id:”+<album_id>]

- [“playlistcontrol”, “cmd:”+<cmd>, “track_id:”+<track_id>]

I do not see any music “id” in your POST. Maybe the post you made to the LMS author at the github above will provide helpful information. And I agree, I would suggest playing a single music file first. Once that is working, then I would attempt a playlist. YMMV.


#10

I don’t think you need the \ with your [ or ]


#11

What I’m confused about is what/how to enter the data. For example, I’m unsure of what it would look like if I filled in one of the examples you posted. What do I fill in for “playlistcontrol”, etc. and how would it look like if I typed into webCoRE?


#12

I’m sorry, but I do not have any way to test JSON for the Logitech SqueezeServer since I don’t have one. Maybe someone who uses it will chime in here.


#13

Would you know if it would look like [“playlistcontrol”, “cmd:” play, “track_id:” XXXXX]