It is currently December 7th, 2021, 11:45 am

Windows Now Playing

Share and get help with Plugins and Addons
bigparty
Posts: 3
Joined: March 7th, 2021, 7:39 pm

Windows Now Playing

Post by bigparty »

Hello. I was looking for a skin to display the music information and all skin needed to inform a music player (spotify, wpm, foobar2000 ...). My idea was to display the information of any player or browser that was playing any music or video, as well as in the "now playing" of Windows.

Image

As today I only use the browser to listen music, the WebNowPlaying plugin would be enough for me. However, it was not compatible with my browser. So I decided to make a program myself to get this information directly from Windows.

The software I made takes information about the title, artist, album name and thumbnail. As in windows, it works with any program and takes information from everything that plays some type of media. If it is useful for someone, I am making a skin available with the example of use. It has some bugs, but I currently use it to get the title and name of the artist and it works well.

Image
You do not have the required permissions to view the files attached to this post.
bigparty
Posts: 3
Joined: March 7th, 2021, 7:39 pm

Re: Windows Now Playing

Post by bigparty »

How to use:

Through the RunCommand plugin.

Abstract example:

Parameter = WindowsNowPlaying [title|artist|album] [truncate at] [add at end of truncated string]

or

Parameter = WindowsNowPlaying thumb

Real example:

Code: Select all

[MeasureTitle]
Measure=Plugin
Plugin=RunCommand
Parameter=WindowsNowPlaying title 32 ...
DynamicVariables=1
OutputType=ANSI
OutputFile=#CURRENTPATH#title.txt
The output of [MeasureTitle] will be the title of the song / video or whatever is playing. If it is longer than 32 characters, it will be truncated to the 32nd character and "..." will be added to the end.

The [truncate at] and [add at end of truncated string] parameters cannot be used with the thumb parameter.

When calling "WindowsNowPlaying thumb" a file named "thumbnail.png" will be saved in the same location as the .ini, if something is playing. For the example I used the QuotePlugin plugin to display the image.

The output of "WindowsNowPlaying thumb" can be two values ​​(150/84). These values ​​represent the height of the image resolution. The file can be in the format of 150x150 or 150x84 (youtube thumnails generally).

When there is nothing playing or paused, the output will be null / empty and the thumbnail will be deleted.

And I believe that is all.
User avatar
deflore08
Posts: 206
Joined: July 12th, 2020, 7:47 am
Location: Ada, Garden City

Re: Windows Now Playing

Post by deflore08 »

Really useful! Thank you buddy! :thumbup:
Image * Image * Image
User avatar
Cariboudjan
Posts: 199
Joined: May 12th, 2019, 8:55 am

Re: Windows Now Playing

Post by Cariboudjan »

Excellent work here. Question, would it be possible for you to recompile the addon to remove new lines from the output?

When using WriteKeyValue to save the output, it creates unneeded/unwanted newlines below the variable.

Using RegExpSubstitute=1 and Substitute="\r\n":"" doesn't appear to work with RunCommand measures?

Also if exceptions could return no text. Maybe move the exception to the Rainmeter log instead of a returning it as the measure's value.

Also would be good to have some way of automatically triggering the RunCommand bangs when some sort of other trigger identifies that a song name has changed.


123.png
You do not have the required permissions to view the files attached to this post.
Last edited by Cariboudjan on June 29th, 2021, 7:21 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22419
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Windows Now Playing

Post by jsmorley »

Cariboudjan wrote: June 29th, 2021, 6:11 pm Excellent work here. Question, would it be possible for you to recompile the addon to remove new lines from the output?

When using WriteKeyValue to save the output, it creates unneeded/unwanted newlines below the variable.

Using RegExpSubstitute=1 and Substitute="\r\n":"" doesn't appear to work with RunCommand measures?

Also if exceptions could return no text. Maybe move the exception to the Rainmeter log instead of a returning it as the measure's value.



123.png
Don't use Substitute="\r\n":"". Use Substitute="#CRLF#":"" instead.
User avatar
Cariboudjan
Posts: 199
Joined: May 12th, 2019, 8:55 am

Re: Windows Now Playing

Post by Cariboudjan »

Huh. Never considered that.
User avatar
Yincognito
Rainmeter Sage
Posts: 4108
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Windows Now Playing

Post by Yincognito »

jsmorley wrote: June 29th, 2021, 6:41 pm Don't use Substitute="\r\n":"". Use Substitute="#CRLF#":"" instead.
\R or \r?\n should work as well, shouldn't they? If it's just \n used as CR/LF instead of the \r\n, that is...

I'm successfully substituting in RunCommand outputs using \n, by the way, so I'm guessing that's the problem.
User avatar
jsmorley
Developer
Posts: 22419
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Windows Now Playing

Post by jsmorley »

Yincognito wrote: June 29th, 2021, 10:06 pm \R or \r?\n should work as well, shouldn't they? If it's just \n used as CR/LF instead of the \r\n, that is...

I'm successfully substituting in RunCommand outputs using \n, by the way, so I'm guessing that's the problem.
Sure, but #CRLF# will match either way. If the file has \r\n (Windows) EOL characters, or \n (Unix) EOL character. So it seems a lot simpler, or at least more reliable, to me.

I suspect that #CRLF# actually just matches on the \n, but if you remove the \n from the \r\n EOL, it has the same effect. I think a \r by itself has no effect at all. The whole Carriage Return deal is a prehensile tail in any case, that Windows just kept so older code won't fail. Not that many "carriages" out there to "return"...

User avatar
Yincognito
Rainmeter Sage
Posts: 4108
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Windows Now Playing

Post by Yincognito »

jsmorley wrote: June 29th, 2021, 10:15 pm Sure, but #CRLF# will match either way. If the file has \r\n (Windows) EOL characters, or \n (Unix) EOL characters. So it seems a lot simpler, or at least more reliable, to me.
Of course - just wanted to be sure it's not something else than that. :thumbup:
User avatar
death.crafter
Rainmeter Sage
Posts: 1206
Joined: April 24th, 2021, 8:13 pm

Re: Windows Now Playing

Post by death.crafter »

A perfect good morning song lol... I am glad I didn't just mark the forums read and paid a visit here
from the Realm of Death