HydrogenAudio

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: ozstrike on 2007-04-29 19:33:27

Title: Trackinfo mod code
Post by: ozstrike on 2007-04-29 19:33:27
Can anybody see anything wrong with this code? It's meant to display "Not Playing" (in the style of my separators) when playing is stopped, but instead, it displays 2 lines of the trackinfo stuff.

Code: [Select]
// Global
// !!!!BEGIN USER CONFIGURATION!!!!

// Show Artist? (1 = show, 0 = don't show)
$puts(arts,1)

// Show Album?
$puts(albs,1)

// Show Title?
$puts(tils,1)

// Info Heading Color e.g. "Title:"
$puts(head,$rgb(19,66,94))

// Info Color e.g. "Black Dog"
$puts(info,$rgb(135,135,135))

// Info Annotation Color (e.g. kbps is the annotation)
$puts(anno,$rgb(135,135,135))

// Separator
// the separators (Song,Play,Tech info) will change to a different color if the panel mode is set to Follow cursor.
// change "followcursorcol" to change this color. It is currently set to flash orange.
$puts(followcursorcol,$rgb(200,150,50))
$puts(text2,$rgb(100,105,110))
$puts(text1,$if(%_trackinfo_nowplaying%,$rgb(19,66,94))$if(%_trackinfo_followcursor%,$get(followcursorcol)))
$puts(fadeend,$rgb(245,245,240))
$puts(seplen,70)
$puts(sepchar,'.')

// NOT PLAYING
$puts(notplaying,$transition($repeat($get(sepchar),$get(seplen)),$get(fadeend),$get(text1))$get(text1)'[' $get(text2)Not Playing $get(text1)']'$char(10))

// !!!!END USER CONFIGURATION!!!!

// Day Conversion
$puts(day,$substr(%last_played%,9,10))
$if(%last_played%,
$if($strcmp($left($get(day),1),0),$puts(day,$right($get(day),1))))
$if($strcmp($get(day),11),$puts(xx,th),
$if($strcmp($get(day),12),$puts(xx,th),
$if($strcmp($get(day),13),$puts(xx,th),
$if($strcmp($right($get(day),1),1),$puts(xx,st),
$if($strcmp($right($get(day),1),2),$puts(xx,nd),
$if($strcmp($right($get(day),1),3),$puts(xx,rd),
$puts(xx,th)))))))

// Month Conversion
$puts(month,$substr(%last_played%,6,7))
$puts(month_name,$select($get(month),
Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec))

// Year Conversion
$puts(year,$substr(%last_played%,1,4))

// Time Conversion
$puts(hour,$substr(%last_played%,12,13))
$puts(min,$substr(%last_played%,14,16))
$puts(sec,$substr(%last_played%,17,19))

// 24 Hour to 12 Hour Conversion
$if($strcmp($left($get(hour),1),0),$puts(hour1,$right($get(hour),1)))
$if($strcmp($left($get(hour),1),1),$puts(hour1,$sub($get(hour),12)))
$if($strcmp($left($get(hour),1),2),$puts(hour1,$sub($get(hour),12)))
$if($strcmp($get(hour),00),$puts(hour1,12))
$if($strcmp($get(hour),10),$puts(hour1,10))
$if($strcmp($get(hour),11),$puts(hour1,11))
$if($strcmp($get(hour),12),$puts(hour1,12))

// AM/PM Conversion
$if($strcmp($get(hour),00),$puts(yy,am))
$if($strcmp($get(hour),10),$puts(yy,am))
$if($strcmp($get(hour),11),$puts(yy,am))
$if($strcmp($get(hour),12),$puts(yy,pm))
$if($strcmp($get(hour),24),$puts(yy,am))
$if($strcmp($left($get(hour),1),0),$puts(yy,am))
$if($strcmp($left($get(hour),1),1),$puts(yy,pm))
$if($strcmp($left($get(hour),1),2),$puts(yy,pm))

// Date Format
$puts(time_of_year,$get(month_name) $get(day)$get(xx)',' $get(year))

// Time Format
$puts(time_of_day,$get(hour1)$get(min)$get(sec) $get(yy))

// PerSecond
$if(%isplaying%,
// SONG INFO SEPARATOR
$transition($repeat($get(sepchar),$get(seplen)),$get(fadeend),$get(text1))$get(text1)'[' $get(text2)S o n g  I n f o $get(text1)']'$char(10)
$if(%title%,$get(head)Title: $get(info)%title%$char(10),)
$if(%artist%,$get(head)Artist: $get(info)%artist%$char(10),)
$if(%album%,$get(head)Album: $get(info)%album%$char(10),)
$if(%date%,$get(head)Year: $get(info)%date%$char(10),)
$if(%tracknumber%,$get(head)Track #: $get(info)%tracknumber%$char(10),)
$if(%genre%,$get(head)Genre: $get(info)%genre%$char(10),)

// TECH INFO SEPARATOR
$transition($repeat($get(sepchar),$get(seplen)),$get(fadeend),$get(text1))$get(text1)'[' $get(text2)T e c h  I n f o $get(text1)']'$char(10)
$get(head)Length: $get(info)$if(%_isplaying%,%_time_elapsed%$get(anno)$if(%_length%, / %_length%,)$if(%_length%, / -%_time_remaining%),%_length%)$char(10)
$get(head)Codec: $get(info)%codec%[ '('%__extrainfo%')'][ %codec_profile%] @ %bitrate%kbps )$char(10)
$get(head)Compression: $get(info)$div(1411,%__bitrate%).$substr($muldiv(1411,100,%__bitrate%),2,3):1 '('$get(info)$muldiv(%__bitrate%,100,1411)$get(anno)'%)'$char(10)
$get(head)Channels: $get(info)$if($stricmp($codec(),MP3),$get(space2)$caps(%__mp3_stereo_mode%),
$if(%__channels%,$ifgreater(%__channels%,1,Stereo,Mono),'?'))$char(10)
$if(%__bitspersample%,$get(head)Bitdepth: $get(info)%__bitspersample% bits/sample$char(10),)
$if(%__samplerate%,$get(head)Samplerate: $get(info)$div(%__samplerate%,1000).$substr(%__samplerate%,3,3) KHz $char(10))
$if(%_filesize%,$get(head)Filesize: $get(info)
$div(%_filesize%,1048576).$left($num($muldiv($mod(%_filesize%,1048576),100,1048576),2),2) $get(anno)'MB'$char(10),)

$if(%last_played%,
// PLAY STATS SEPARATOR
$transition($repeat($get(sepchar),$get(seplen)),$get(fadeend),$get(text1))$get(text1)'[' $get(text2)P l a y  I n f o $get(text1)']'
$char(10),)

$if(%play_counter%,$get(head)Played $get(info)%play_counter% times$char(10),)
$if(%last_played%,$get(head)Last played on $get(info)$get(time_of_year) at $get(time_of_day)$char(10),)

// PerTrack
// rating images
$ifequal(%rating%,1,
$button($sub(%_width%,82),290,0,0,12,12,/images\brumal-treeline\star-on.png,,TAG:SET:Rating:,),
$button($sub(%_width%,82),290,0,0,12,12,
$ifgreater(%rating%,0,/images\brumal-treeline\star-on.png,/images\brumal-treeline\star-off.png)
,,TAG:SET:Rating:1,)
)
$ifequal(%rating%,2,
$button($sub(%_width%,70),290,0,0,12,12,/images\brumal-treeline\star-on.png,,TAG:SET:Rating,),
$button($sub(%_width%,70),290,0,0,12,12,
$ifgreater(%rating%,1,/images\brumal-treeline\star-on.png,/images\brumal-treeline\star-off.png)
,,TAG:SET:Rating:2,)
)
$ifequal(%rating%,3,
$button($sub(%_width%,58),290,0,0,12,12,/images\brumal-treeline\star-on.png,,TAG:SET:Rating,),
$button($sub(%_width%,58),290,0,0,12,12,
$ifgreater(%rating%,2,/images\brumal-treeline\star-on.png,/images\brumal-treeline\star-off.png)
,,TAG:SET:Rating:3,)
)
$ifequal(%rating%,4,
$button($sub(%_width%,46),290,0,0,12,12,/images\brumal-treeline\star-on.png,,TAG:SET:Rating,),
$button($sub(%_width%,46),290,0,0,12,12,
$ifgreater(%rating%,3,/images\brumal-treeline\star-on.png,/images\brumal-treeline\star-off.png)
,,TAG:SET:Rating:4,)
)
$ifequal(%rating%,5,
$button($sub(%_width%,34),290,0,0,12,12,/images\brumal-treeline\star-on.png,,TAG:SET:Rating,),
$button($sub(%_width%,34),290,0,0,12,12,
$ifgreater(%rating%,4,/images\brumal-treeline\star-on.png,/images\brumal-treeline\star-off.png)
,,TAG:SET:Rating:5,)
)
,
$get(notplaying)
)


It displays the Compression and Channel lines, but because there is nothing playing, there are no values. I figure the arror in the code must be something around that area (compression/channels) but I can't find anything. I bet I've missed out a ) or a , but I don't see anything.

Thanks guys.
Title: Trackinfo mod code
Post by: Purple Monkey on 2007-04-29 20:52:19
'// PerSecond' and '// PerTrack' cannot be used inside of any functions ($if in this case). I don't know if that is the problem you see, but it is a problem.
Title: Trackinfo mod code
Post by: ozstrike on 2007-04-29 21:04:22
It doesn't seem to be creating a problem, it makes everything worse if I delete them from the code.
Title: Trackinfo mod code
Post by: shakey_snake on 2007-04-29 21:34:51
It doesn't seem to be creating a problem, it makes everything worse if I delete them from the code.

And it would make everything better if you make sure that the separate sections are not inside any logical arguments.
The logic doesn't transfer.