P4d0uch
Posts: 47
Joined: Sun Sep 16, 2012 5:01 pm

Re: Raspberry Pi touchscreen mpd player

Tue May 19, 2015 6:31 am

mark-me wrote:
Thank you very much. I added that issue to the mopidy page. I really hope to fix it. I liked your project too... It does look consistent with the mopidy interface. What your project has, and mine is lacking, is the Spotify support. Some people have been asking for me to integrate it into pi-jukebox, and I'd like to, but I'm no Spotify premium user and don't intend to be one. Which leaves me little room to develop (I do need to test) mopidy Spotify support...

About your error: for the next iteration I'm planning to make a mopidy safe mode. It would only lack one feature as opposed to not-mopidy safe mode: a complete listing of songs. I think loads of people (probably me as well) can live without that feature.

Cheers,
Mark
I think you can register new spotify account and you get 1 month of premium features for free. If not i could give you login to my account for testing if you are interested.

User avatar
mark-me
Posts: 49
Joined: Fri May 01, 2015 9:15 pm

Re: Raspberry Pi touchscreen mpd player

Tue May 19, 2015 3:26 pm

Hi Mark,

Here's my reply to your great post. I had fun reading it.
[a] I now launch PiJ at system startup via a local CRONTAB entry. The only problem with this is that I can no longer get a chance to see the IP address. In practice, I've got my DHCP server configured to issue IP addresses "for ever" but it's not unknown for hiccoughs to occur. Perhaps it'd be a good idea to have a "system info" screen with IP address and such like on it.
It is. I'll add it in a next iteration. Edit: done.
I seem to remember you saying that you were (or *have*) put your RPi into a box. Have you given thought to using a button on GPIO3 to provide a shutdown / startup facility? If PiJ gets into (an apparent) loop, one has no choice but to open an SSH session and reboot / halt / whatever. It'd be nice to do that with a single button press.

I have given it thought, and even have it on my display right now. But when I build my box (I hope the carpenter is finishing the basics soon) I will take it off again. The buttons are flimsy and they would screw up the design of my box.

[c] By the way, what amplifier do you use? Is it a home-brew design?

I use https://www.kiwi-electronics.nl/stereo- ... er-MAX9744: Relatively cheap and does good work.

[d] I've managed to get my entire CD collection recognised by MPD:
....
The bad news is that this took simply *yonks* - I think that it may have taken a couple of hours... I left it running overnight and, unfortunately, PiJ seemed to have become "comatose" the next day.

I've been trying to reproduce that and I think that all it takes is for a local playlist to be loaded, start a track and then stop it from PiJ. And then, just *leave* it. After some time - say an hour? - press PLAY on the PiJ screen. The system *does* start to play, but further presses are futile and TOP (via SSH) says that PiJ is taking up anywhere from 40 to 80 per cent of the processor time. (In addition, a KWORKER thread may very well be eating time, as well.)

This isn't *entirely* consistent but I'm keeping an Eye on things to see if I can narrow the problem down a bit.

I have no idea why PiJ went comatose or why it it didn't react anymore. A KWORKER thread is system related... weird... Let me know what you find.

[e] I've noticed that PiJ is slow - or fails - to update its screen when things change "under it's feet". That is to say, when, for example, one changes track via a remote MPD client. (This may very well be true only when playback is stopped.) Other clients seem somewhat better at handling this. I'm currently using Sonata and GMPC rather than MPC or PMS.

That's strange since I do this kind of testing all the time (with exactly the same clients as you!). But I will look into the stopping part, because I did not do that too much. Now that I've added the radio mode, you'll be seeing more weird stuff going on in other client apps... Nothing to worry about though.

[f] On the library screen, would it be possible to *sort* them? It looks a bit strange when they come up (apparantly) unsorted.

It does take a long time to update. It took mine 30 hours the first time round. What isn't sorted? With me everything is sorted. I will add a sort in the code as well to make sure it is returned sorted with your collection as well. Edit: done.
[g] Any chance of adding a "reboot" option to the "Quit" screen?

Didn't think of that. Will do. Edit: Done!

[h] There's no "Cancel" button on the Library Artist, Albums, Songs Or Playlists sub-menus. (I realise that screen space is at a premium on small displays.) Perhaps something like the Android "Back" icon in, say, the top, right-corner would be a good idea.

I've been struggling with that one as well. A button in the top left corner would look ugly as hell.... I'll think about it some more to see if I can find a nicer solution....

The Internet Radio stuff works well but PiJ doesn't appear to allow uppercase in the station names...

It didn't because I work with a ConfigParser of python which, I thought, would only work with lower case keys... Until just now. I found the option where it does become case-sensitive. In this evenings upload it will play nice with your case of cases.

[j] Speaking of the IR stuff, while I like the capabiltiy to select from an IR list, I'd rather the resulting IR lists we normal playlists. (IR stations do now *work* in playlists since you fixed the problem.) I find entering data on the LCD screen a bit of a pain in the bottom and, if IR stations were in "normal" playlists, I could enter them using a third-party MPD client.

I'm not quite sure what you mean by this. I understand entering the URL's is a pain, but you could SSH into the raspberry and use nano to add stations? Afterwards is just a question of selecting stations.

If you need to distinguish IR stations from "normal" tracks, you could put something "special" into an .M3U comment line. (I think that the "#container" line in that example .M3U file that I gave in a previous post was LinkyPLAY-specific.)

I think the last interation gave form to the idea I had. Let me know whether you like it.

[k] By the way, I downloaded an MPD client for my 'Droid phone and I rather like it. I took a look at the MPD protocol and I'm *very* tempted to add some MPD emulation code into our ancient LinkyPLAY music server simply because it'd be so damned convenient to control it from a 'phone.

I already do this. But why I did this project is because I didn't always want to reach for my phone, or maybe I don't always have wifi available. This is where I thought that Pi-Jukebox would come in.

[l] Speaking of our old LinkyPLAY system, we used to have a simple web-server interface that could be used to control it. I wonder if *that* would be a nice option for PiJ. (Or, maybe, MPD can *already* do this - I'll have to do some Googling.)

There are web-clients already. To be honest: I don't like any of them. They are either too crowded or too minimalistic to my taste. But why would I bother using a web interface if I can use my phone or Pi-Jukebox? ;-P

Cheers,
Mark
Last edited by mark-me on Tue May 19, 2015 6:51 pm, edited 1 time in total.

User avatar
ChAoS
Posts: 34
Joined: Wed Aug 31, 2011 4:57 am
Location: Hampshire, UK

Re: Raspberry Pi touchscreen mpd player

Tue May 19, 2015 5:56 pm

Wotchya, Mark.
mark-me wrote:I had fun reading it.
Jolly good. :)
Perhaps it'd be a good idea to have a "system info" screen with IP address and such like on it.
It is. I'll add it in a next iteration
Thank you, kind sir.
But when I build my box (I hope the carpenter is finishing the basics soon) I will take it off again. The buttons are flimsy and they would screw up the design of my box.
Take it off? Is there a downside that I'm not seeing, here?
I use https://www.kiwi-electronics.nl/stereo- ... er-MAX9744: Relatively cheap and does good work.
I'll take a look; it *ages* since I did any serious soldering. (I gave up when everyfink seemed to be going SMD...)
This isn't *entirely* consistent but I'm keeping an Eye on things to see if I can narrow the problem down a bit.
I have no idea why PiJ went comatose or why it it didn't react anymore. A KWORKER thread is system related... weird... Let me know what you find.
This problem is getting quite common.

After faffing with the RPi, Sonata and GMPC when PiJ was "sleeping", PiJ crashed with this output:

Traceback (most recent call last):
File "pi-jukebox.py", line 89, in <module>
main()
File "pi-jukebox.py", line 79, in main
screens.process_mouse_event(event) # Handle mouse related events
File "/home/pi/Pi-Jukebox/gui_screens.py", line 217, in process_mouse_event
ret_value = self.screen_list[self.current_index].on_click(x, y) # Relay tap/click to active screen
File "/home/pi/Pi-Jukebox/screen_player.py", line 253, in on_click
mpd.player_control_set('pause')
File "/home/pi/Pi-Jukebox/mpd_client.py", line 329, in player_control_set
self.mpd_client.pause(1)
File "/home/pi/Pi-Jukebox/mpd.py", line 600, in decorator
return wrapper(self, name, args, bound_decorator(self, returnValue))
File "/home/pi/Pi-Jukebox/mpd.py", line 236, in _execute
self._write_command(command, args)
File "/home/pi/Pi-Jukebox/mpd.py", line 263, in _write_command
self._write_line(" ".join(parts))
File "/home/pi/Pi-Jukebox/mpd.py", line 242, in _write_line
self._wfile.write("%s\n" % line)
File "/home/pi/Pi-Jukebox/mpd.py", line 75, in _dummy
raise ConnectionError("Not connected")
mpd.ConnectionError: Not connected

I'm wondering - especially in view of the (apparant) involvement of a kernel thread - whether the problem is the connection between PiJ and MPD. Perhaps, for some reason, the connection is broken and PiJ is waiting for a response that'll never come. How do you handle sending commands to MPD? Is it merely a case of assembling the buffer and blocking on a function call that spits it out of the appropriate socket? (The PiJ screen doesn't update when it's asleep even though one can, for example, load a different playlist and start playing the songs via another MPD client. This leads me to suspect a blocked socket call.)
On the library screen, would it be possible to *sort* them? It looks a bit strange when they come up (apparantly) unsorted.
What isn't sorted? With me everything is sorted. I will add a sort in the code as well to make sure it is returned sorted with your collection as well.
Well, that *is* weird. My lists - at least the artists, albums, tracks and playlists are definitely *not* sorted. I wonder why *yours* are? (My version of Python is 2.7.3, by the way.)
Any chance of adding a "reboot" option to the "Quit" screen?
Didn't think of that. Will do.
In case you're wondering why I'd like this, I sometimes forget to connect the two disjoint parts of my network before turning on the PiJ's RPi. As a result, it doesn't mount the remote music directory and, hence, can't play any music ('cept IR stations, p'raps). A quick reboot (after turning on the network "valve") is the simplest cure for this.

I suppose what I really need is a script that keeps trying to mount the music if it's not already mounted.
Perhaps something like the Android "Back" icon in, say, the top, right-corner would be a good idea.
A button in the top left corner would look ugly as hell....
Um, *right*-hand corner was what I thought'd do the trick.
PiJ doesn't appear to allow uppercase in the station names...
In this evenings upload it will play nice with your case of cases.
Thanks. (You can call me a "fussy bugger" if you like. :))
I find entering data on the LCD screen a bit of a pain in the bottom and, if IR stations were in "normal" playlists, I could enter them using a third-party MPD client.
I'm not quite sure what you mean by this. I understand entering the URL's is a pain, but you could SSH into the raspberry and use nano to add stations? Afterwards is just a question of selecting stations.
I find it difficult entering text on the RPi's screen - I must be gettin' old - but, really, it's more to do with the fact that I see no reason to treat IR stations any different to "normal" music. Other than doing the Right Thing if the track starts "http://", I can't really see the need to distinguish it from any ol' bog-standard track. At least, that's what *our* music server did.

With *our* system, the hardest thing to do was to get the *right* URI in the first place. Our system didn't cope with file (or rather, connection and bad URI) errors as well as MPD...

My preferred method was to use a web browser to gather URI candidates and then to try them in LinkyPLAY to see if it actually *worked*.

As you say, I could also "cheat" and SSH the text into PiJ's config or playlist files. (O'course, I've already been *doin'* that - that's how I knew that upper-case didn't work.)
If you need to distinguish IR stations from "normal" tracks, you could put something "special" into an .M3U comment line. (I think that the "#container" line in that example .M3U file that I gave in a previous post was LinkyPLAY-specific.)
I think the last interation gave form to the idea I had. Let me know whether you like it.
Yeah, well... I find it a *bit* strange that if I'm playing an IR station, the "current playlist" still shows the last "real" music loaded.

Here's a question for you: how do *you* find (and vet) URIs for IR stations?
I'm *very* tempted to add some MPD emulation code into our ancient LinkyPLAY music server simply because it'd be so damned convenient to control it from a 'phone.
I already do this. But why I did this project is because I didn't always want to reach for my phone, or maybe I don't always have wifi available. This is where I thought that Pi-Jukebox would come in.
One thing that *our* music clients had was remote controls. The WMA11Bs were designed to be connected to TV sets; we re-wrote the client-side software so that it was usable with just audio output. (Including the facility to *speak* the time when a button was pressed. :))

Hmmmm. I have a spare HAMA remote control. P'raps I should see if I can get it to work with PiJ...
But why would I bother using a web interface if I can use my phone or Pi-Jukebox?
Indeed. O'course, when we developed our system, smart phones were relatively new. (I used an "HTC Universal" AKA "Orange SPV M5000". Ah, *those* were the days...)

I have some further items for you:

[a] Try this: load an album from the list and select the "Songs Of" option. I frequently find that the screen is blank and tapping on it will cause a crash. I can't *guarantee* it, but I *think* that this is the corresponding debug output:

Traceback (most recent call last):
File "pi-jukebox.py", line 89, in <module>
main()
File "pi-jukebox.py", line 79, in main
screens.process_mouse_event(event) # Handle mouse related events
File "/home/pi/Pi-Jukebox/gui_screens.py", line 217, in process_mouse_event
ret_value = self.screen_list[self.current_index].on_click(x, y) # Relay tap/click to active screen
File "/home/pi/Pi-Jukebox/screen_player.py", line 157, in on_click
mpd.play_playlist_item(selected_index + 1)
File "/home/pi/Pi-Jukebox/mpd_client.py", line 349, in play_playlist_item
self.mpd_client.play(index - 1)
File "/home/pi/Pi-Jukebox/mpd.py", line 600, in decorator
return wrapper(self, name, args, bound_decorator(self, returnValue))
File "/home/pi/Pi-Jukebox/mpd.py", line 238, in _execute
return retval()
File "/home/pi/Pi-Jukebox/mpd.py", line 595, in decorator
return function(self, *args, **kwargs)
File "/home/pi/Pi-Jukebox/mpd.py", line 363, in _fetch_nothing
line = self._read_line()
File "/home/pi/Pi-Jukebox/mpd.py", line 275, in _read_line
raise CommandError(error)
mpd.CommandError: [2@0] {play} Bad song index

I've discovered that the screen isn't *empty*; it's merely that PiJ is displaying a page off of the *end* of the list. Scrolling up shows the correct output.

While playing around with IR stations, I managed to get PiJ to generate this while it was starting up. I had to change the playlist via another MPD client before PiJ would start up again:

Traceback (most recent call last):
File "pi-jukebox.py", line 89, in <module>
main()
File "pi-jukebox.py", line 64, in main
if not mpd.connect():
File "/home/pi/Pi-Jukebox/mpd_client.py", line 187, in connect
self.__starts_with_radio()
File "/home/pi/Pi-Jukebox/mpd_client.py", line 194, in __starts_with_radio
now_playing.now_playing_set(self.mpd_client.currentsong()) # Get currenly plating info
File "/home/pi/Pi-Jukebox/mpd_client.py", line 47, in now_playing_set
self.track_file = now_playing['file']
KeyError: 'file'

OK, that's enough waffle from me.

Bye fer now.

Regards,

Mark.

User avatar
mark-me
Posts: 49
Joined: Fri May 01, 2015 9:15 pm

Re: Raspberry Pi touchscreen mpd player

Tue May 19, 2015 6:49 pm

I now also added a system info screen, showing mpd statistics and Raspberry Pi host name and ip adress.

User avatar
mark-me
Posts: 49
Joined: Fri May 01, 2015 9:15 pm

Re: Raspberry Pi touchscreen mpd player

Tue May 19, 2015 6:55 pm

P4d0uch wrote:
mark-me wrote:
Thank you very much. I added that issue to the mopidy page. I really hope to fix it. I liked your project too... It does look consistent with the mopidy interface. What your project has, and mine is lacking, is the Spotify support. Some people have been asking for me to integrate it into pi-jukebox, and I'd like to, but I'm no Spotify premium user and don't intend to be one. Which leaves me little room to develop (I do need to test) mopidy Spotify support...
Mark
I think you can register new spotify account and you get 1 month of premium features for free. If not i could give you login to my account for testing if you are interested.
Thank you for the suggestion! I will try that. First I have to get mopidy up and running, although I think that won't be too much of a problem. When I do that, and find some more time I'll surely try the month subscribtion or I might take you up on your offer! As I said: at first I wanted to have a basic player, but now I'm eager to make it more all-round.

User avatar
mark-me
Posts: 49
Joined: Fri May 01, 2015 9:15 pm

Re: Raspberry Pi touchscreen mpd player

Tue May 19, 2015 7:54 pm

I've just added some code that should solve a lot of the connection time out related issues.

P4d0uch
Posts: 47
Joined: Sun Sep 16, 2012 5:01 pm

Re: Raspberry Pi touchscreen mpd player

Thu May 21, 2015 5:15 pm

Hello again, I've downloaded the new version from github and I cant get it running.

Code: Select all

Traceback (most recent call last):
  File "pi-jukebox.py", line 89, in <module>
    main()
  File "pi-jukebox.py", line 61, in main
    apply_settings()  # Check for first time settings and applies settings
  File "pi-jukebox.py", line 48, in apply_settings
    settings_mpd_screen = ScreenSettingsMPD(SCREEN)
  File "/home/pi/Pi-Jukebox/screen_settings.py", line 169, in __init__
    label = "Change host: " + config_file.setting_get('MPD Settings', 'Host')
TypeError: cannot concatenate 'str' and 'NoneType' objects
I dont think I've change anything since previous version,

User avatar
ChAoS
Posts: 34
Joined: Wed Aug 31, 2011 4:57 am
Location: Hampshire, UK

Re: Raspberry Pi touchscreen mpd player

Thu May 21, 2015 5:57 pm

P4d0uch wrote:Hello again, I've downloaded the new version from github and I cant get it running.

Code: Select all

Traceback (most recent call last):
  File "pi-jukebox.py", line 89, in <module>
    main()
  File "pi-jukebox.py", line 61, in main
    apply_settings()  # Check for first time settings and applies settings
  File "pi-jukebox.py", line 48, in apply_settings
    settings_mpd_screen = ScreenSettingsMPD(SCREEN)
  File "/home/pi/Pi-Jukebox/screen_settings.py", line 169, in __init__
    label = "Change host: " + config_file.setting_get('MPD Settings', 'Host')
TypeError: cannot concatenate 'str' and 'NoneType' objects
I dont think I've change anything since previous version,
Yeah, it does the same for me. The source cites "Host" but it should say "host". (I don't see such errors since I retain my old config files.)

Regards,

Mark.

User avatar
ChAoS
Posts: 34
Joined: Wed Aug 31, 2011 4:57 am
Location: Hampshire, UK

Re: Raspberry Pi touchscreen mpd player

Fri May 22, 2015 9:46 am

ChAoS wrote:The source cites "Host" but it should say "host".
It seems, to me, that either all calls to SETTING_GET() should test for a non-existent item or it should return an empty string (or whatever the Python equivalent is) if there's nothing there:

Code: Select all

def setting_get(self, section, key):
        if self.setting_exists(section, key):
            value = self.parser.get(section, key)
            return value
Regards,

Mark.

ArthurJam
Posts: 13
Joined: Mon May 25, 2015 8:28 pm

Re: Raspberry Pi touchscreen mpd player

Mon May 25, 2015 9:02 pm

Hello, I try to use your mpd player with mopidy server. I activate mpd module with this config :

Code: Select all

[mpd]
enabled = true
hostname = 127.0.0.1
port = 6600
password =
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
command_blacklist = listall,listallinfo
But i dont know how and where configure MPD_MUSIC_DIR.

ArthurJam
Posts: 13
Joined: Mon May 25, 2015 8:28 pm

Re: Raspberry Pi touchscreen mpd player

Mon May 25, 2015 11:13 pm

OK i found the solution.

Code: Select all

pi@raspberrypi ~/Pi-Jukebox $ cat pi-jukebox.conf
[MPD Settings]
host = localhost
port = 6600
music directory = /home/pi/music

sndo9
Posts: 1
Joined: Fri Jun 19, 2015 10:51 pm

Re: Raspberry Pi touchscreen mpd player

Fri Jun 19, 2015 11:18 pm

HI, I followed the guide at Lifehacker to install Pi-Jukebox on my raspberry pi but ran in to a problem. Mpc works to play audio but when I start Pi-Jukebox through SSH a message saying no music directory displays on the touchscreen. I read the github page that said to check MPD_MUSIC_DIR in mpd_client.py but I cannot find that line in the file. I don't have a whole lot of experience with python so I am having trouble tracking down the problem but here is the code it spits out when I close the error screen.

Code: Select all

Traceback (most recent call last):
  File "Pi-Jukebox/pi-jukebox.py", line 89, in <module>
    main()
  File "Pi-Jukebox/pi-jukebox.py", line 61, in main
    apply_settings()  # Check for first time settings and applies settings
  File "Pi-Jukebox/pi-jukebox.py", line 48, in apply_settings
    settings_mpd_screen = ScreenSettingsMPD(SCREEN)
  File "/home/pi/Pi-Jukebox/screen_settings.py", line 169, in __init__
    label = "Change host: " + config_file.setting_get('MPD Settings', 'Host')
TypeError: cannot concatenate 'str' and 'NoneType' objects

User avatar
ChAoS
Posts: 34
Joined: Wed Aug 31, 2011 4:57 am
Location: Hampshire, UK

Re: Raspberry Pi touchscreen mpd player

Sat Jun 20, 2015 2:09 pm

sndo9 wrote:HI, I followed the guide at Lifehacker to install Pi-Jukebox on my raspberry pi but ran in to a problem. Mpc works to play audio but when I start Pi-Jukebox through SSH a message saying no music directory displays on the touchscreen. I read the github page that said to check MPD_MUSIC_DIR in mpd_client.py but I cannot find that line in the file. I don't have a whole lot of experience with python so I am having trouble tracking down the problem but here is the code it spits out when I close the error screen.

Code: Select all

Traceback (most recent call last):
  File "Pi-Jukebox/pi-jukebox.py", line 89, in <module>
    main()
  File "Pi-Jukebox/pi-jukebox.py", line 61, in main
    apply_settings()  # Check for first time settings and applies settings
  File "Pi-Jukebox/pi-jukebox.py", line 48, in apply_settings
    settings_mpd_screen = ScreenSettingsMPD(SCREEN)
  File "/home/pi/Pi-Jukebox/screen_settings.py", line 169, in __init__
    label = "Change host: " + config_file.setting_get('MPD Settings', 'Host')
TypeError: cannot concatenate 'str' and 'NoneType' objects
If you look a few posts back, you'll see that we *all* seemed to have this trouble. (I never noticed it, at first, since I retain my old config files between versions.)

We'll have to wait for Mark to return from the "dead" (or whatever's keeping him from posting) for the definitive answer but, as far as I can make out, the root cause is that the software cites an "Host" section whereas, in the config file, it says "[hosts]". I think that the section names are case *sensitive* and, thus, you can either change the source or the config file, I suppose, as a temporary work-around. (I can't actually remember how I resolved this on *my* system.)

Regards,

Mark.

y2kats65
Posts: 4
Joined: Tue Apr 07, 2015 12:19 am

Re: Raspberry Pi touchscreen mpd player

Sun Jun 28, 2015 6:44 am

Thanks for the great program and documentation. I have several thousand alums in my directory. When I browse the library, how do you display the remaining pages? Swiping up or down the screen most of the time it did nothing or it brought me to the Add to playlist screen. Only once in a while would it went to the next page. Is that normal? Should I be able to use the orange vertical bar as slider and use that to scroll through the pages?

User avatar
ChAoS
Posts: 34
Joined: Wed Aug 31, 2011 4:57 am
Location: Hampshire, UK

Re: Raspberry Pi touchscreen mpd player

Sun Jun 28, 2015 6:02 pm

y2kats65 wrote:When I browse the library, how do you display the remaining pages? Swiping up or down the screen most of the time it did nothing or it brought me to the Add to playlist screen. Only once in a while would it went to the next page. Is that normal? Should I be able to use the orange vertical bar as slider and use that to scroll through the pages?
Indeed you *should* be able to scroll up and down. This, however, is an area where I've had a bit of trouble, myself. In particular, I get crashes caused, I think, by an uninitialised/unset "index" into the list; if one browses a list and then comes back later browsing a different list, I often end up with the system crashing.

For the definitive answer, of course, we'll have to wait until the author returns. Until that joyous time, I'm entertaining myself by adding MPD emulation to a music serving system that me and a mate wrote *many* years ago... :)

Regards,

(A Different, Not *The*) Mark.

y2kats65
Posts: 4
Joined: Tue Apr 07, 2015 12:19 am

Re: Raspberry Pi touchscreen mpd player

Mon Jun 29, 2015 8:40 pm

Mark: Thanks for your reply. I have another question. I can see my music listed when I pressed the "Library browsing" button on the jukebox However when I run the command "mpc stats" it always shows the db is empty. Why is that? Should the db contains the music found from the command "mpc update"?

pi@raspberrypi ~ $ mpc stats
Artists: 0
Albums: 0
Songs: 0

Play Time: 0 days, 0:00:52
Uptime: 0 days, 1:03:24
DB Updated: Mon Jun 22 17:24:24 2015
DB Play Time: 0 days, 0:00:00

User avatar
ChAoS
Posts: 34
Joined: Wed Aug 31, 2011 4:57 am
Location: Hampshire, UK

Re: Raspberry Pi touchscreen mpd player

Tue Jun 30, 2015 4:56 am

y2kats65 wrote:Mark: Thanks for your reply. I have another question. I can see my music listed when I pressed the "Library browsing" button on the jukebox However when I run the command "mpc stats" it always shows the db is empty. Why is that? Should the db contains the music found from the command "mpc update"?

pi@raspberrypi ~ $ mpc stats
Artists: 0
Albums: 0
Songs: 0

Play Time: 0 days, 0:00:52
Uptime: 0 days, 1:03:24
DB Updated: Mon Jun 22 17:24:24 2015
DB Play Time: 0 days, 0:00:00
Since adding emulation of MPD to *our* music server, I've had to get familiar with the MPD protocol. One way to resolve whether this is a PiJ or MPD issue is to TELNET into MPD directly and drive it "by hand", as it were.

For example, something like this would tell you whether MPD was responding correctly:

chaos@HPG60 ~ $ telnet localhost 6600
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
OK MPD 0.18.0
stats
uptime: 451
playtime: 0
artists: 36
albums: 10
songs: 128
db_playtime: 30236
db_update: 1431530666
OK
close
Connection closed by foreign host.
chaos@HPG60 ~ $

In this case, after invoking TELNET on the sever's MPD port, I just type "stats" and MPD sends me what PiJ would've seen had it issued the command. The "close" is just to terminate the connection in a "graceful" manner.

A useful link:

http://www.musicpd.org/doc/protocol/com ... s_commands

It's been enlightening to have a rummage around in the MPD protocol. While I've been faffing with this, it's interesting to note how different MPD clients are programmed. *Our* music server will only have a very *tiny* part of MPD's protocol implemented - just enough to allow selection of playlist, stopping, starting, control of the volume and so on.

Different clients behave differently when faced with talking to our server. Some acquire the valid commands (by issuing the "commands" command), find the list of unsupported or unavailable commands ("notcommands") and then go ahead and issue commands in the unsupported set anyway...

Some do what I think is the Right Thing and, with no user input, will merely issue the "idle" command (which we *don't* support at present) and then wait to be notified of events rather than endlessly polling the server.

Right now, I'm having a play with CANTATA. It seems OK, so far.

Regards,

Mark.

User avatar
ChAoS
Posts: 34
Joined: Wed Aug 31, 2011 4:57 am
Location: Hampshire, UK

A Companion To PiJ

Fri Jul 31, 2015 4:27 pm

Those of you interested in Mark's creation might like to take a look at YMPD:

http://www.ympd.org/

https://github.com/notandy/ympd

To quote their website:

"ympd is a lightweight MPD (Music Player Daemon) web client that runs without a dedicated webserver or interpreters like PHP, NodeJS or Ruby. It's tuned for minimal resource usage and requires only very litte dependencies. "

Running alongside PiJ on the Pi, it provides the box with a web interface to MPC. It appears to run well.

Regards,

Mark.

Antheus
Posts: 3
Joined: Thu Oct 24, 2013 5:38 pm

Re: Raspberry Pi touchscreen mpd player

Sun Aug 09, 2015 2:47 pm

Thanks for your great work.
Everything works fine, but no cover will be displayed.
The Folder.jpg exists in each music folder .
Is there a special path or name to define ?
My music is stored on an Synology NAS.

MfG Antheus

User avatar
ChAoS
Posts: 34
Joined: Wed Aug 31, 2011 4:57 am
Location: Hampshire, UK

Re: Raspberry Pi touchscreen mpd player

Sun Aug 09, 2015 3:44 pm

Antheus wrote:Thanks for your great work.
Well, you *could* thank Mark - *I* would certainly like to - but he seems to have "gone away". We've not heard from him on here for quite a time... :(
but no cover will be displayed.
I have the same problem. When I first started playing with PiJ, I wasn't interested in the artwork side of things and so wasn't worried when stuff didn't appear on-screen.

However, Mark's project has instilled in me an interest in MPD and its clients to the extent that I've added MPD-emulation to an old music server that I have.
The Folder.jpg exists in each music folder .
Is there a special path or name to define ?
Do you know how this normally works on MPD clients? I've noticed that other clients - whether Linux or Android - seem to "automagically" acquire artwork and display it.

Although a programmer by trade, I'm a bit long in the tooth and don't really want to be poking around with Python.

Speaking of which, does anyone *else* find that the volume control on PiJ has too wide a range? On my system, the range 60%-100% seems large enough to accomodate the volume range that I'd be happy with and would make the slider a bit easier to use by not having all of the useable range concentrated at the right-hand end.

Anyone volunteering to "get their hands dirty" and maintain Mark's software until he returneth?

Regards,

(Another, Not *The*) Mark.

javajim
Posts: 1
Joined: Sun Feb 21, 2016 7:00 pm

Re: Raspberry Pi touchscreen mpd player

Sun Feb 21, 2016 7:01 pm

Hi there, I'm sorry to be a pain in the ass, but as a newbie just learning how to use the Raspberry Pi unfortunately I’m stuck at the last bit, maybe you can help? I guess this problem is peanuts for you?

When starting with "sudo python pi-jukebox.py”, what I get is this:

Traceback (most recent call last):
File “Pi-Jukebox/pi-jukebox.py”, line 11, in <module>
from gui_screens import *
File “/home/pi/Pi-Jukebox/gui_screens.py”, line 13, in <module>
from gui_widgets import *
File “/home/pi/Pi-Jukebox/gui_widgets.py”, line 13, in <module>
from settings import *
File “/home/pi/Pi-Jukebox/settings.py”, line 33, in <module>
SCREEN = pygame.display.set_mode(DISPLAY_SIZE, display_flags)
pygame.error: Unable to open /dev/fb1

I’m using a 5" touch display which came with a driver and which is running perfectly.

Any idea what I can do to fix it?
Many thanks in advance!!

allogic
Posts: 2
Joined: Fri Nov 18, 2016 4:57 pm

Re: Raspberry Pi touchscreen mpd player

Fri Nov 18, 2016 4:59 pm

Do we know if Mark will ever return?

I really like the interface of this pi-jukebox.

Does anyone have a working config that they could share perhaps?

Thanks

allogic
Posts: 2
Joined: Fri Nov 18, 2016 4:57 pm

Re: Raspberry Pi touchscreen mpd player

Fri Nov 18, 2016 5:37 pm

Does anyone have a old 'working' config from a previous version. I can't seem to get past the 'no music directory' error?

Thanks

oschettler
Posts: 3
Joined: Sat Nov 22, 2014 9:18 pm

Re: Raspberry Pi touchscreen mpd player

Tue Dec 19, 2017 10:16 pm

Hi Mark.

I know I am a bit late but even now, in December 2017, I could not find an MPD touchscreen UI that is more feature complete than yours. And chapeau for the fullblown UI toolkit that you have implemented - nice work!

I had some problems to get it to work on the latest Raspbian, but this was totally not your fault. Here is a link to a working SDL 1.2.

-- Olav

Return to “Graphics, sound and multimedia”