0

I have a MySQL database that stores all my tracks and their associated information. One of the tables in the database is a queue table from which I pull a track for Liquidsoap to play. I am providing those tracks to play with Liquidsoap by using the request.dynamic.list.

def get_track() = 
    # Get the first line of my external process
    result = list.hd(default="", get_process_lines(scripts ^ "get_track.py"))
    print(result)
    # Create and return a request using this result
    [request.create(result)]
end

# Create the source
sourcetrack = request.dynamic.list(id="play_queue", conservative=false, get_track)

The get_track.py script retrieves a record from a queue table in the database.

I noticed that Liquidsoap will grab two tracks when in starts up. Two get "accepted" and one is "prepared."

Is there a way to get Liquidsoap to only accept one track at a time and wait to accept the next one only when reaching near the end of the currently playing track?

I also have scheduled programs that get added to the queue table in the database and when this occurs, all tracks are cleared from the queue table in the database and the program is then added to the queue table.

Since Liquidsoap appears to have a track already loaded in its queue while playing the "prepared" track, is there a way to remove that track so Liquidsoap will not play that track next, but rather call again the get_track.py script to load new track from queue table in database?

user5919866
  • 69
  • 1
  • 8

1 Answers1

1

Liquidsoap always prepares stream's next items in advance, and it's a fundamental principle of its scheduler. This allows to start a download before playing the downloaded track, for example. As long as you are using request.dynamic.list, the called script must take care of this. In other words, you can't only rely on clock time to evaluate the track to return. As far as I understand your use case you might prefer using a request.queue source, and have your script push each request on time via the telnet server.

Martin
  • 56
  • 3
  • Actually, I solve my issue back some months ago by creating sources and using `request.equeue` with the source push. – user5919866 Jan 26 '21 at 21:27