GUI interface for MOC

Forums:

MOC version: 
any

Hello everyone!
I’ve created a GUI interface for MOC and would like to share my work as well as invite anyone interested to discuss or collaborate on the project.

Originally, the program was developed for use on a small touchscreen and was designed for playing audio files stored on the device. However, it has since undergone significant changes, gained additional functionality, and has now become my primary audio player on PC.

The program offers the following features:

- Playlist management: Although the functionality is somewhat limited due to the touchscreen-oriented design, you can add songs to the playlist, remove them, move them up or down, save playlists, load them, and undo changes. Additionally, for collaborative use across multiple devices, playlists can be stored on a server in the music directory and will sync with other instances of the program using the same music directory.
- Play songs without adding them to the playlist.
- Very fast music folder scanning (specifically optimized for low-performance devices, like the ones the program was originally designed for). However, the storage structure must be organized as follows: Artist/Album/Song. Many of us already use this structure, so this shouldn’t be an issue.
- Scroll lists with touch gestures, just like on a smartphone – this works even if your desktop environment doesn’t natively support such behavior.
- Flexible interface: Choose between a full interface or a minimalist one, displaying only the file list, playback control buttons, and a progress bar – ideal for small screens.
- Seek using a progress bar: Playback time can be displayed in two modes – time elapsed or time remaining.
- Random playback respects played songs, ensuring they won’t be repeated until the playlist is complete.
- View song lyrics from Genius.com (you’ll need your own token, which you can get at https://genius.com/api-clients).
- Multilingual interface support (see the locale directory in the project folder).

This project is purely a hobby. I’m not even a professional programmer and worked on it exclusively in my spare time.
The program is written in Lazarus. Here's how to compile and run it:
- Download the project from GitHub. https://github.com/usama-chr/umocplayer
- Install Lazarus and open the project in it.
- Press F9 – an executable file umocplayer will appear in the project folder.
- Install MOC :-)
- If you want to view song lyrics, install jq for parsing lyrics pages and obtain a token from https://genius.com/api-clients.

A huge thank you to John Fitzgerald for spending so much time helping me register on the forum and for his work on MOC!

Hi, interesting project. I've been long thinking about developing some easy way to control MOC (e.g. running on embedded devices, like OpenWRT), so idea of touchscreen accessible interface is curious. What kind of hardware setup you had in mind? Raspberry Pi?

I wanted to try it, but Lazarus is so seriously broken on my system that I didn't even manage to load the project. I got hit with "access violations", unreadable windows and general mess.

I have some suggestions based on what I could see on Github.

1. First of all, I suggest writing clear building instructions somewhere there, either in README.md or separate INSTALL file pointing out precise dependencies.
2. Note that not everybody uses a distribution which is Debian derivative, so it is better to avoid references to e.g. apt or put them in separate section.
3. It would be more readable if you split Russian version as a separate section or even separate file.

I'm afraid though that exotic choice of programming environment would seriously decrease number of potential users.

I'm also a bit confused about your choice. Your project doesn't really look like a GUI, more like a separate player which just uses MOC as a backend to play audio. I guess you could just as easily invoke ffplay or mpv. Even more, I would guess that Lazarus might already have an "audio player component" of some kind that could be used seamlessly inside the project. Other environments usually have something like that (my student did something similar once in QT using integrated component to handle audio). More generally, I'm not sure what would be benefit of using something like that over simple GUI music players like e.g. Clementine.

Ok. In the meantime I managed to compile and run it. After entering music directory, all I saw was empty dialogs in the window and after trying to click something I got "division by zero" error. On the next try I got "List index (0) out of bounds." In both cases I needed to kill the program. It seems it needs a bit more work ;)

Hello!
Thank you for your feedback! It’s truly gratifying to know you tried using the program. At this stage, error handling is almost nonexistent, so issues might arise anywhere and for various reasons!

For instance, I just discovered that the “Division by zero” error occurs when the path to the music folder contains spaces, and perhaps certain other characters. Please try temporarily addressing this on your end and see if it helps. Use a path without spaces or suspicious characters, then click “Refresh file list.” I will fix this issue as soon as possible and let you know.

Answers to your questions and suggestions:
The device for which the program was originally written was prototyped on an Orange Pi Zero, with a tiny display running on the I2C bus. The final version utilized custom hardware, which I wasn’t involved with. Additionally, as a token of appreciation for the collaboration, I currently have the second prototype on my desk, which uses an Orange Pi PC2 and a large HDMI-connected screen (this option was rejected due to complexity and cost).

I will certainly create a proper manual, and yes, I completely agree that mixing two languages looks absurd.

I chose Lazarus because I studied Pascal back in the day.

MOC was selected for a specific reason: the device being developed was an audio notification amplifier containing a set of built-in audio recordings and needed to be controlled both locally and remotely. Initially, the idea was that an operator could connect via SSH to the device and play the required file. At the start of the project, I simply searched online for “console audio player,” and the unanimous answer was MOC. Later, the ability to connect via a web interface was added. Then, a screen and local control features were introduced. At that point, I had to create a graphical interface for the console player. Much later (years later), I expanded the project into what you see now. I hope this fully satisfies your curiosity about the choice of player. :-)

Please let me know if you manage to resolve the “Division by zero” issue.

Your project uses the concept of library, which is foreign to MOC, in essence it duplicates the function of audio player. Have you considered MPD? It is more modular and library-centric with various front-ends (GUI and text) already available.

In my case I entered the path to library as "~/mp3", so there was no space. When I replaced it with "/home/tomaszg/mp3" it worked. But of course, I don't have my music organized according to your scheme, so it is very inconvenient to use it.

Some remarks:
1. It lists both music and non-music files (covers, ratings files, lyrics and so on)
2. It doesn't seem to upload its playlist to MOC, but that's probably related to MOC's architecture. I've been for some time annoyed with the "hidden playlist" which is actually what is playing.
3. Some widgets overlap, e.g. progress bar and time widgets.
4. It would be nice to be able to configure MOC's binary location.
5. Closing GUI closes MOC server, that's rather unexpected, and I'd guess for some users would be inconvenient.

PS. I deleted the bogus comments, there's something weird going on here on the forum...