Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse source after exit 0 in rotate.merge #2872

Closed
toots opened this issue Jan 31, 2023 Discussed in #2860 · 0 comments
Closed

Reuse source after exit 0 in rotate.merge #2872

toots opened this issue Jan 31, 2023 Discussed in #2860 · 0 comments

Comments

@toots
Copy link
Member

toots commented Jan 31, 2023

Discussed in #2860

Originally posted by krangm January 23, 2023
Hello.

Please help to find out how to reuse source in rotate.merge after it's exit. As it states in docs, rotate.merge should loops a sequence of sources. But after source exit 0 on the end of track, stream goes safe_blank instead of looping sources.

Some info:

$ uname -a
Linux localhost 6.1.0-1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.4-1 (2023-01-07) x86_64 GNU/Linux

$ liquidsoap --version
Liquidsoap 2.1.3

LS code:

#!/usr/bin/liquidsoap
log.file.path.set("/home/user/radio/radio.log")
log.stdout.set(true)

def input.airsonic(~id="input.airsonic",
		~restart=false,~restart_on_error=false,
		~buffer=0.2,~max=20.,s) =
	input.external.rawaudio(id=id,restart=restart,
		restart_on_error=restart_on_error,
		buffer=buffer,max=max,
		"/home/user/radio/streamer #{string.quote(s)}")
end

trackids = (process.read.lines("cat /home/user/radio/total_songs.list"))

def input.airsonic.random(~id="input.airsonic.random",
		~restart=false,~restart_on_error=false) =
	input.airsonic(id=id,restart=restart,
		restart_on_error=restart_on_error,
		list.pick(list.shuffle(trackids)))
end

radio = rotate.merge([input.airsonic.random(),input.airsonic.random()])
radio = mksafe(radio)

output.icecast(%fdkaac(channels=2, samplerate=44100,
		bandwidth="auto", bitrate=128, afterburner=true,
		aot="mpeg4_he_aac_v2", transmux="adts", sbr_mode=true),
	host = "x",
	port = x,
	password = "x",
	mount = "x",
radio)

With current code, LS plays two random tracks and goes safe_blank after each of sources exit. If i try to set
rotate.merge([input.airsonic.random(restart=true),input.airsonic.random(restart=true)])
only first source plays and it constantly repeats 1 track, so it does not perform list.pick() every time as expected.

Is there a way to reuse source without restart argument? Or to re-read variable on source repeat? Or maybe there is another approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant