yes with vbr files the // PerSecond code will be executed multiple times a second (to update the bitrate and what not). can't think of a way around it to work with your code at the moment
edit: you could set another pvar at 29 seconds, and reset it at 0, and have the count only update if that pvar is reset. a bit hacky, but should work.
LOL. It's definitely a hack, but it works now. Funny thing is, I don't use this at all. I wrote it for someone in the trackinfo_mod thread that was asking about cycling album art.
// Global
// Background
// PerTrack
// PerSecond
// if art.num does not exist, set it to 1; if hack does not exist, set it to 0
$if($getpvar(art.num),,$setpvar(art.num,1))
$if($getpvar(hack),,$setpvar(hack,0))
// when a new song starts, reset art.num and hack
$ifequal(%playback_time_seconds%,0,
$setpvar(art.num,1)
$setpvar(hack,0)
,)
// set hack to 1, 1 second before increase art.num
$ifequal($mod($sub(%playback_time_seconds%,1),30),28,
$setpvar(hack,1)
,)
// add 1 to art.num every 30 seconds if hack=1, then reset hack to 0
// this is to avoid multiple updates/cycles while playing VBR files
$ifequal($getpvar(hack),1,
$ifequal($mod($sub(%playback_time_seconds%,1),30),29,
$setpvar(art.num,$add($getpvar(art.num),1))
$setpvar(hack,0)
,)
,)
// if track is playing, cycle art
$if(%isplaying%,
$if($fileexists($replace(%path%,%filename_ext%,'cover'$getpvar(art.num)'.jpg')),
$imageabs2(100,100,,,,,10,10,$replace(%path%,%filename_ext%,'cover'$getpvar(art.num)'.jpg'),nokeepaspect)
,
// if cover(art.num).jpg does not exist, assume restart the cycle and reset art.num to 1
$setpvar(art.num,1)
// imageabs2 tag immediately after reset art.num to avoid 1 second gap with no art displayed
$imageabs2(100,100,,,,,10,10,$replace(%path%,%filename_ext%,'cover'$getpvar(art.num)'.jpg'),nokeepaspect)
)
,
// if track is not playing, display a default image, or cover1.jpg, etc.
$imageabs2(100,100,,,,,10,10,'/images\default.jpg',nokeepaspect)
)
// monitor value of art.num for debug
$align(left,bottom)$font(Calibri,10,,255-255-255)' '$getpvar(art.num)