📜 ⬆️ ⬇️

Rulim music from the couch

I love listening to music ... No. I love listening to music. I usually listen to it on the player (Cowon D2 2Gb + 4Gb SD), but this volume is small, so I actively use a computer at home where the entire collection of music is stored. However, it is rather inconvenient - switching music, making playlists - just needing to go to a computer and so on. Therefore, I had the idea to make this process more convenient ...

I found in my bins a device called PSP, which I use to read books, watch movies and anime (yes, I watch anime :)).

I decided that it would be great to control music on the computer with the help of it - indeed, this device has WiFI, therefore you can easily connect to your home LAN. Then the question arose how to implement it. I wondered for a long time what to do and suddenly I came across such a thing - mpd (Music Player Daemon). Allows you to raise a daemon player under Linux, with a well-developed control system. The site offers a variety of clients (the choice is impressive), I opted for PHP-clients. Those. with psp go to a certain address in LAN and from there steer the player. But, to my deep regret, only one of all clients was optimized for “small” screens, and I didn’t like that one either:

After some thought, I decided to write it myself, good for mpd is a very good php library, so there shouldn't have been any particular difficulties.

Create mpd client


First of all, of course I installed mpd

sudo aptitude install mpd
')
Then edited the configuration file:

sudo gedit /etc/mpd.conf

my settings file

Now we create a music base:

sudo mpd - create-db

Finally you can run:

sudo /etc/init.d/mpd start

So, the demon is installed, the music base is created, you can start creating a client.
(I will not talk about the functionality of the mpd php library - you can download it and study it yourself)
My first decision was to make a client on xAjax, but unfortunately it turned out that the psp internet browser refuses to cooperate with it. I had to stop at the standard model GET command transfer.
I think you are not very interested to read the commented php code in the article, so those who wish can see it here .
I will tell only about the difficulties that have arisen in writing:
1) the browser built into psp has a very interesting caching system, so that each time it loads the page, I have to add the? Hash = time () parameter to all the links so that the browser thinks that this is a different "unique" page
2) Butting for a long time with pretty technical support from Corbin (this is of course not entirely connected with the client, but his nerves are pretty frayed :))
So, the result: I can manage the entire music library from any part of the apartment


Than immensely satisfied :) Thank you for your attention.

PS anyone can download the client

Source: https://habr.com/ru/post/56740/


All Articles