The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Autoplay after restart - questions.
#1
Aternoon all,

I'm trying to understand how the "Autoplay after start" feature works.  The track that starts playing does not always seem to correspond to what was on the play queue at the point when the player stopped.  My use case involves a script that uses MPC commands to put streams on the playlist in response to button presses, and also involves having the power turned off mid playback when my wife wants to "turn off the radio" by switching it off at the wall.  I've run several tests but have not managed to isolate what "sticks" as the last playing track.

The code that runs is this:

Code:
               $status = getMpdStatus($sock);
               workerLog(print_r($status, true));
               sendMpdCmd($sock, 'playid ' . $status['songid']);
               $resp = readMpdResp($sock);
               workerLog('worker: Auto-playing id (' . $status['songid'] . ')');
The "songid" parameter appears to be a pointer to an entry in an array, which I would have assumed is the contents of the current play queue.  I find however that this isn't always the case.  I manipulate the queue with a bash script that does this:

Code:
        mpc clear
        mpc load Preset1
        mpc play
There are some circumstances where the Autostart matches what the UI shows to be on the queue after running my scripted mpc commands, but other times not.  I think after a clean reboot, what ever is in the songid gets updated, but I'm not 100% sure I've proven that, it is clear though that "mpc load" does not reliably alter the thing songid points at.

So two questions:
  1. What does songid point at and under what conditions does it get updated?
  2. If I wished to always start with the same radio stream after restart regardless of what was playing at shutdown, can I just pass that stream into the sendMpdCmd function somehow instead?
----------------
Robert
Reply


Messages In This Thread
Autoplay after restart - questions. - by the_bertrum - 04-21-2023, 11:49 AM

Forum Jump: