[PLUGIN] SmartQueue

Also tested the Odroid M1s. Worked without any problems.
Volumio: V3.703
Model: Hardkernel ODROID-M1S
Kernel: 5.10.160-volumio
Arch: aarch64

wooo youā€™re precious :+1:
I believe on each machine you compiled the source on your own after having altrered /home/volumio/.cargo/registry/src/index.crates.io-1cd66030c949c28d/ffmpeg-next-7.0.2/src/util/format/pixel.rs ?

Iā€™m going to setup a github workflow action to automatize all of this building work

only for the rpi4:

838  ~             AV_PIX_FMT_RPI => todo!(),
839  ~            AV_PIX_FMT_RPI4_10 => todo!(),

and CM4:

noted, but the file I sent to you crosscompiled from source, worked on rpi4 thatā€™s it ?

Correct.

You also might want to add a button for blissify update when new songs are added.
(62000 tracks took 07:46 hours.)

I am going to pass on any further testing and support, as it start to become very frustrating.
After a reboot, the x86 and Motivo, rPiā€™s are all failing to launch MPD.
Even after disabling the plugin and reboot.

ā— mpd.service - Music Player Daemon
   Loaded: loaded (/lib/systemd/system/mpd.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2024-07-25 09:13:50 CEST; 8s ago
     Docs: man:mpd(1)
           man:mpd.conf(5)
  Process: 1957 ExecStartPre=/usr/bin/sudo /bin/chown mpd:audio /var/log/mpd.log (code=exited, status=0/SUCCESS)
  Process: 1959 ExecStart=/usr/bin/mpd --systemd (code=exited, status=1/FAILURE)
 Main PID: 1959 (code=exited, status=1/FAILURE)

Jul 25 09:13:50 volumio-hp systemd[1]: Starting Music Player Daemon...
Jul 25 09:13:50 volumio-hp sudo[1957]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/chown mpd:audio /var/log/mpd.log
Jul 25 09:13:50 volumio-hp sudo[1957]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jul 25 09:13:50 volumio-hp sudo[1957]: pam_unix(sudo:session): session closed for user root
Jul 25 09:13:50 volumio-hp mpd[1959]: Jul 25 09:13 : exception: Failed to bind to '[::]:6600'; Failed to bind socket: Address already in use
Jul 25 09:13:50 volumio-hp systemd[1]: mpd.service: Main process exited, code=exited, status=1/FAILURE
Jul 25 09:13:50 volumio-hp systemd[1]: mpd.service: Failed with result 'exit-code'.
Jul 25 09:13:50 volumio-hp systemd[1]: Failed to start Music Player Daemon.

volumio@volumio-hp:~$ mpd --kill
exception: no pid_file specified in the config file
volumio@volumio-hp:~$ mpd --no-daemon --stdout --verbose
config_file: loading file /etc/mpd.conf
exception: Failed to bind to '[::]:6600'; Failed to bind socket: Address already in use

volumio@motivo:/$ systemctl status mpd.service
ā— mpd.service - Music Player Daemon
   Loaded: loaded (/lib/systemd/system/mpd.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2024-07-25 09:14:28 CEST; 7min ago
     Docs: man:mpd(1)
           man:mpd.conf(5)
  Process: 1657 ExecStartPre=/usr/bin/sudo /bin/chown mpd:audio /var/log/mpd.log (code=exited, status=0/SUCCESS)
  Process: 1663 ExecStart=/usr/bin/mpd --systemd (code=exited, status=1/FAILURE)
 Main PID: 1663 (code=exited, status=1/FAILURE)

Jul 25 09:14:27 motivo systemd[1]: Starting Music Player Daemon...
Jul 25 09:14:27 motivo sudo[1657]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/chown mpd:audio /var/log/mpd.
Jul 25 09:14:27 motivo sudo[1657]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jul 25 09:14:27 motivo sudo[1657]: pam_unix(sudo:session): session closed for user root
Jul 25 09:14:28 motivo mpd[1663]: Jul 25 09:14 : exception: Failed to bind to '[::]:6600'; Failed to bind socket: Address
Jul 25 09:14:28 motivo systemd[1]: mpd.service: Main process exited, code=exited, status=1/FAILURE
Jul 25 09:14:28 motivo systemd[1]: mpd.service: Failed with result 'exit-code'.
Jul 25 09:14:28 motivo systemd[1]: Failed to start Music Player Daemon.

blissify update button already detect if database has been initiated or not, and adjust the action (init or update)

I had this exact bug once during the plugin dev. Unfortunatlely the only way I found to fix my primo was to factory reset from webinterface.
Iā€™m not sure to have the root cause of the phenomenon since it only happened once, but Iā€™ve a doubt it is linked to blissify update process that, If you simply launch it without passing --number-cores 2 parameter, is occupying 4 cores at 100% and is saturating the host until kernel panic and maybe breaking some volumio core process
@Wheaten : did you launch blissify init or update on each machine ? manually via console or via the plugin interface ?
@balbuze @volumio : does it make sense to you ?

For starters:

  • /data/configuration/user_interface/smartqueue is ownwd by root instead of Volumio
  • Even after chown volumio:volumio settings are not stored
  • I ran your installer on all machines and after failure made the changes and ran your installer again
  • There is no other way than factory reset (4 devices, with 62000 tracks to scan), so yes I did. I expect you need to validate the rights your using when installing. it appears root takes ownership.

Since Iā€™ve lost 16+ hours by now, I gave up on testing as I need my devices to support Volumio.
When everything is sorted out I might give it a try again.

At this point I have only the Odroids running stable, all others are failing.

Odroid:

image

Here I made Volumio owner, but after a reboot no settings are being read, everything defaults back to initial setiing. Even after updating the /data/plugins/user_interface/smartqueue/config.json it still comes up like the screenshot.

This one is for me , I had a strange problem at a time during dev that config.json was not copied during install process to /data/configuration/user_interface/smartqueue. I found a workaround but I visibly didnā€™t address the property correctly (@Balbuze you were right to challenge me on that :upside_down_face:)
For the rest I understand your point, even if the goal is of value, you donā€™t have to suffer for it. Iā€™m going to transform my pi 3 into a proper test bench and I thank you for all this valuable test and build you did for my project, I wonā€™t forget
Iā€™ll be back with a true killer plugin, tested on 3 machines/archs after factory reset, in a couple of weeksā€¦

Until then we may pause the subject.

if people are interested by the project or have side machine to run tests, PM me

Regards
Vincent

Make sure the rPiā€™s are working as this is 80% of the machines running Volumio. All other architectures have a small userbase.
I support this as I really see the added value, but if it starts to break Volumioā€™s core functionality ā€¦
On the paying part, neither do you have to pay for the free Volumio version :wink:

Only will test on 2 devices. rPi4 and Motivo.

  • Installation went smooth, Blissify took only 2 seconds. (Guess the pre-compiled libs did their job)
    However it spits out French messagesā€¦ No clue what it tried to say to me.
Install Blissify on your machine...                                                                                                                                                                       
                                                                                                                                                                                                          
Downloading installation package...                                                                                                                                                                       
TƩlƩchargement du binaire pour l'architecture armv7l...                                                                                                                                                   
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                                                                                                           
                                 Dload  Upload   Total   Spent    Left  Speed                                                                                                                             
100 3935k  100 3935k    0     0  4348k      0 --:--:-- --:--:-- --:--:-- 4344k                                                                                                                            
                                                                                                                                                                                                          
Blissify installĆ© et prĆŖt Ć  l'emploi.                                                                                                                                                                     
                                                                                                                                                                                                          
Session closed.
  • Settings are being stored this time

  • mpd issue (port 6600) after reboot is resolved.

  • SmartQueue install will crash Volumio when Volumioā€™s Library scan is running (Update and Rescan). You might want to add a message of check to avoid this. As after a reboot the MPD database is gone.
    image

However when the last track is being played in the queue, no new tracks are added.
Both Motivo and rPi4.

Launch Bliss update...                                                                                                                                                                                    
                                                                                                                                                                                                          
blissify restarted                                                                                                                                                                                        
song.db found, updating blissify...                                                                                                                                                                       
[2024-07-31T08:17:21Z WARN  blissify] Could not find any MPD_HOST environment variable set. Defaulting to 127.0.0.1.
[2024-07-31T08:17:21Z WARN  blissify] Could not find any MPD_PORT environment variable set. Defaulting to 6600.
Session closed.      

image

Only when I execute manually it will populate the queue on rPi:
sudo /usr/bin/python /data/plugins/user_interface/smartqueue/unit/corechooser.py

On Motivo:

volumio@motivo:~$ sudo /usr/bin/python /data/plugins/user_interface/smartqueue/u                                                                      nit/corechooser.py
[sudo] password for volumio:
Loading configuration from /data/configuration/user_interface/smartqueue/config.                                                                      json
Configuration loaded: {u'Blissmixer': {u'type': u'boolean', u'value': True}, u'A                                                                      utoqueue': {u'type': u'boolean', u'value': False}, u'Drift': {u'type': u'number'                                                                      , u'value': 1}, u'Tracksn': {u'type': u'number', u'value': 10}, u'address': {u't                                                                      ype': u'string', u'value': u'192.168.1.99'}}
Running core chooser under conditions...
Raw values: Autoqueue: False, Blissmixer: True
Autoqueue: False, Blissmixer: True
Running command for Blissmixer true: /usr/bin/pgrep python | xargs -r /bin/kill                                                                       -15 && /usr/bin/python /data/plugins/user_interface/smartqueue/unit/coreb.py
Terminated
volumio@motivo:~$ Traceback (most recent call last):
  File "/data/plugins/user_interface/smartqueue/unit/coreb.py", line 3, in <modu                                                                      le>
    import requests
ImportError: No module named requests

Needed to run:
sudo apt-get install python-requests

Final remark.
It seems it only takes the last track as reference, instead of the complete queue.
So if I have a list containing Rock, pop and Reggae and the last track is Reggae al new tracks will only be Reggae. In this case Bliss is a bit of overkill for this purpose.

  • sudo apt-get install python-requests is part of the install script since 1.1.0, this is strange
    maybe I need to un comment ā€œ# sudo apt-get -f install -yā€ to handle install completion in install.shā€¦
  • Iā€™ve also noticed that reboot (from UI) is broken when smartqueue is activated :roll_eyes:, python is maybe not the best tool to manipulate within volumioā€¦ but Iā€™m so scarred by nodejs logic
  • Sometime you have to save plugin parameter again to start the ā€œengineā€ data/plugins/user_interface/smartqueue/unit/corechooser.py
  • I need to remove any french sentence

Python loops are handled problematic (so the while ā€¦ true loops). For some reason they canā€™t be intercepted and causes all kind of issues. If you are unfamiliar to do this in node.js, I would advice to remove the loop from Python (just make it a single statement) and have this called by a bash script containing the loop.

The way I implement bliss is the following:

  1. if the last track of your queue has been analyzed for metrics, it add x tracks with close metrics via blissify-rs, from whatever genre
    The goal is here to stay on the same musical "mood " (tempo , chroma, ā€¦etc)

  2. if the last track of your queue has not been analyzed for metrics yet, it add x tracks of the same genre via mpc genre command( itā€™s a choice of mine not to break the queue population functionality waiting for complete analysis, maybe not the best in fact)

This is very good remark

Done this 2-3 times, but it wonā€™t start:

volumio@volumio-argon:~$ ps -ef | grep python
root      1266     1  0 11:00 ?        00:00:00 /usr/bin/python3 /etc/argon/argononed.py SERVICE
volumio   1734  1682  0 11:01 ?        00:00:00 /usr/bin/python /bin/bt/simple-agent -c NoInputNoOutput
volumio   2309     1  0 11:11 ?        00:00:00 /usr/bin/python3 /data/plugins/audio_interface/fusiondsp/cgui/main.py
volumio   2500  2144  0 11:14 pts/0    00:00:00 grep python

are you on 1.1.0 or 1.1.1 ?

image