Web radio streams 2 - how to switch automatically between them?
- Inicie sesión o regístrese para enviar comentarios
Since those radio streams are so specialized, at times bordering monomania, I was wondering whether anyone knew of a player that would implement a plugin to switch track after a preset duration. I could not find any on Audacious, although it has an impressive list of plugins.
The idea would be that any shorter track would be played to the end, but longer tracks (including those endless streams) would be switched after a given time without user interaction on the player. I might try to write a small script to that purpose, based on audtool, should be simple enough. Not sure how streams advertise their duration, though.
https://github.com/audacious-media-player/audacious/blob/master/man/audtool.1.in.
I came up with this, and it seemed to work fine from the terminal: if [ $(audtool current-song-output-length-seconds) -gt 900 ] ; then (audtool playlist-advance) ; fi
I did not manage to pipe it into 'at', so I saved it as script.sh and pasted this as the command to execute when a new track is started in Audacious: at now +15 minute -f script.sh
I'm in America, so I just pull out a gun and shoot the computer if the song or stream goes on too long. Don't shoot the monitor though, that doesn't stop the music. Have to shoot for the cpu.
I see. That could explain why we keep running out of components.
Feel free to use that short script, you can always shoot a random mouse instead to vent your rage whenever the selection goes substandard.
I think I messed up. I used your script, except I did it like this:
if [ $(audtool current-song-output-length-seconds) -gt 900 ] ; then (audtool Cthulhu-advance) ; fi
and now dead people are getting up out of their graves all over town and coming to my house and banging on my doors and windows.
Did it work for you? Did it switch your 10-minute death metal rage songs for short and sweet love songs by Wham! and by Cindy Lauper? My 'at' command isn't working. Audacious won't switch away from death metal for me. The shell script works when I run it against the current playing song from the terminal or invoke it as a shell script though.
> My 'at' command isn't working.
at now +16 minute -f script.sh
may give better results. The 'now +' option does not know about seconds, so "now +x minute" means the current minute plus x minutes, and zero second. So if we set our conditional little script to run at "now + 15 minute", the 900 seconds will in fact most probably not have elapsed...
The above version works fine, after changing 15 to 16 in the General > Song change plugin options.
Ahh, that makes sense. As long as the at command is more than the loop timer, then it should work.
Well, it does make sense, and it does not completely make sense at the same time.
Still not sure why 'at now + 15 minute' is in fact pointing to 'now + 900 seconds'. It seems that the behavior of 'at' and 'date' may vary. In my case, I can clearly see that the script kicks in at exactly start time +15:00 minutes. That still explain why it does nothing if timer is set at "-gt 900". Currently trying with "-ge 900".
The song currently playing is inviting me to take a walk on the wild side, though...so I may oblige and go get some wild sleep.
EDIT: I sleep-walked to find that 'now + x minutes' does in fact ignore the actual number of seconds elapsed before the next minute (next time when MM:SS is MM:00) and counts it as +1 minute in any case. So setting the title duration at '-gt 900' and telling the script to launch at 'now +15' will always result in the current stream being forever played. Adding one extra minute to now is the only solution. I was tricked by my inadvertently starting a stream at about MM:00, so it looked like the change always happened at +16:00.
>"I was tricked by my inadvertently starting a stream at about MM:00, so it looked like the change always happened at +16:00."
You were tricked by yourself. Next thing we'll find out is that you were robbed of money by yourself. And that your relationship partner is cheating on you with yourself. This is what happens when one has facetimed too many times with Cthulhu.
I got distracted by someone's attempt to write about Camus "The Rebel" in English in Wikipedia, and I completely forgot I was re-editing my previous post here. Now it is to stay there unreedited, half-baked, for the posterity to admire or for Cthulhu to digest slowly, or both.
Suffice to say that because of the absurd nature of the 'at now +x minute' command, this script is bound to create a terrible mess anyway. Surely you did not need to invoke Cthulhu explicitly, they are already invading our dimension through that ridiculously short one-liner.
> You were tricked by yourself.
I strongly disagree: I was clearly tricked by a previous form of myself, in other words, by time. And we all know who controls time.
>"And we all know who controls time."
I think Steve Jobs still holds all the patents on time, even in his death. We aren't allowed to use time other than Apple iTime.
That makes sense. That explains why the 'now + x' option cannot use seconds: they are unavailable outside the Realm of the Beast.
Time is such an evil thing anyway, sounds wiser to stay clear from that cracking contraption.
I attached the script file, for future needs and for the posterity to contemplate.
Adjunto | Tamaño |
---|---|
script.txt | 113 bytes |
> you were robbed of money by yourself
That is exactly how I feel each time I buy myself anything.
That said, I think we should all read, or re-read, The Rebel and the Myth of Sisyphus. Software freedom really feels like that rock to be pushed up that mountain forever, only to be seen rolling down the other side. We should be content with keeping pushing it up. This is both our absurd task and our rebellion.
I noticed that you are sysyphus recently. Must feel quite different from being a toad or a skull or hamlet.
Thanks to Cthulhu for giving you your shape-shifting abilities.
You are being far too optimistic. I have been turned into an uphill dung beetle.
You are probably right about Cthulhu having something to do with it, though.
Ever notice how Stallman hides his Cthulhu tentacles in his beard?
Coincidence? I think not.
This is an interesting picture by the way. Stallman, Assange and Snowden. Which of these three have been accused of very questionable charges to try to erase them from the dialog on modern ethics? Almost seems like all three of them.
> Cthulhu-advance
I had been considering doing like you did, but I thought summoning the vikingmetal stream from time to time might be more reasonable for casual occasions. It might still be somewhat too early to go full undead attack.
You have in fact been very lucky not to inadvertently change that 900 figure to 1 or 2.
- Inicie sesión o regístrese para enviar comentarios