All pastes #27385 Raw Edit

Stuff

public text v1 · immutable
#27385 ·published 2005-11-02 08:54 UTC
rendered paste body
// -- if album is set,
$if(%album%,

// processing 'album' as "album artist - album name" format
// --   if album contains " - " substring, (setting _pos to index to the substring)
$ifgreater($put(_pos,$strstr(%album%,' - ')),0,
// --     set album var to album[_pos+3:]
$puts(album,$substr(%album%,$add($get(_pos),3),9999))
// --     set albumartist var to album[:_pos]
$puts(albumartist,$left(%album%,$sub($get(_pos),1))),
// --   else, set album var to album
$puts(album,%album%))

// processing 'album artist'
// --   if album artist is set,
$if(%album artist%,
// --     and if album artist is not same to (already defined) albumartist var,
$if($strcmp(%album artist%,$get(albumartist)),,
// --       restore album var to original album,
// --       and set albumartist var to album artist tag.
$puts(album,%album%)$puts(albumartist,%album artist%)))

// processing 'album'
// --   append (if set) disc # to album var.
$puts(album,$get(album)[ / CD$num(%disc%,1)])

// -- (end if)
)

// processing raw path
// -- set rawpath var to...
$puts(rawpath,
// --   if raw path(URL including scheme) starts with "http://", the raw path,
$if($stricmp($left(%_path_raw%,7),'http://'),%_path_raw%,
// --   else file name without extension.
%_filename%))

// processing 'artist' and 'title'
// -- if artist tag is set, set artist var to the tag.
$if(%artist%,$puts(artist,%artist%))
// -- if title tag is set, set title var to the tag, else set it to raw path var.
$puts(title,$if2(%title%,$get(rawpath)))
// -- if 1st artist is same to albumartist var,
$if($strcmp($get(albumartist),$meta(artist,1)),
// --   if there is two or more artists,
$ifgreater($meta_num(artist),1,
// --     set artist var (empty),
$puts(artists,)
// --     and reset artist var to 2nd, 3rd, ..., last artists.
$puts(artist,$substr($meta_sep(artist,', '),$len($meta(artist,1)___),9999)),
// --   else remove artist var.
$puts(artist,))
// -- (end if)
)

///////////////////////////////////////////////////////////

// printing column 1 (#, album, track, title, artist)
// -- padding playlist # to invisible 0s
$char(3)603000|B09880$char(3)$repeat(0,$sub($len(%_playlist_total%),$len(%_playlist_number%)))
// -- and print playlist #
$char(3)B09880|584C40$char(3)%_playlist_number%.$char(3)$char(3)' '
// -- if set, print album var with (if set) albumartist var.
[$char(3)D8CCC0|2C2620$char(3)'['[$get(albumartist) - ]$get(album)']'
// -- if set, print track #. (like printf("%02d", tracknumber);)
[ $char(3)B09880|584C40$char(3)'['$num(%tracknumber%,2)']']$char(3)$char(3) ]
// -- if artists var is set, (that means 1st artist is omitted from artist var, and needs other processing.)
// --   print artist var if set.
$if($get(artists),,$iflonger($get(artist),0,$get(artist) - ,))
// -- if set, print title var.
[$get(title)]
// -- if artists var is set, print artist var (artists without 1st artist)
$if($get(artists),$char(3)D8CCC0|2C2620$char(3)' ('$get(artist)')')

// printing column 2 (playing, codec/bitrate, length)
// -- indicates next column
$char(9)
// -- if this song is playing, print filled arrow like this: |>
$char(3)D8CCC0|2C2620$char(3)$if(%_isplaying%,'▶ ')
// -- print codec info and bitrate(if set)
$char(3)886440|847260$char(3)$codec()[ %__bitrate%k]' | '
// -- padding song length to invisible 0s or ?s(if length is not available)
$char(3)603000|B09880$char(3)$if2($repeat(0,$sub(5,$len(%_length%))),?)
// -- print song length if set, otherwise print ?:??
$char(3)B09880|584C40$char(3)$if2(%_length%,?:??)