![]() |
Good evening from hot Spain. - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: Community (https://moodeaudio.org/forum/forumdisplay.php?fid=18) +--- Forum: Introduce Yourself (https://moodeaudio.org/forum/forumdisplay.php?fid=40) +--- Thread: Good evening from hot Spain. (/showthread.php?tid=5681) |
Good evening from hot Spain. - janiversen - 07-06-2023 Hi. Let me shortly introduce myself, I am by heart a programmer and have been since I wrote my first assembler program in 1977. I am on GitHub with the same user, where I help manage a couple of projects. I changed from Volumio to moode audio a short while ago, because I could not make the changes I need in Volumio. I like moode audio, but it lacks a couple of features (or more correctly I have not been able to find them), if they really are missing my intention is to provide them in a couple of pull requests. The features I lack are as follows: - Be able to play music via the web browser. When at home, I have my iPad with my earbuds, and want to be able to listen to my music with my playlists...seems like a fairly easy job. - Be able to select my iPad or Mac mini and play to it from the moode audio server using airplay 2 (or 1). It is actually 2 sides of the same story....but I am no stranger to php and js (even though I prefer C/C++ and python), so let's see if I can get a grip of the architecture used, sadly the development documentation is not a rich as I would like (what surprise). Apart from that I am semi-retired and spent a lot of time helping FOSS projects. I live in Granada, Spain but I am a pure Viking. Have a nice evening. Jan I. Ps. If anyone can give me ideas/pointers or anything else helpful to solve my problems I am grateful. RE: Good evening from hot Spain. - Nutul - 07-06-2023 (07-06-2023, 08:40 PM)janiversen Wrote: Hi. You can play on http. That is: you tell moOde to play something, and it will stream it on http, at mp3 or flac quality. You have to enable the http renderer in the configuration, of course. Implies 2 browser tabs, though: one with the moOde UI to select the music to play. and one pointing at the http port to listen to the stream. I do this almost every night. RE: Good evening from hot Spain. - Tim Curtis - 07-06-2023 (07-06-2023, 08:40 PM)janiversen Wrote: Hi. Regarding "...sadly the development documentation is not a rich as I would like" What "extra richness" are you looking for in the development docs? https://github.com/moode-player/docs RE: Good evening from hot Spain. - janiversen - 07-07-2023 There are some good doc on the audio structure in https://github.com/moode-player/docs/blob/main/moode_audio_infrastructure.md, except there are no code pointers. I did not find an architecture describing the frontend (web browser / js) and backend (php), e.g. is it using web-sockets. But in general this documentation is not too bad, actually a lot better than many open source projects :-) I guess I will just have to debug my way through. RE: Good evening from hot Spain. - janiversen - 07-07-2023 (07-06-2023, 09:51 PM)Nutul Wrote: You can play on http. That is: you tell moOde to play something, and it will stream it on http, at mp3 or flac quality. That sounds like a good beginning, and also tells me that I still need to learn a lot more about setup (setup.txt, just touched the surface). With the backend working, it should be quite simple to integrate the second browser tab into the main window, and a nice little first pull request. THANKS for the hint. RE: Good evening from hot Spain. - Nutul - 07-07-2023 (07-07-2023, 10:37 AM)janiversen Wrote:(07-06-2023, 09:51 PM)Nutul Wrote: You can play on http. That is: you tell moOde to play something, and it will stream it on http, at mp3 or flac quality. Go to SETTINGS => Audio, scroll down to MPD Options, and enable the HTTP streaming (if you like also change the default port...) Then on another browser tab, provided your moOde is at http://moode.local, open http://moode.local:8000 Note that most probably moOde must already be playing something, otherwise the moode.local:8000 will fail with ERR_EMPTY_RESPONSE RE: Good evening from hot Spain. - janiversen - 07-07-2023 Thanks I got it configured without problems, now I just need to figure out to switch between the DigiAudio AMP+ (local on the Rip) and HTTP. I tried to discover players but it only found moode. RE: Good evening from hot Spain. - Nutul - 07-07-2023 (07-07-2023, 11:58 AM)janiversen Wrote: Thanks I got it configured without problems, now I just need to figure out to switch between the DigiAudio AMP+ (local on the Rip) and HTTP. I tried to discover players but it only found moode. Of course it found only one player, it looks for moOde stations. This thing plays the same thing locally and on the http at the same time. If you don't want the DigiAudio AMP+ to produce no sound then you somehow need to mute it. RE: Good evening from hot Spain. - janiversen - 07-07-2023 I thought that, and that is exactly why this feature is not bad, but not too valuable either. Anyhow I am right now setting up a development environment to get my feet wet. Thanks a lot for helping. RE: Good evening from hot Spain. - Tim Curtis - 07-07-2023 (07-07-2023, 10:31 AM)janiversen Wrote: There are some good doc on the audio structure in https://github.com/moode-player/docs/blob/main/moode_audio_infrastructure.md, except there are no code pointers. The application architecture is summarized in the Overview section of the Master Development Guide. It's based on the original 2013 tsunamp player written by Andrea Coiutti & Simone De Gregori from which moOde and other similar projects were forked. https://github.com/moode-player/docs/blob/main/master_development%20guide.md There are no details in the document describing how all the parts of application are stitched together due to lack of time to write that section. Similarly the Source Tree documentation which would be related to that section is incomplete and outdated. Volunteers are welcome :-) I can get you started with the following quick run through. Each web page consists of: 1. /var/www/header.php 2. An HTML template file from /var/www/templates/ 3. /var/www/footer.php The main Playback/Library screen is /var/www/templates/indextpl.html and /var/www/index.php. The rest of the files in /var/www/templates/ are the Configtration screens with corresponding PHP scripts in /var/www/ When a web page loads into the Browser the jQuery(document).ready code is executed in /var/www/js/scripts-panels.js or scripts-configs.js depending on whether the page is indextpl.html or one of the Configuration HTML templates respectively. In these two JS scripts, settings and other data is fetched from SQL tables on the back-end and then AJAX connections to the two "server engines" are made in the section below via functions in /var/www/js/playerlib.js Code: // Connect to server engines The MPD engine is /var/www/engine-mpd.php. It's a PHP wrapper around the MPD idle timeout loop which waits for MPD state change events and emits the state data back to the front-end JS engineMpd() function in playerlib.js. This function establishes permanent AJAX while loop with engine-mpd.php. The Command engine is /var/www/engine-cmd.php. It's based on straight sockets and serves as a way for PHP scripts to send commands back to the front-end via the sendEngCmd() function in /var/www/inc/common.php. The commands are processed by the front-end JS engineCmd() function in playerlib.js. This function establishes a permanent AJAX while loop with engine-cmd.php. The other core part of the application is /var/www/daemon/worker.php. Its function is to perform startup, process jobs sent to it by the front-end and handle player state when any of the "Renderers" connect/disconnect. Look in the section below where this polling loop is started. (1) Turn on Debug logging in System Config to see in the Browser console whats returned by engine-mpd.php to the front-end, and in /var/log/moode.log to see some of the activity in worker.php and other PHP functions. (2) The Library JSON files are cached in /var/local/www/ Code: // BEGIN WORKER EVENT LOOP A couple other application things to take note of: 1. Although the application is complex with many features, the default audio pipeline is simple and has not changed from the original over 10 years ago. It's still MPD -> ALSA -> Device. 2. The WebUI is designed to scale and adapt to screen sizes including Smartphone, Tablet, Desktop, TV and various locally attached screens for example Pi 7" Touch or Ultra-wide LCD/OLED displays. 3. The data used to populate Library Tag and Album views is extracted from the MPD database by function loadLibrary($sock) in /var/www/inc/music-library.php and sent in its entirety as a JSON file to the front-end function loadLibrary() in /var/www/js/scripts-library.js which renders it. 4. The application is designed and optimized for the Raspberry Pi family of single board computers. No other platforms are supported. 5. Music Services are not integrated because their API's are proprietary (not Open Source) and they require annual license fees with contracts and NDA's. 6. Development is done using Gulp https://github.com/moode-player/docs/blob/main/development_with_gulp.md 7. The release images are built using pi-gen (the tool used to create Raspberry Pi OS images) and standard Debian packages. See our pkgbuild and imgbuild repos. The Raspberry Pi OS packages that are used are current as of the date our release images are generated. 8. We generally stay in sync with the latest official Raspberry Pi OS and kernel releases and 3rd party component releases for example shairport-sync, MPD, librespot, etc. Lastly a few maintenance items to take note of: 1. Several JS/CSS libraries including Bootstrap, Font Awesome and jQuery should be bumped at some point but the effort to test and debug these lib upgrades is substantial and thus its a low priority. 2. A substantial part of the codebase was refactored a while back. Whats remaining is the JS but due to it's complexity and similar to the libs above the effort to test and debug is substantial and thus its a low priority. |