Here's the problem: I run the powershell script using the RunCommand plugin. RunCommand has to be called with a bang so every time a new album cover is extracted the RunCommand measure is called and runs the powershell script that writes the list of files. For some reason RunCommand seems to lag behind and uses the Measure Values from the last update cycle. So in the end the skin shows the music file that matches the previous album cover which isn't right. What's also weird is that if you call RunCommand with "OnRefreshAction" it will work right for the first cycle. Using "OnUpdateAction" is no alternative though since this is too taxing on the CPU.
It would be nice if someone could help me with this problem.
Here are all parts of my skin needed to reproduce the problem:
The .ini file:
Code: Select all
[Rainmeter]
Update=1000
;OnUpdateAction=[!CommandMeasure "MeasureRunFolderContent" "Run"]
;OnRefreshAction=[!CommandMeasure MeasureRunFolderContent "Run"]
[Variables]
MusicPath=#@#Albums
[StringStyle]
FontFace=Courier New
FontSize=8
FontColor=255,255,255,255
StringAlign=LEFT
StringEffect=Border
Antialias=1
###Measures###
[MeasureRandomCover]
Measure=Plugin
Plugin=QuotePlugin
PathName=#MusicPath#
Subfolders=1
FileFilter=*.jpg;*.png;*.gif
UpdateDivider=5
OnChangeAction=[!UpdateMeasureGroup "Image"]
;This lua script will get the file path to the image [MeasureRandomCover] extracted.
[MeasureLuaGetImagePath]
Measure=Script
ScriptFile=#@#GetImagePath.lua
TableName=NoPath
Group=Image
UpdateDivider=-1
OnChangeAction=[!CommandMeasure MeasureRunFolderContent "Run"]
;DynamicVariables=1
[MeasureStringCoverFolder]
Measure=String
String=[MeasureLuaGetImagePath]
RegExpSubstitute=1
Substitute="\\[^\\]*$":""
Group=Image
UpdateDivider=-1
DynamicVariables=1
[MeasureStringCoverFolderParent]
Measure=String
String=[MeasureLuaGetImagePath]
RegExpSubstitute=1
Substitute="\\[^\\]*\\[^\\]*$":""
Group=Image
UpdateDivider=-1
DynamicVariables=1
;This measure calls a powershell script that gets the filepaths of all files inside [MeasureStringCoverFolder] and [MeasureStringCoverFolderParent]
;and writes them into the output file #@#\TempFileList.txt.
[MeasureRunFolderContent]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell.exe
Parameter=-NoProfile -ExecutionPolicy Bypass -Command "& '#@#\FolderContent.ps1' '[MeasureStringCoverFolder]' '[MeasureStringCoverFolderParent]' '#@#\TempFileList.txt'"
State=Hide
FinishAction=[!UpdateMeasure MeasureLuaFindMusicFile]
DynamicVariables=1
;This lua script will determine if the image from [MeasureStringImagePath] is possibly
;an album cover. It will then find the album folder with all music files that belongs to the
;cover. It will return false if no album folder can be found or it returns the path to a music
;file from the album folder. This music file can then be used to extract more metadata about
;the album.
[MeasureLuaFindMusicFile]
Measure=Script
ScriptFile=#@#FindMusicFile.lua
TableName=NoPath
UpdateDivider=-1
;DynamicVariables=1
[MeasureStringFindMusicFile]
Measure=String
String=[MeasureLuaFindMusicFile]
DynamicVariables=1
###Meters###
[MeterImage]
Meter=Image
MeasureName=MeasureRandomCover
X=10
Y=10
H=100
W=100
AntiAlias=1
[MeterImagePath]
Meter=STRING
MeasureName=MeasureLuaGetImagePath
MeterStyle=StringStyle
ClipString=2
Text=Found Cover Path: %1
X=120
Y=10
W=200
[MeterFoundFile]
Meter=STRING
MeasureName=MeasureStringFindMusicFile
MeterStyle=StringStyle
ClipString=2
Text=Found Music File: %1
X=120
Y=70
W=200
H=300
Code: Select all
$inputFolderOne = $args[0]
$inputFolderTwo = $args[1]
$outputPath = $args[2]
try
{
$stream = [System.IO.StreamWriter]::new( $outputPath )
Get-ChildItem -LiteralPath "$inputFolderOne","$inputFolderTwo" | ForEach-Object { $stream.WriteLine($_.FullName) }
}
finally
{
$stream.close()
#See which values the PowerShell script used:
#start cmd "/c echo $inputFolderOne && timeout 5"
}