HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: MetaPixel on 2018-11-09 18:32:17

Title: Online radio/location syntax
Post by: MetaPixel on 2018-11-09 18:32:17
Is there a syntax (or a component that adds a similar syntax) for checking if what is being played is local or being streamed over the internet, that would work similar to %ispaused%? I'm customizing foo_discord_rich and want to automatically switch the second line when listening to a online radio.

Currently it looks like this in the attached pictures.
FIrst line:
Code: [Select]
🎧%title%[ '//' %artist%]
Second line:
Code: [Select]
[💿%album%$ifgreater(%totaltracks%,1, '['%tracknumber%/%totaltracks%']',)]

I was planning of something like "$if(%islocal%, *insert old second line here* ,📻[%path% *or* %radioname%])", but I've looked at the title formatting syntax reference document that comes with foobar2000 and didn't find something that could solve this.
Title: Re: Online radio/location syntax
Post by: MetaPixel on 2018-11-09 19:20:20
 Update: I tried using $ifequal and $substr to detect if %path% started with "http", but it didn`t work because apparently $ifequal is for numbers only...?
Code: [Select]
$ifequal($substr(%path%,1,4),http,📻,💿)

So then I converted "http" to a number and IT WORKED!
Code: [Select]
$ifequal($replace($substr(%path%,1,4),http,1337),1337,📻,💿)

I don't know if there is a better way to do this, but at least it is working as expected for now :D

The final result looks like this. I really don't know how to format, so here is a beautiful and awkward long line
Code: [Select]
$ifequal($replace($substr(%path%,1,4),http,1337),1337,📻,💿)[%album%[ '('$year(%date%)')']$ifgreater(%totaltracks%,1, '['%tracknumber%/%totaltracks%']',)]
Title: Re: Online radio/location syntax
Post by: zeremy on 2018-11-09 19:44:46
You could also use %length%
$if(%length%, <local>, <streaming>)

Title: Re: Online radio/location syntax
Post by: MetaPixel on 2018-11-09 19:51:08
You could also use %length%
$if(%length%, <local>, <streaming>)


Oh that's a good idea, this is way easier. I will use this one then, thanks!
Title: Re: Online radio/location syntax
Post by: Pollux88 on 2018-11-10 18:59:55
$if($stricmp($left(%path%,4),http),