|
FooBar2000 Title Formatting[FooBar2000标题格式使用详解](18) 字体为 Lucida Console
0000FF $num(%_playlist_number,4)
┤' '
$ifgreater(4,%tracknumber%, $select(%tracknumber%, // 1 歌手 ┌ $padcut(%artist%,40,─) , // 2 专辑 ├ $padcut(%album%,40,─) , // 3 发行时间 流派 └ ['['%date%']' ]$if2(%genre%,other) $repeat( ,$sub(40,$len2(['['%date%']' ]$if2(%genre%,other)))) ,) // > 3 , ' '$repeat( ,40) )
0000FF $ifgreater(3,%tracknumber%, $select(%tracknumber%, // 1 ┤, // 2 专辑 ┤,) // > 2 ,│) $tracknumber(2) │ %title%
$tab() 0000FF %_length%
我们看到在有的 title formatting 中歌曲名的括号的颜色和其他部分不同,这是怎么设置的呢?下
面我就说说这个问题
一般情况下歌曲名中括号的位置都是在最后,我就说说这种情况
这里用到的语句主要是: $strchr 和 $substr
//首先我们要确定 歌曲 中括号的位置 //括号主要包括 () 【】 [] () // $strchr 语句一般形式为 $strchr(x,y),x 为字符串,y 为字符 //他的作用是找出字符 y 在 x 中的位置,返回 数字 $puts(position, $max($strchr(%title%,'('),$strchr(%title%,'['),$strchr(%title%,'('),$strchr(%title%,'【')) )
//接下来就是要把前后两部分分开 // $substr 语句一般形式为 $substr(a,b,c),a 为字符串,b c 为数字 //作用是在字串 a 截取子串,从第b个字符开始到第c个字符 $puts(title_left,$substr(%title%,1,$sub($get(position),1))) $puts(title_right,$substr(%title%,$get(position),$len2(%title%)))
//此时有一个问题如果歌曲名中没有括号那么 title_right 就是 歌曲名 $if($strcmp(0,$get(position)), 0000FF %title%, 0000FF $get(title_left) 00FF80 $get(title_right))
//当然我们还有更简单也更好的方法 //使用 $replace 语句 //一般形式: $replace(a,b1,c1,b2,c2,b3,c3....) //功能: 逐一把 字符串 a 中的 bn 替换为 cn. $replace(%_title%, '(',41A5BE'(', ')',')', '[',41A5BE'[', ']',']', '【',41A5BE'【',
|