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:
[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.
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 "\":"\\"?
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.
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.
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.
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
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