String.Contains brackets "[" or parentheses "("
#1
Does anyone know a way to do a string.contains or string.startswith and check for a string with parentheses

Basically, I want to check if a property contains "ActivateWindow(music"
for instance:
Code:
condition="Skin.StartsWith(ListItem.Property(path),ActivateWindow(music)"

Is this at all possible? I've try escaping \ and wrapping it in quotes "" and also urlencoding %28 but nothing I've tried works.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#2
Code:
condition="String.StartsWith(ListItem.Property(path),ActivateWindow(music))"

Wink

Untested but your example had a missing parentheses and used Skin instead of String.

If that doesn't work you can split it into multiple conditions like
Code:
String.StartsWith(ListItem.Property(path),ActivateWindow) + String.Contains(ListItem.Property(path),music)

Edit:
Sorry, it's not a missing parentheses, but yeah it does not work. You have to split the condition.
Main: Lancool II Mesh  - Ryzen 9 5900x - MSI x570 Unify - Zotac RTX 3080 AMP HOLO - 32GB Trident Z Neo 3600 CL16 -  EVO 960 M.2 250GB / EVO 940 250GB / MX100 512GB /  Crucial P1 2TB / WD Blue 3D Nand 2TB 
Sound: Saxx AS30 DSP - Beyer Dynamic Custom One Pro 
TV: Nvidia Shield 2019 Pro- Adalight 114x LEDs - Sony 65XG9505 - Kodi / Emby - Yamaha RX-V683 - Heco Victa 700/101/251a + Dynavoice Magic FX-4
Server: i3 Skylake - 8GB - OMV4 - 22TB Storage
Reply
#3
(2019-03-19, 15:08)sualfred Wrote:
Code:
condition="String.StartsWith(ListItem.Property(path),ActivateWindow(music))"

Wink

Untested but your example had a missing parentheses and used Skin instead of String.

If that doesn't work you can split it into multiple conditions like
Code:
String.StartsWith(ListItem.Property(path),ActivateWindow) + String.Contains(ListItem.Property(path),music)

Edit:
Sorry, it's not a missing parentheses, but yeah it does not work. You have to split the condition.
Yeah that was just a typo in the post. I had used String.startswith in my code.

The missing parenthesis is on purpose because I'm looking for things like ActivateWindow(music,musicdb://albums,return) and so on - basically trying to get content target from path.

Splitting it doesn't work because then I get the wrong target for things like musicvideos
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#4
I know hacky, but that will work for that case:
Code:
String.StartsWith(ListItem.Property(path),ActivateWindow) + String.Contains(ListItem.Property(path),music) + !String.Contains(ListItem.Property(path),musicvideo)

Or use the library node, which is what I do in a few cases:
Code:
String.StartsWith(ListItem.Property(path),ActivateWindow) + [String.Contains(ListItem.Property(path),musicdb://) | String.Contains(ListItem.Property(path),library://music)]
Main: Lancool II Mesh  - Ryzen 9 5900x - MSI x570 Unify - Zotac RTX 3080 AMP HOLO - 32GB Trident Z Neo 3600 CL16 -  EVO 960 M.2 250GB / EVO 940 250GB / MX100 512GB /  Crucial P1 2TB / WD Blue 3D Nand 2TB 
Sound: Saxx AS30 DSP - Beyer Dynamic Custom One Pro 
TV: Nvidia Shield 2019 Pro- Adalight 114x LEDs - Sony 65XG9505 - Kodi / Emby - Yamaha RX-V683 - Heco Victa 700/101/251a + Dynavoice Magic FX-4
Server: i3 Skylake - 8GB - OMV4 - 22TB Storage
Reply
#5
I've been using it like so:
Code:
<expression name="IsKnownMenuEntryPath">String.IsEqual(ListItem.Property(path), ActivateWindow(home,return)) | String.IsEqual(ListItem.Property(path), ActivateWindow(1110,return)) | String.IsEqual(ListItem.Property(path), ActivateWindow(1111,return)) | String.IsEqual(ListItem.Property(path), ActivateWindow(1112,return)) | String.IsEqual(ListItem.Property(path), ActivateWindow(1113,return)) | String.IsEqual(ListItem.Property(path), ActivateWindow(1114,return)) | String.IsEqual(ListItem.Property(path), ActivateWindow(1115,return)) | String.IsEqual(ListItem.Property(path), ActivateWindow(1106,return))</expression>

Since kodi didn't receive the contains ones very well....having 3 contains checks for each sounds like a lot of calculation time... :|
Reply
#6
(2019-03-19, 16:47)sualfred Wrote: Or use the library node, which is what I do in a few cases:
Code:
String.StartsWith(ListItem.Property(path),ActivateWindow) + [String.Contains(ListItem.Property(path),musicdb://) | String.Contains(ListItem.Property(path),library://music)]

Yeah, that's my current implementation:
Code:
[String.Contains(Container(211).ListItem.Property(path),musicdb://) | String.Contains(Container(211).ListItem.Property(path),library://music) | String.Contains(Container(211).ListItem.Property(path),sources://music) | String.Contains(Container(211).ListItem.Property(path),plugin://plugin.audio)]

My main problem is how to handle music playlists because there is nothing that identifies them other than "ActivateWindow(Music"
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply

Logout Mark Read Team Forum Stats Members Help
String.Contains brackets "[" or parentheses "("0