Help - Search - Members - Calendar
Full Version: foo_uie_single_column_playlist
Hydrogenaudio Forums > Hosted Forums > foobar2000 > 3rd Party Plugins - (fb2k)
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28
Superunknown
QUOTE(terrestrial @ Sep 4 2006, 04:18) *


QUOTE(vonmeth @ Sep 2 2006, 16:06) *

terrestrial is it possible to make it so that it can handle more formats, pretty much the ones that the current albumart panel is capable of useing?


yes, eventually.
would be great ! smile.gif
Superunknown
I have in each album folder a folder.png (or. jpg actually) file with the cover, so I'd like to get it with the same command used with album art :

CODE
$left(%path%,$sub($len(%path%),$len(%filename_ext%)))folder.png


So using the model given above, I've made that line :

CODE
$imageabs(6,$add(25,$mul(-14,%tracknumber%)),$left(%path%,$sub($len(%path%),$len(%filename_ext%)))folder.png,)


But it doesn-t work sad.gif
Anyone have a solution ?
FofR
Your image path needs to relative to the foobar directory, I suggest reading the trackinfo panel mod wiki page for details about using images.
Superunknown
ohhh, it's pretty sad. I don't think it's logical to put the covers in the foobar folder, they're better with the rest of the albums... :-(
zackorah
IPB Image
I'm happy with this for a while until the plugin gets major updates I guess tongue.gif

to the guy who asked for my code;

CODE

==========
ITEM
-==========







$if(%tracknumber%,$drawrect(0,0,0,0,brushcolor-255-255-255 pencolor-null),)
$if(%cwb_queueindex%,$drawrect(0,0,0,0,brushcolor-58-110-165 pencolor-null),)
$if(%isplaying%,$drawrect(0,0,0,0,brushcolor-62-128-223 pencolor-null),)
$if(%_selected%,$drawrect(0,0,0,0,brushcolor-62-128-223 pencolor-null),)

$puts(art.width,119)
$puts(art.height,21)
$puts(art.num,$add($div($mul(%list_index%,%_height%),$get(art.height)),1))
$puts(art.offset,-$sub($sub($mul(%list_index%,%_height%),$mul($sub($get(art.num),1),$get(art.height))),%_height%))
$imageabs(0,$get(art.offset),images\column.left.png,)
$imageabs(6,$add(25,$mul(-14,%tracknumber%)),images/%album%.png,)
$imageabs(3,$add(22,$mul(-14,%tracknumber%)),images/overlay.png,)

$alignabs(5,,%_width%,%_height%,,)
$if($stricmp($num(%tracknumber%,2),09),$font(tahoma,8,bold,)$abbr(%artist%,12) - %date%,)
$if($stricmp($num(%tracknumber%,2),10),$font(tahoma,8,bold,62-128-223)$abbr(%album%,16),)
$if($stricmp($num(%tracknumber%,2),11),$font(tahoma,8,bold,)Total Tracks: $font(tahoma,8,,)%totaltracks%,)
$if($stricmp($num(%tracknumber%,2),12),$font(tahoma,8,bold,)Genre: $font(tahoma,8,,)%genre%,)
$font(tahoma,8,,)


$alignabs(125,,%_width%,%_height%,,)
$if(%tracknumber%,
$if(%isplaying%,$font(,,,233-233-233)$imageabs(122,0,images\playing.png,),$font(,,,10-36-106))
%tracknumber%$font(,,,233-233-233).
$if(%isplaying%,$font(,,,233-233-233),$font(,,,0-0-0))


$align(right,middle)
$if(%title%,$trim($left(%title%,$sub($strrchr(%title%,$char(40)),1))),) %length%

$if($strrchr(%title%,$char(40)),
$font(,,,233-233-233) $char(40)
$if(%isplaying%,$font(,,,233-233-233),$font(,,,10-36-106))
$substr(%title%,$add($strrchr(%title%,$char(40)),1),$sub($strrchr(%title%,$char(41)),1))
$font(,,,233-233-233)$char(41)
$if(%isplaying%,$font(,,,233-233-233),$font(,,,0-0-0))
)
,
$if(%isplaying%,$font(,,,233-233-233),$font(,,,0-0-0))
[%artist% - ]%title%
)


$if(%cwb_queueindex%,
$alignabs($sub(%_width%,$calcwidth(%cwb_queueindexes%),150),,%_width%,%_height%,,)
$font(,,,233-233-233)Q
$if(%isplaying%,$font(,,,233-233-233),$font(,,,140-186-236)):
$font(,,,233-233-233)$char(91)$if(%isplaying%,$font(,,,233-233-233),$font(,,,140-186-236))%cwb_queueindexes%$char(47)%cwb_queuelength%$font(,,,233-233-233)$char(93)
$if(%isplaying%,$font(,,,233-233-233),$font(,,,0-0-0))
,)


$align(right,)

---------------


GROUP

-----------------

$if(%tracknumber%,
$drawrect(0,0,0,0,brushcolor-62-128-223 pencolor-null)$padding(4,0)
$imageabs(0,0,images\title.png,)
$font(tahoma,7,,233-233-233)
$align(left,middle)$if(%CDID%,$char(91)$font(,,,140-186-236)%CDID%$font(,,,233-233-233)$char(93),)
$padding(120,0)
$align(left,middle)

$if(%album artist%,
$if($strrchr(%album artist%,$char(12300)),
$font(,,,140-186-236)$char(12300)$font(,,,233-233-233)$substr(%album artist%,2,$sub($len(%album artist%),1))$font(,,,140-186-236)$char(12301)
,%album artist%)
,)

$if($and(%album artist%,%album%),$font(,,,140-186-236) - $font(,,,233-233-233),)
$trim($left(%album%,$sub($strrchr(%album%,$char(40)),1)))

,
$drawrect(0,0,0,0,brushcolor-130-130-255 pencolor-null)$padding(4,0)
$align(center,)$font(tahoma,7,italic,0-0-0)~ Singles ~
)

$imageabs(0,0,images\column.left.png,)




With updates every xx seconds, more image types, and ability to include images from other drives then this plugin would be complete, Imo!

EDIT: Took out two comments that shouldn't have been in the code

EDIT2: oh and draggable sorting ohmy.gif

Moderation: Converted [ code ] to [ codebox ] to preserve forum layout.
legzalito
That is really amazing!

It seems rather limitating though.. But, when the improvements you speak about will be here, it will be just great!
cartman(2vd)
QUOTE(zackorah @ Sep 4 2006, 20:15) *

IPB Image
I'm happy with this for a while until the plugin gets major updates I guess tongue.gif

...


your layout si quite awsome can you share these images also?

CODE

$imageabs(0,$get(art.offset),images\column.left.png,)
$imageabs(3,$add(22,$mul(-14,%tracknumber%)),images/overlay.png,)
$imageabs(0,0,images\title.png,)


and your lineheight and group by parameters?

... when i come home from work i would like to try to use your layout and im looking really forward to it smile.gif thanks for you work
zackorah
http://zack.leafo.net/foobar

Everything for my new layout is on there; I deleted the images (overwritten) for my older one, sorry :s
BlindSeer
QUOTE(acedriver @ Sep 3 2006, 15:06) *

QUOTE(BlindSeer @ Sep 4 2006, 06:00) *

Nice component. It would be very useful to have a setting wherein tracks that are not part of a group would not be given a header. Thanks.

I use $if(%singletrack%,,%album%%disc%) for Group by and tagged the files with "SINGLETRACK=1"

When I try this, it produces a header for every single track preceded by non-single tracks. I would prefer no header at all.
Fitret
QUOTE(zackorah @ Sep 5 2006, 12:16) *

http://zack.leafo.net/foobar

Everything for my new layout is on there; I deleted the images (overwritten) for my older one, sorry :s


I'm trying to use this and I'm having one slight issue. You appear to be pulling album art from your App Data folder, but I have all of my album art stored in the folder that the songs are stored in (and it's also stored in the tags, I think). Anyways, I tried changing the one line to:

$imageabs(6,$add(25,$mul(-14,%tracknumber%)),$replace(%path%,%filename_ext%,'folder.jpg'),)

but it's not loading the image. I also tried folder.png, no luck. I printed out the result of the $replace() statement, and the path is correct. Any ideas as to why this wouldn't be working?
zackorah
QUOTE(Fitret @ Sep 5 2006, 15:32) *

QUOTE(zackorah @ Sep 5 2006, 12:16) *

http://zack.leafo.net/foobar

Everything for my new layout is on there; I deleted the images (overwritten) for my older one, sorry :s


I'm trying to use this and I'm having one slight issue. You appear to be pulling album art from your App Data folder, but I have all of my album art stored in the folder that the songs are stored in (and it's also stored in the tags, I think). Anyways, I tried changing the one line to:

$imageabs(6,$add(25,$mul(-14,%tracknumber%)),$replace(%path%,%filename_ext%,'folder.jpg'),)

but it's not loading the image. I also tried folder.png, no luck. I printed out the result of the $replace() statement, and the path is correct. Any ideas as to why this wouldn't be working?


it HAS to be png, files can't come from another drive other than foobar too, and try..

$imageabs(6,$add(25,$mul(-14,%tracknumber%)),$replace(../../%path%,%filename_ext%,'folder.png'),)

Read back a few in the topic, someone did something like this.
Fitret
QUOTE(zackorah @ Sep 5 2006, 17:41) *

QUOTE(Fitret @ Sep 5 2006, 15:32) *

QUOTE(zackorah @ Sep 5 2006, 12:16) *

http://zack.leafo.net/foobar

Everything for my new layout is on there; I deleted the images (overwritten) for my older one, sorry :s


I'm trying to use this and I'm having one slight issue. You appear to be pulling album art from your App Data folder, but I have all of my album art stored in the folder that the songs are stored in (and it's also stored in the tags, I think). Anyways, I tried changing the one line to:

$imageabs(6,$add(25,$mul(-14,%tracknumber%)),$replace(%path%,%filename_ext%,'folder.jpg'),)

but it's not loading the image. I also tried folder.png, no luck. I printed out the result of the $replace() statement, and the path is correct. Any ideas as to why this wouldn't be working?


it HAS to be png, files can't come from another drive other than foobar too, and try..

$imageabs(6,$add(25,$mul(-14,%tracknumber%)),$replace(../../%path%,%filename_ext%,'folder.png'),)

Read back a few in the topic, someone did something like this.


I knew the png thing, which is why I tried it out, but I didn't know about the hard drive thing. My foobar is on a different drive than my MP3s, and I plan on keeping it that way. I'm assuming that (hopefully soon) the plugin will be updated to load art from other hard drives?
zackorah
QUOTE(Fitret @ Sep 5 2006, 15:51) *


I knew the png thing, which is why I tried it out, but I didn't know about the hard drive thing. My foobar is on a different drive than my MP3s, and I plan on keeping it that way. I'm assuming that (hopefully soon) the plugin will be updated to load art from other hard drives?


Yeah, that is how it is for me, seperate 200gb hard drive for music. Thus the reason I just batch converted my art to png, and batch resized to 100x100 and renamed to album and put into the app dir sleep.gif.

EDIT: infact, terrerstrial do you plan to release the source code?
vonmeth
Edit: Someone already answered the question I was going to answer. wink.gif
Fitret
QUOTE(zackorah @ Sep 5 2006, 19:40) *

QUOTE(Fitret @ Sep 5 2006, 15:51) *


I knew the png thing, which is why I tried it out, but I didn't know about the hard drive thing. My foobar is on a different drive than my MP3s, and I plan on keeping it that way. I'm assuming that (hopefully soon) the plugin will be updated to load art from other hard drives?


Yeah, that is how it is for me, seperate 200gb hard drive for music. Thus the reason I just batch converted my art to png, and batch resized to 100x100 and renamed to album and put into the app dir sleep.gif.

EDIT: infact, terrerstrial do you plan to release the source code?


I also have a seperate 200gb drive for music. Maybe I should do this... did you do it in photoshop? I know how to resize and change to png in batch mode, but not how to rename the file based on the directory structure. (All of my music is Artist\Album\music.mp3)
tool++
QUOTE(zackorah @ Sep 6 2006, 00:40) *

QUOTE(Fitret @ Sep 5 2006, 15:51) *


I knew the png thing, which is why I tried it out, but I didn't know about the hard drive thing. My foobar is on a different drive than my MP3s, and I plan on keeping it that way. I'm assuming that (hopefully soon) the plugin will be updated to load art from other hard drives?


Yeah, that is how it is for me, seperate 200gb hard drive for music. Thus the reason I just batch converted my art to png, and batch resized to 100x100 and renamed to album and put into the app dir sleep.gif.

EDIT: infact, terrerstrial do you plan to release the source code?



How would I do this?

All my art is in F:\music\Artist\[Year]Album\folder.png/jpg

Whereas foobar is in D:\fb2k sad.gif
lextune
First off, amazing work man. smile.gif

Second. Is it possible to select multiple tracks for tagging and/or converting purposes?
acedriver
QUOTE(lextune @ Sep 6 2006, 20:23) *

First off, amazing work man. smile.gif

Second. Is it possible to select multiple tracks for tagging and/or converting purposes?

yes, you can.
lextune
Can someone enlighten me? smile.gif
FofR
ctrl+click the items?
acedriver
ctrl+click and shift+click
lextune
Hmmm....yeah, thanks, but how about with just the mouse, (like the regular Columns UI) I don't want to have to ctrl+click 20 times if I can avoid it.
tool++
Shift Click start, then shift click end of where you want to select.


Will select all between those points.
lextune
EDIT: Shift+click at least narrows it down to 2 clicks. tongue.gif

Thanks again. smile.gif


2ND EDIT: Thanks tool, just realized that. wacko.gif

tongue.gif biggrin.gif
Blitzmeister
Hoping someone can help me out here. What part do i change to get a black selection bar instead of white?
CODE
$if($strcmp($mod(%_playlist_number%,2),1),
$drawrect(,,,,brushcolor-45-45-45 pencolor-null))

$padding(2,0)
$font(Calibri MOD2,8,,$if(%isplaying%,85-217-255,170-170-170))
[ %tracknumber% ]$replace(%title%,'(',$font(,,bold italic,204-204-204)'(')


Cheers smile.gif
vonmeth
QUOTE(Fitret @ Sep 5 2006, 18:30) *

QUOTE(zackorah @ Sep 5 2006, 19:40) *

QUOTE(Fitret @ Sep 5 2006, 15:51) *


I knew the png thing, which is why I tried it out, but I didn't know about the hard drive thing. My foobar is on a different drive than my MP3s, and I plan on keeping it that way. I'm assuming that (hopefully soon) the plugin will be updated to load art from other hard drives?


Yeah, that is how it is for me, seperate 200gb hard drive for music. Thus the reason I just batch converted my art to png, and batch resized to 100x100 and renamed to album and put into the app dir sleep.gif.

EDIT: infact, terrerstrial do you plan to release the source code?


I also have a seperate 200gb drive for music. Maybe I should do this... did you do it in photoshop? I know how to resize and change to png in batch mode, but not how to rename the file based on the directory structure. (All of my music is Artist\Album\music.mp3)


You will have to get a new program for batch renameing. Simply type in "batch rename" into any search engine and you will come up with many results. Just look at the faqs/info on the programs to see if they support that sort of renameing process. I think the first result from google actually did, but not sure.

I'm just going to wait till I can change the drive. unsure.gif
Imperecedero
amazing plug in, really amazing, anyway i can't get any image shown. I'm completely sure that the path is correct "C:\Archivos de Programa\Foobar2000\images" i have a spanish winXP, could be this the problem?????

In my other pc, i can't even get the dll load, i'm missing something like the png lib or .net framework???
acedriver
QUOTE(Blitzmeister @ Sep 6 2006, 23:13) *

Hoping someone can help me out here. What part do i change to get a black selection bar instead of white?
CODE
$if($strcmp($mod(%_playlist_number%,2),1),
$drawrect(,,,,brushcolor-45-45-45 pencolor-null))

$padding(2,0)
$font(Calibri MOD2,8,,$if(%isplaying%,85-217-255,170-170-170))
[ %tracknumber% ]$replace(%title%,'(',$font(,,bold italic,204-204-204)'(')


Cheers smile.gif

add this:

$if(%_selected%,$drawrect(0,0,0,0,brushcolor-0-0-0 pencolor-null),)
Yotsuya
I am trying to accomplish something but am not having much success, does anyone have any suggestions? I have a playlist full of online radio stations from shoutcast and other sources. I would like to use this component to group them by genre.

The core of the problem stems from the fact that online radio stations contain several genres in the %genre% tag and there does not appear to be any practical means to modify meta information. I attempted to parse the %genre% tag into predefined genres for grouping with the following code:

CODE
$if2(
$if($strstr($replace($lower(%genre%),', ',' '),jpop),JPop,)
$if($strstr($replace($lower(%genre%),', ',' '),jrock),JPop,)
$if($strstr($replace($lower(%genre%),', ',' '),japanese),JPop,)
$if($strstr($replace($lower(%genre%),', ',' '),anime),Anime,)
$if($strstr($replace($lower(%genre%),', ',' '),japanimation),Anime,)
$if($strstr($replace($lower(%genre%),', ',' '),trance),Trance,)
$if($strstr($replace($lower(%genre%),', ',' '),techno),Trance,)
,Other)


I placed this code in both the "Group By" section for grouping and the "Group Display" section to display the appropriate genre but everything seems to get grouped into the Other category. I have tried changing the $if2() into an $if() and duplicating the genre parsiing with no success. I tried several other approaches using cascading if statements again with no success.

Can anyone suggest an alternative approach to grouping online playlists by genre?
Nova5000
Absolutely marvelous plugin!

I, too, cannot get images to show up. The path is correct to the best of my knowledge and I have the necessary library's.

Cheers,

Nova
sHsIkuA
hi the updated version fixed the blank display problem , thanks! but why the playing song is always like updating something , blinking (but not clearly visible)

i hope its just some bug though smile.gif thanks terrestial for the awesome plugin
Yotsuya
When specifying an image with this plugin, the path must be relative to the foobar directory. For example:

If you foobar resides in:

C:\Program Files\foobar2000

and the image you would like to display is:

C:\Program Files\foobar2000\images\picture.png

You should specify the image as:

images\picture.png
Krpano
How can i change the frame selection color on the playlist ?

Actually is black.
:|
Yotsuya
Krpano you can change the color of the frame for the row that is currently selected by combining %_selected% and the pencolor parameter of the $drawrect() function. For example you can place this code in the "Item Display" box:
CODE
$if(%_selected%,$drawrect(0,0,0,0,brushcolor-null pencolor-233-233-233),)


Note that if you have any other $drawrect() functions or $imageabs() functions you will need to keep in mind the order in which they are drawn. I would suggest placing the above code after any existing $drawrect() functions.

I assume that by the "frame" you are referring to the outer edge of the current row. If you would like to fill the entire header row then use brushcolor instead of pencolor, and place the code in the "Group Display" box instead of the "Item Display" box.
Krpano
thanks you..smile.gif
Sword
thanks for the great plugin
Zurman
Amazing plugins... Could be the one that will make me switch to 0.9.x tongue.gif
peercortsa
ok am i missing something because i thought we are able to hit the configure button in the columns ui layout tab but it isnt highlighted when i add it in and click on single column playlist view so basically i cant do anything with it
Yotsuya
To configure the playlist, right click on the playlist and choose "Settings..." from the top of the popup menu. I do not know why the configuration is not available from the ColumnsUI Layout tab.. perhaps the author is planning on allowing multiple instances of the component.
peercortsa
QUOTE(Yotsuya @ Sep 7 2006, 23:02) *

To configure the playlist, right click on the playlist and choose "Settings..." from the top of the popup menu. I do not know why the configuration is not available from the ColumnsUI Layout tab.. perhaps the author is planning on allowing multiple instances of the component.

oh duh thanks the funny part is i probably would never have figured that out myself thanks again
peercortsa
is there any way to make the group display go more than one row
Yotsuya
Back in post #27 terrestrial indicated he may be changing things:

QUOTE(terrestrial @ Aug 31 2006, 01:50) *

QUOTE

EDIT: and configurable header height would be great also biggrin.gif


The listview limits the size of rows to be the same, but I think I may be able to make the headers occupy 2 (or more) rows.


However in the meantime you can increase your row height then use $align()/$alignabs() functions to make the row twice the height and then place text either on the top (first line) or bottom (second line). Just remember that all header rows and item rows will be the same height so you might want to come up with something to fill in the extra space on your items such as using a larger font or adding info about the track on the second line.
pirlouy
Request: ability to delete playlist elements (with Suppr hotkey). Ok, I know it's in the todo list, it's just a reminder.

Thanks for this nice plugin. smile.gif
sHsIkuA
er, about the blinking issue, any update ? or I am the only one who got this issue? crying.gif
Yotsuya
.. my foobar does not blink. Can you be more specific? Maybe a screencap and/or code?
sHsIkuA
sorry, i dunno how to take a animated screencap

but its the now playing item , it will like blink (something like updating) once in a while , a few seconds gone than it is back

only the playing tracks though , dont know what is happening sad.gif

and here is my code

Group by
CODE
$if(%singletrack%,,%artist%)
%album%


List
CODE
$if(%_selected%,$drawrect(0,0,0,0,brushcolor-207-210-216 pencolor-null))
$if($strcmp($mod(%_playlist_number%,2),1),
$drawrect(,,,,brushcolor-212-215-220 pencolor-null)$if(%_selected%,$drawrect(0,0,0,0,brushcolor-207-210-216 pencolor-null)))


$padding(2,1)
$font(,,bold,100-100-100)
$if(%singletrack%,%artist% | %title%,
%tracknumber%    %title%
//%play_counter%      
)
$if(%isplaying%,    Ω)

$align(right,)
$font() $rgb(100,100,115)%play_counter% times |  
$rgb(100,100,125)%length%  
$font(Mangal,8,,) $repeat($rgb(105,105,105)$char(9733),%rating%)
$repeat($rgb(137,160,160)$char(9733),$sub(5,%rating%))



Group Display
CODE
$drawrect(0,0,0,0,brushcolor-193-197-203 pencolor-null)

$padding(4,1)
$upper($font(Verdana,7,,)
$font(,,bold,85-85-85)$if(%singletrack%,Singles,
$align(left,top)$font(,,bold,85-85-85) %artist%
// '['%date%']'
$padding(1,0)
$align(right,top)$font(Century Gothic,7,bold,55-55-55)%album%

)
)


btw, i am using 0.9.3.1

updated : weird, i revert back to old version of single column ui, the blink is gone
Yotsuya
I dont see anything that would actually make it blink, however the first section of your list code is having the component draw the background many times for selected items, using alternating colors if they sit on one of every other line in your playlist. This may be causing the blinking effect under low resource conditions. Try changing it to:

CODE
// Modified code
$if($strcmp($mod(%_playlist_number%,2),1),$drawrect(,,,,brushcolor-212-215-220 pencolor-null))
$if(%_selected%,$drawrect(0,0,0,0,brushcolor-207-210-216 pencolor-null))


// Existing code
$padding(2,1)
$font(,,bold,100-100-100)
$if(%singletrack%,%artist% | %title%,
%tracknumber% %title%
//%play_counter%
)
$if(%isplaying%, Ω)

$align(right,)
$font() $rgb(100,100,115)%play_counter% times |
$rgb(100,100,125)%length%
$font(Mangal,8,,) $repeat($rgb(105,105,105)$char(9733),%rating%)
$repeat($rgb(137,160,160)$char(9733),$sub(5,%rating%))


If that doesnt fix it you can probably put the first $if() as the fail condition of the second $if().
sHsIkuA
QUOTE(Yotsuya @ Sep 8 2006, 20:55) *

I dont see anything that would actually make it blink, however the first section of your list code is having the component draw the background many times for selected items, using alternating colors if they sit on one of every other line in your playlist. This may be causing the blinking effect under low resource conditions. Try changing it to:

CODE
// Modified code
$if($strcmp($mod(%_playlist_number%,2),1),$drawrect(,,,,brushcolor-212-215-220 pencolor-null))
$if(%_selected%,$drawrect(0,0,0,0,brushcolor-207-210-216 pencolor-null))


// Existing code
$padding(2,1)
$font(,,bold,100-100-100)
$if(%singletrack%,%artist% | %title%,
%tracknumber% %title%
//%play_counter%
)
$if(%isplaying%, Ω)

$align(right,)
$font() $rgb(100,100,115)%play_counter% times |
$rgb(100,100,125)%length%
$font(Mangal,8,,) $repeat($rgb(105,105,105)$char(9733),%rating%)
$repeat($rgb(137,160,160)$char(9733),$sub(5,%rating%))


If that doesnt fix it you can probably put the first $if() as the fail condition of the second $if().


thanks man, gonna try it later, need to go for exam now tongue.gif
Yotsuya
:: Sorting Online Radio Stations by Genre ::

Awhile back in this post I asked for some help getting my online radio playlist sorted by genre. I have had some limited success and would like to share the results.

As mentioned before, online radio stations from shoutcast and other sources usually contain many genres in different order in the %genre% tag so simply grouping by this tag is not a practical solution. What we need to do is parse the tag and place each station into predefined genre groups. After quite a bit of experimenting I whipped up this code to accomplish this:
CODE
$if($strstr($replace($lower(%genre%),', ',' '),goa),Goa,
$if($strstr($replace($lower(%genre%),', ',' '),trance),Trance,
$if($strstr($replace($lower(%genre%),', ',' '),techno),Trance,
$if($strstr($replace($lower(%genre%),', ',' '),anime),Anime,
$if($strstr($replace($lower(%genre%),', ',' '),japanimation),Anime,
$if($strstr($replace($lower(%genre%),', ',' '),jpop),JPop,
$if($strstr($replace($lower(%genre%),', ',' '),jrock),JPop,
$if($strstr($replace($lower(%genre%),', ',' '),japanese),JPop,
Other))))))))

On the end of each line you see on the left the word to search for in the %genre% tag (notice everything was sent to lower case because $strstr() is case sensitive) and on the right is the name of the predefined genre group. You'll need to create a line like this for every genre you want to group. Because of the nature of the cascading if statement, you'll want to place the most specific genres first. If a station would fit into more than one genre, it will be placed into the first category on the list (i.e.: "jpop anime" would be placed into the anime group). The last line is the name of the group where we lump all the stations that dont fit in one of our predefined groups and a bunch of end parenthesis to close the cascading if. If you add more lines for groups you'll need to make sure the parenthesis count increases accordingly.

The next major hurdle I came accross is that even though the above code will group consecutive playlist entries, it will not combine identical subgroups into one large group. In order to achieve proper grouping we need to sort the playlist. Unfortunately I could find no automated way to accomplish this, however we can manually choose Edit> Sort> Sort By... from the foobar menu and enter this variation of the above code:
CODE
$if($strstr($replace($lower(%genre%),', ',' '),goa),Goa,$if($strstr($replace($lower(%genre%),', ',' '),trance),Trance,$if($strstr($replace($lower(%genre%),', ',' '),techno),Trance,$if($strstr($replace($lower(%genre%),', ',' '),anime),Anime,$if($strstr($replace($lower(%genre%),', ',' '),japanimation),Anime,$if($strstr($replace($lower(%genre%),', ',' '),jpop),JPop,$if($strstr($replace($lower(%genre%),', ',' '),jrock),JPop,$if($strstr($replace($lower(%genre%),', ',' '),japanese),JPop,$char(255)))))))))|%codec%|$num($sub(1000,%bitrate%),3)


This is essentially the first chunk of code with the linebreaks removed and a few more parameters at the end to polish off the sorting.
---
IPB ImageHere is my current playlist setup for reference:

Row Height: 24

Group By:
CODE
$if($strcmp($left(%path%,7),http$char(58)$char(47)$char(47)),
$if($strstr($replace($lower(%genre%),', ',' '),goa),Goa,
$if($strstr($replace($lower(%genre%),', ',' '),trance),Trance,
$if($strstr($replace($lower(%genre%),', ',' '),techno),Trance,
$if($strstr($replace($lower(%genre%),', ',' '),anime),Anime,
$if($strstr($replace($lower(%genre%),', ',' '),japanimation),Anime,
$if($strstr($replace($lower(%genre%),', ',' '),jpop),JPop,
$if($strstr($replace($lower(%genre%),', ',' '),jrock),JPop,
$if($strstr($replace($lower(%genre%),', ',' '),japanese),JPop,
Other))))))))
,
$if(%tracknumber%,%album%%discnumber%,)
)


Item Display:
CODE
// Backgrounds
$ifequal($mod(%list_index%,2),0,
$if(%tracknumber%,
$drawrect(0,0,0,0,brushcolor-140-186-236 pencolor-null)
,
$drawrect(0,0,0,0,brushcolor-130-164-209 pencolor-null)
)
,)

$if(%cwb_queueindex%,$drawrect(0,0,0,0,brushcolor-58-110-165 pencolor-null),)
$if(%isplaying%,$drawrect(0,0,0,0,brushcolor-10-36-106 pencolor-null),)
$if(%_selected%,$drawrect(0,0,0,0,brushcolor-null pencolor-233-233-233),)

// Side Art
$puts(art.width,35)
$puts(art.height,128)
$puts(art.num,$add($div($mul(%list_index%,%_height%),$get(art.height)),1))
$puts(art.offset,-$sub($sub($mul(%list_index%,%_height%),$mul($sub($get(art.num),1),$get(art.height))),%_height%))
$imageabs(0,$get(art.offset),images\frames\dark stone\frame.left.png,)
$imageabs($sub(%_width%,$get(art.width)),$get(art.offset),images\frames\dark stone\frame.right.png,)

// Track Number
$padding(50,)
$align(left,middle)$font(tahoma,10,,)
$if(%tracknumber%,
$if(%isplaying%,$font(,,,233-233-233),$font(,,,10-36-106))
%tracknumber%$font(,,,233-233-233).
$if(%isplaying%,$font(,,,233-233-233),$font(,,,0-0-0))

// Title
$alignabs(75,,%_width%,%_height%,,)$font(tahoma,10,,)
$if(%title%,$trim($left(%title%,$sub($strrchr(%title%,$char(40)),1))),)

$if($strrchr(%title%,$char(40)),
$font(,,,233-233-233) $char(40)
$if(%isplaying%,$font(,,,233-233-233),$font(,,,10-36-106))
$substr(%title%,$add($strrchr(%title%,$char(40)),1),$sub($strrchr(%title%,$char(41)),1))
$font(,,,233-233-233)$char(41)
$if(%isplaying%,$font(,,,233-233-233),$font(,,,0-0-0))
)
,
$if(%isplaying%,$font(,,,233-233-233),$font(,,,0-0-0))
$if($strcmp($left(%path%,7),http$char(58)$char(47)$char(47)),
$align(left,top)$left(%title%,60)
,
$alignabs(50,,%_width%,%_height%,,)$font(tahoma,10,,)
[%artist% - ]%title%
)
)

// Subtext
$alignabs($if(%tracknumber%,75,50),14,%_width%,%_height%,,)$font(tahoma,7,,$if(%isplaying%,233-233-233,10-36-106))
$if($strcmp($left(%path%,7),http$char(58)$char(47)$char(47)),
$if2(%url%,%path%)
,
$if2(%codec% ,)$if2(%bitrate%kbps,)
)

// Queue Indicator
$font(tahoma,10,,)
$if(%cwb_queueindex%,
$alignabs($sub(%_width%,$calcwidth(%cwb_queueindexes%),150),,%_width%,%_height%,,)
$font(,,,233-233-233)Q
$if(%isplaying%,$font(,,,233-233-233),$font(,,,140-186-236)):
$font(,,,233-233-233)$char(91)$if(%isplaying%,$font(,,,233-233-233),$font(,,,140-186-236))%cwb_queueindexes%$char(47)%cwb_queuelength%$font(,,,233-233-233)$char(93)
$if(%isplaying%,$font(,,,233-233-233),$font(,,,0-0-0))
,)

// Length or Codec
$if($strcmp($left(%path%,7),http$char(58)$char(47)$char(47)),
$if(%bitrate%,$align(right,top),$align(right,middle))$font(tahoma,9,,$if(%isplaying%,233-233-233,0-0-0))
[%codec%]
$align(right,bottom)$font(tahoma,7,,$if(%isplaying%,233-233-233,10-36-106))
[%bitrate%kbps]
,
$align(right,middle)
$font(tahoma,10,,$if(%isplaying%,233-233-233,0-0-0))
%length%
)


Group Display:
CODE
$if($strcmp($left(%path%,7),http$char(58)$char(47)$char(47)),
$drawrect(0,0,0,0,brushcolor-0-0-0 pencolor-null)$padding(4,0)
$font(tahoma,7,,233-233-233)
$align(left,middle)
$align(left,middle)$font(tahoma,12,bold,140-186-236)↘ $font(tahoma,12,,233-233-233)
$if($strstr($replace($lower(%genre%),', ',' '),goa),Goa,
$if($strstr($replace($lower(%genre%),', ',' '),trance),Trance,
$if($strstr($replace($lower(%genre%),', ',' '),techno),Trance,
$if($strstr($replace($lower(%genre%),', ',' '),anime),Anime,
$if($strstr($replace($lower(%genre%),', ',' '),japanimation),Anime,
$if($strstr($replace($lower(%genre%),', ',' '),jpop),JPop,
$if($strstr($replace($lower(%genre%),', ',' '),jrock),JPop,
$if($strstr($replace($lower(%genre%),', ',' '),japanese),JPop,
Other))))))))
,
$if(%tracknumber%,
$drawrect(0,0,0,0,brushcolor-0-0-0 pencolor-null)$padding(4,0)
$font(tahoma,7,,233-233-233)

// Disc Number
//$if(%discnumber%,
//$align(center,bottom)
//$font(,,,233-233-233)$char(40)$font(,,,140-186-236)Disc %discnumber%[ of %totaldiscs%]$font(,,,233-233-233)$char(41)
//)

// Title
$align(left,middle)$font(tahoma,12,bold,140-186-236)↘ $font(tahoma,12,,233-233-233)
$if(%album artist%,
$if($strrchr(%album artist%,$char(12300)),
$font(,,,140-186-236)$char(12300)$font(,,,233-233-233)$substr(%album artist%,2,$sub($len(%album artist%),1))$font(,,,140-186-236)$char(12301)
,%album artist%)
,)

$if($and(%album artist%,%album%),$font(,,,140-186-236) - $font(,,,233-233-233),)
$trim($left(%album%,$sub($strrchr(%album%,$char(40)),1)))

// Genre & Year
$font(tahoma,7,,)
$align(right,top)[$char(91)$font(,,,140-186-236)[%genre%]$if($and(%genre%,%date%), - ,)[%date%]$font(,,,233-233-233)$char(93)]

// CDID
$align(right,bottom)$if(%CDID%,$char(91)$font(,,,140-186-236)%CDID%$font(,,,233-233-233)$char(93),)
,
$drawrect(0,0,0,0,brushcolor-166-202-240 pencolor-null)
$drawrect(0,4,0,4,brushcolor-140-186-236 pencolor-null)
$drawrect(0,10,0,4,brushcolor-130-164-209 pencolor-null)
$drawrect(0,$sub(%_height%,8),0,4,brushcolor-140-186-236 pencolor-null)
$align(center,middle)$font(tahoma,10,italic,0-0-0)
~ Singles ~
)
)


Images Used:
IPB Image IPB Image IPB Image
frame.top.left.png, frame.top.png, frame.top.right.png

IPB Image IPB Image
frame.left.png, frame.right.png

IPB Image IPB Image IPB Image
frame.bottom.left.png, frame.bottom.png, frame.bottom.right.png
---
FEATURE REQUEST: I would like to request that this component add a field where we can enter a custom sort string, and then I would like for the component to automatically apply that sort any time the playlist changes.
sHsIkuA
Yotsuya, tried ur method, still the same sad.gif

guess I'll use the old version for awhile

What version u using?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.