Page 1 of 1

Make Skin work with only Spotify

Posted: February 3rd, 2017, 5:38 pm
by j.daddy
I use this music visualizer skin called Fountains of Color and wanted to know if it is possible to edit the skin so that only it visualizes only when spotify is running. The extra cpu usage by the skin when playing games or rendering video through madvr is annoying. I have to exit rainmeter and start it again everytime. Any help would be much appreciated.

Thanks

Re: Make Skin work with only Spotify

Posted: February 3rd, 2017, 8:40 pm
by balala
j.daddy wrote:I use this music visualizer skin called Fountains of Color and wanted to know if it is possible to edit the skin so that only it visualizes only when spotify is running. The extra cpu usage by the skin when playing games or rendering video through madvr is annoying. I have to exit rainmeter and start it again everytime. Any help would be much appreciated.
I'm not using Spotify (you also should take care how are you using it: https://forum.rainmeter.net/viewtopic.php?p=131041#p131041).
So, although I know how this could be achieved, I can't test the following solution. Maybe you'll have to adapt it a bit.
So, the solution:
Showing / hiding the skin isn't enough, you have to load / unload it, to avoid the extra CPU usage.
For this you have to create a new skin, into a different config than the Fountain of Colors. So create a new skin (eg on the Skins tab of the Manage Rainmeter window, click the Create new skin button and name the newly created config FountainLoader, for example). If you clicked the New skin button, the newly created skin will open. Add the following code to this new skin:

Code: Select all

[Rainmeter]
Update=1000

[MeasureSpotify]
Measure=Plugin
Plugin=SpotifyPlugin
Type=Playing
IfCondition=(MeasureSpotify=1)
IfTrueAction=[!ActivateConfig "Fountain of Colors" "Fountain of Colors.ini"]
IfFalseAction=[!DeactivateConfig "Fountain of Colors"]

[SomeMeter]
Meter=STRING
See that the [MeasureSpotify] measure of this code, checks if the Spotify player is playing. If it does, the plugin measure returns 1 and in this case, because the IfCondition is met, the IfTrueAction is executed, so the Fountain of Colors is activated / loaded. When Spotify is stopped or paused, the IfCondition isn't met any more, so, according to the bang of the IfFalseAction option, the Fountain of Colors skin is deactivated / unloaded.
Keep in mind that when you're loading the skin of the above code, you won't see anything on the screen, because it has one single empty string meter, without a Text option (so it's invisible). However, the skin should work (I hope!), making its job.
Please let me know if this solution was good enough.

Re: Make Skin work with only Spotify

Posted: February 4th, 2017, 5:17 pm
by j.daddy
balala wrote:I'm not using Spotify (you also should take care how are you using it: https://forum.rainmeter.net/viewtopic.php?p=131041#p131041).
So, although I know how this could be achieved, I can't test the following solution. Maybe you'll have to adapt it a bit.
So, the solution:
Showing / hiding the skin isn't enough, you have to load / unload it, to avoid the extra CPU usage.
For this you have to create a new skin, into a different config than the Fountain of Colors. So create a new skin (eg on the Skins tab of the Manage Rainmeter window, click the Create new skin button and name the newly created config FountainLoader, for example). If you clicked the New skin button, the newly created skin will open. Add the following code to this new skin:

Code: Select all

[Rainmeter]
Update=1000

[MeasureSpotify]
Measure=Plugin
Plugin=SpotifyPlugin
Type=Playing
IfCondition=(MeasureSpotify=1)
IfTrueAction=[!ActivateConfig "Fountain of Colors" "Fountain of Colors.ini"]
IfFalseAction=[!DeactivateConfig "Fountain of Colors"]

[SomeMeter]
Meter=STRING
See that the [MeasureSpotify] measure of this code, checks if the Spotify player is playing. If it does, the plugin measure returns 1 and in this case, because the IfCondition is met, the IfTrueAction is executed, so the Fountain of Colors is activated / loaded. When Spotify is stopped or paused, the IfCondition isn't met any more, so, according to the bang of the IfFalseAction option, the Fountain of Colors skin is deactivated / unloaded.
Keep in mind that when you're loading the skin of the above code, you won't see anything on the screen, because it has one single empty string meter, without a Text option (so it's invisible). However, the skin should work (I hope!), making its job.
Please let me know if this solution was good enough.
Thanks for the help. Your idea is awesome, using another skin to achieve this. Your code works brilliantly. There is another skin inside Fountain of Colors called clone.ini and I wanted to do the same with that skin. Is there a way I can enable/disable two skins with FountainLoader?

Thanks again.

Re: Make Skin work with only Spotify

Posted: February 4th, 2017, 5:31 pm
by balala
j.daddy wrote:Thanks for the help. Your idea is awesome, using another skin to achieve this. Your code works brilliantly. There is another skin inside Fountain of Colors called clone.ini and I wanted to do the same with that skin. Is there a way I can enable/disable two skins with FountainLoader?
Obviously, just have to add the appropriate bangs to the IfTrueAction and IfFalseAction options of the [MeasureSpotify] measure. Complete these options with new !ActivateConfig / !DeactivateConfig bangs, as it follows:

Code: Select all

[MeasureSpotify]
...
IfCondition=(MeasureSpotify=1)
IfTrueAction=[!ActivateConfig "Fountain of Colors" "Fountain of Colors.ini"][!ActivateConfig "Fountain of Colors\Clone" "Clone.ini"]
IfFalseAction=[!DeactivateConfig "Fountain of Colors"][!DeactivateConfig "Fountain of Colors\Clone"]

Re: Make Skin work with only Spotify

Posted: February 4th, 2017, 5:43 pm
by j.daddy
balala wrote:Obviously, just have to add the appropriate bangs to the IfTrueAction and IfFalseAction options of the [MeasureSpotify] measure. Complete these options with new !ActivateConfig / !DeactivateConfig bangs, as it follows:

Code: Select all

[MeasureSpotify]
...
IfCondition=(MeasureSpotify=1)
IfTrueAction=[!ActivateConfig "Fountain of Colors" "Fountain of Colors.ini"][!ActivateConfig "Fountain of Colors\Clone" "Clone.ini"]
IfFalseAction=[!DeactivateConfig "Fountain of Colors"][!DeactivateConfig "Fountain of Colors\Clone"]

Awesome !! I am gonna use this code to enable/disable some other skins. Thanks for all the help again.

Re: Make Skin work with only Spotify

Posted: February 4th, 2017, 6:03 pm
by balala
j.daddy wrote:Awesome !! I am gonna use this code to enable/disable some other skins. Thanks for all the help again.
You're welcome.
Just have to add new !ActivateConfig / !DeactivateConfig bangs, with all needed configs / .ini files.