It is currently May 18th, 2024, 5:06 pm

Possibility? Now Playing Art gird

Get help with creating, editing & fixing problems with skins
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Possibility? Now Playing Art gird

Post by Kaelri »

MerlinTheRed wrote:This might work. Of course this won't be all you need. I'd make a loop over all 25 images and copy image 24 to 25, then 23 to 24, etc. If an image does not exist, you can check that and just go on without copying. Then at the end copy your current image to 0.png.
I don't think I would do it like that. I would save each album image as Artist - Album.png, and keep an ordered list in the skin as variables:

Code: Select all

[Variables]
Image0=Peter Gabriel - So.png
Image1=Lady Gaga - The Fame Monster.png
Image2=Pink Floyd - Dark Side of the Moon.png
...
I'd get these variables into Lua in Initialize() and put them into the table. Then I'd have Update() get current Album & Artist combination, and check to see if they're in the list. If so, it will bump them up to Image0. If not, it will save the album art, insert the filename at the beginning of the list, and then delete and remove the last image in the list if the number exceeds 25.
Lightz39
Posts: 98
Joined: August 1st, 2012, 12:48 am

Re: Possibility? Now Playing Art gird

Post by Lightz39 »

Hum, it still doesn't seem to want to work. Maybe I'm executing it wrong in my skin. Not really sure how to do this. Right now I have:

Code: Select all

[mAlbumArt]
Measure=Plugin
Plugin=NowPlaying
PlayerName=iTunes
PlayerType=Cover
TrackChangeAction=[!WriteKeyValue Variables ArtPath [mAlbumArt]][!CommandMeasure [mSaveArt]]

[mSaveArt]
Measure=Script
ScriptFile=Save.lua
I just thought of something. Because the variable returned by the nowplaying plugin has normal \ and not double \\ would it fail to recognize the file path like it did on mine? Should I substitute "\":"\\"?
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Possibility? Now Playing Art gird

Post by MerlinTheRed »

This is how you can call a function from a Lua script on-demand in Rainmeter. UpdateDivider=-1 is inserted since in this case you don't need a continuously updating script but only one that is called when needed. DynamicVariables=1 is used because you use a measure's name in brackets.

Code: Select all

[mAlbumArt]
Measure=Plugin
Plugin=NowPlaying
PlayerName=iTunes
PlayerType=Cover
TrackChangeAction=[!WriteKeyValue Variables ArtPath [mAlbumArt]][!CommandMeasure "mSaveArt" "Update()"]
DynamicVariables=1

[mSaveArt]
Measure=Script
ScriptFile=Save.lua
UpdateDivider=-1
Actally, Kaelri's idea is even better though. Save the album and artist name so duplicates aren't created if you listen to multiple tracks on the same album.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
Lightz39
Posts: 98
Joined: August 1st, 2012, 12:48 am

Re: Possibility? Now Playing Art gird

Post by Lightz39 »

Haha, well that caused rainmeter to crash and now it won't open. :(

EDIT: It also screwed up the nowplaying plugin all together lol. It started creating new image files instead of overwriting them so the cover on my other media player wouldn't update. I fixed it but still, there is an issue with this obviously.

EDIT2: Just a guess. Since I opened the file in read mode did this maybe make it so rainmeter could no longer update or "write" to it so it started making new ones instead?

EDIT3: Tried another test where I tried opening and writing a test image from one directory to another inside a skin folder and it also crashed rainmeter. It also had the same effect on NowPlaying even though the test had nothing to do with it. There must be an issue with the read and write.
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Possibility? Now Playing Art gird

Post by Kaelri »

File functions can be pretty picky about how you use them, and in what order. Can't really diagnose it without the code, of course.
Lightz39
Posts: 98
Joined: August 1st, 2012, 12:48 am

Re: Possibility? Now Playing Art gird

Post by Lightz39 »

Ok here is what I used.

Script:

Code: Select all

function Initialize()
   mAlbumArt = SKIN:GetMeasure('mAlbumArt')
end

fuction Update()
   FilePath = mAlbumArt:GetStringValue()
   local OpenImagePath = SKIN:MakePathAbsolute(FilePath)
   local OpenImageFile = io.open(OpenImagePath, 'rb')
   local OpenImageData = OpenImageFile:read('*all')
OpenImageFile:close()

   local SaveImagePath = SKIN:MakePathAbsolute('C:\\Users\\Tyler\\Documents\\Rainmeter\\Skins\\Album Grid\\Album Art\\0.png')
   local SaveImageFile = io.open(SaveImagePath, 'wb')
   SaveImageFile:write(OpenImageData)
   SaveImageFile:close()
end
INI:

Code: Select all

[Rainmeter]
Author=Tyler LaCroix
Update=1000

[Variables]
ArtPath=C:\\Users\\Tyler\\AppData\\Local\\Temp\\jpg4268.tmp

[mAlbumArt]
Measure=Plugin
Plugin=NowPlaying
PlayerName=iTunes
PlayerType=Cover
TrackChangeAction=[!WriteKeyValue Variables ArtPath [mAlbumArt]][!CommandMeasure "mSaveArt" "Update()"]
Substitute="\":"\\"

[mSaveArt]
Measure=Script
ScriptFile=Save.lua
UpdateDivider=-1

[AlbumArtText]
Meter=String
MeasureName=mAlbumArt
FontFace=Arial
FontColor=FFFFFF
FontSize=20
AntiAlias=1
SolidColor=0,0,0,1
X=0
Y=0

[AlbumArt]
Meter=Image
MeasureName=mAlbumArt
W=200
H=200
X=0
Y=40
It causes an instant crash in rainmeter.
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Possibility? Now Playing Art gird

Post by KreAch3R »

I think that substitute line messes things up (didn't test anything). Try commenting that out.
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Possibility? Now Playing Art gird

Post by Kaelri »

fuction Update()

Needs to be function. :)
KreAch3R wrote:I think that substitute line messes things up (didn't test anything). Try commenting that out.
Technically, I don't think it will hurt anything. But it is indeed unnecessary.
Lightz39
Posts: 98
Joined: August 1st, 2012, 12:48 am

Re: Possibility? Now Playing Art gird

Post by Lightz39 »

I was trying to be clever :( Haha, thanks for the help. I will try it out.

EDIT: WORKS! :D How you caught that is beyond me. I re read it like 12x. Spell checker?

Thank you! Now to start diving into the harder stuff. :? Wish me luck.
User avatar
haibusa2005
Posts: 52
Joined: June 15th, 2011, 7:23 pm
Location: Bulgaria, Varna

Re: Possibility? Now Playing Art gird

Post by haibusa2005 »

I was looking at the manual seeking a solution for my problem and got that idea - since you are mastering the Lua scripting, why not copy the album art file to the preconfigured folder, check if it has unique name and then attach a number to it in the format ###Artist-album. Then you could parse the numbers alone and use the Random function to arrange the grid. That doesn't apply if you want the grid to be strictly chronological :D