It is currently April 27th, 2024, 5:27 pm

Getting ImageName not to append file extension

Get help with creating, editing & fixing problems with skins
SightSpirit
Posts: 5
Joined: December 7th, 2023, 5:05 pm

Getting ImageName not to append file extension

Post by SightSpirit »

Hey, Rainmeter community! I am new to Rainmeter, even though I've been eyeing it for the better part of a decade. :confused: Please forgive me if I am missing something obvious here.

I am in the midst of modifying some existing CAD skins to display NowPlaying data from my Jellyfin server. I am using mistic100's NowPlayingJellyfin plugin, which seems to be working overall. Said plugin does not currently support media controls, so that's been a bummer, but in the meantime, what I am struggling with is getting the album art to display. According to the logs, the Image meter is failing to fetch the image from my server, and the culprit appears to be the fact that it always tacks on ".png" at the end of the request URL, while the valid URL should not include a file extension at all. I looked at the meter's official documentation and learned that this is normal behavior. Unfortunately, while said documentation explicitly mentions an exception for the undesired file extension, it stops short of offering any solutions or workarounds.

I have tried using %N syntax without ".png", but that either still passes in the file extension or doesn't even parse at all. I have also tried using both regular and regex substitution, each in the measure and in the meter, to no avail. These solutions result in identical errors in each of the skins I've modified.

Any ideas? I have navigated to the request URL without the file extension in a browser, and it works just fine, so I am 95% sure that that is the culprit.

Thanks in advance!
Last edited by SightSpirit on December 8th, 2023, 3:24 pm, edited 1 time in total.
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Getting ImageName not to append file extension

Post by Yincognito »

SightSpirit wrote: December 7th, 2023, 5:23 pm Hey, Rainmeter community! I am new to Rainmeter, even though I've been eyeing it for the better part of a decade. :confused: Please forgive me if I am missing something obvious here.

I am in the midst of modifying some existing CAD skins to display NowPlaying data from my Jellyfin server. I am using mistic100's NowPlayingJellyfin plugin, which seems to be working overall. Said plugin does not currently support media controls, so that's been a bummer, but in the meantime, what I am struggling with is getting the album art to display. According to the logs, the Image meter is failing to fetch the image from my server, and the culprit appears to be the fact that it always tacks on ".png" at the end of the request URL, while the valid URL should not include a file extension at all. I looked at the meter's official documentation and learned that this is normal behavior. Unfortunately, while said documentation explicitly mentions an exception for the undesired file extension, it stops short of offering any solutions or workarounds.

I have tried using %N syntax without ".png", but that either still passes in the file extension or doesn't even parse at all. I have also tried using both regular and regex substitution, each in the measure and in the meter, to no avail. These solutions result in identical errors in each of the skins I've modified.

Any ideas? I have navigated to the request URL without the file extension in a browser, and it works just fine, so I am 95% sure that that is the culprit.

Thanks in advance!
The Image meter only works with local image files, not URLs. So, the image file must first be "downloaded" locally before being able to be used by the Image meter normally, with the extension and everything.

To handle accessing the URL and downloading the desired image, you should look into WebParser measures:
https://docs.rainmeter.net/manual/measures/webparser/
See the URL, Download and DownloadFile options for more details on achieving what you're after.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16177
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Getting ImageName not to append file extension

Post by balala »

SightSpirit wrote: December 7th, 2023, 5:23 pm Any ideas?
Besides Yincognito's correct description, you should have to post a code you're working with. Posting only the plugin is not enough.
SightSpirit
Posts: 5
Joined: December 7th, 2023, 5:05 pm

Re: Getting ImageName not to append file extension

Post by SightSpirit »

Alright, here are the relevant parts of what I have so far:

Code: Select all

[MeasureCover]
Measure=Plugin
Plugin=NowPlayingJellyfin
PlayerName=MeasureArtist
PlayerType=COVER

...

[ArtDownload]
Measure=WebParser
URL=[MeasureCover]
Download=1
DynamicVariables=1
FinishAction=[!UpdateMeasure MeterAlbumArt]

[MeterAlbumArt]
Meter=Image
MeasureName=ArtDownload
X=(38*#Scale#)
Y=(40*#Scale#)
W=(50*#Scale#)
MaskImageName=#@#Mask.png
(Adapted from Vin Star's Blurry Music Player)

I think I'm on the right track? It's not erroring out anymore, but it still doesn't display the image. Or seem to download it, either.
User avatar
balala
Rainmeter Sage
Posts: 16177
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Getting ImageName not to append file extension

Post by balala »

SightSpirit wrote: December 7th, 2023, 8:39 pm Alright, here are the relevant parts of what I have so far:
Try adding an OnChangeAction=[!CommandMeasure "ArtDownload" "Update"] option to the [MeasureCover] measure.
SightSpirit
Posts: 5
Joined: December 7th, 2023, 5:05 pm

Re: Getting ImageName not to append file extension

Post by SightSpirit »

balala wrote: December 7th, 2023, 8:50 pm Try adding an OnChangeAction=[!CommandMeasure "ArtDownload" "Update"] option to the [MeasureCover] measure.
That was a good idea, but it seems not to have done the trick.
User avatar
balala
Rainmeter Sage
Posts: 16177
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Getting ImageName not to append file extension

Post by balala »

SightSpirit wrote: December 7th, 2023, 8:58 pm That was a good idea, but it seems not to have done the trick.
Alright, just to check if the measure is working properly do the followings:
  • Add a H=(50*#Scale#) option to the [MeterAlbumArt] meter.
  • Also add a SolidColor=0,0,0,100 option to the same [MeterAlbumArt] meter. With these two options, you'll get a light gray area where the image should be shown.
  • Finally add the following option to the [MeterAlbumArt] meter: LeftMouseUpAction=[!CommandMeasure "ArtDownload" "Update"].
When you did it, after the playback starts, try clicking the light gray area where the cover should appear. Wait a few moments. Is it shown? If it's not, is there any message in the log?
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Getting ImageName not to append file extension

Post by Yincognito »

Besides balala's suggestions...
FinishAction=[!UpdateMeasure MeterAlbumArt]
MeterAlbumArt is a METER, not a MEASURE, so it should be !UpdateMeter. Plus, a !Redraw will make the changes visible afterwards.

EDIT: Also...
URL=[MeasureCover]
should be:

Code: Select all

URL=[&MeasureCover]
because MeasureCover is not a WebParser parent measure, but just some measure you want its String value from (this & is specific to the WebParser URL option in such cases, though it's part of the nested syntax for measures, by the way).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
SightSpirit
Posts: 5
Joined: December 7th, 2023, 5:05 pm

Re: Getting ImageName not to append file extension

Post by SightSpirit »

Thanks again for the continued help, folks.

I am so close now! It is now fetching the file successfully, but the download is not being assigned a file extension, so it is not displaying. How can I get it to append ".png" to filename after download?
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Getting ImageName not to append file extension

Post by Yincognito »

SightSpirit wrote: December 8th, 2023, 2:22 pm Thanks again for the continued help, folks.

I am so close now! It is now fetching the file successfully, but the download is not being assigned a file extension, so it is not displaying. How can I get it to append ".png" to filename after download?
You have two choices:
1) use the download name even if it doesn't have an extension, e.g.:

Code: Select all

...

[ArtDownload]
...
Download=1

...

[MeterAlbumArt]
...
Meter=Image
MeasureName=ArtDownload
ImageName=%1.

...
2) force an extension on the download name, e.g.:

Code: Select all

...

[ArtDownload]
...
Download=1
DownloadFile=SomeFile.SomeExtension

...

[MeterAlbumArt]
...
Meter=Image
MeasureName=ArtDownload

...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth