Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: layouts for untagged files (Read 3511 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

layouts for untagged files

hi there!

i'm just joining the foobar user community, and while fooling around with it a little i'm pretty convinced i'll switch to it completely...

BUT (there had to be a but, right?  )

i'm having a hard time in getting good looking playlists containing non-tagged files like wav, shn. i tried hard to look for some advice but you people seem to concentrate your efforts on taggable files? or am i getting something wrong here? no offence meant, i just can't seem to find a column_ui layout that doesn't rely solely on metadata, for example. and since i'm having a lot of samplers in WAV and SHN (tagging those with foosions plugin is not an option), i want them to be properly sorted to columns.

since i couldn't find anything on it here in the forum, i started to fool around with the columns_ui display tab, and i've come up with this, taking the latest azrael set as a basis:

columns - artist - display
Code: [Select]
$puts(has_tags,1)
$puts(has_number,1)
$puts(is_sampler,0)
$puts(temp_string,'')
$puts(nt_artist,$directory($extra(path_raw),2))

//check: file has tags / no tags?
$if($not($meta_test(artist)),$puts(has_tags,0))

//check: file belongs to sampler?
$if($stricmp($directory($extra(path_raw),2),'sampler'),$puts(is_sampler,1))

//cut tracknumber if filename starts with one
$if($not($greater($strchr($extra(filename),'-'),5)),$puts(temp_string,$substr($extra(filename),$add($strchr($extra(filename),'-'),2),50)),$puts(temp_string,$extra(filename)))

//here the temp_string should look like artist - title

$if($strcmp($get(is_sampler),'1'),$puts(nt_artist,$substr($get(temp_string),1,$sub($strchr($get(temp_string),'-'),2))))

//clear temp_string of the tilte, write artist to nt_artist

//output
$if($strcmp($get(has_tags),1),%artist%,$get(nt_artist))
this works fine for my standard file structure

%artist%\%album%\%tracknumber% - %title%
or
SAMPLER\%album%\%tracknumber% - %artist% - %title%
or
SAMPLER\%album%\%artist% - %title%
(my own compilations are stored like this because there are different editions, like tape and cd, where the order might not be fixed)

i'm sure anyone here could modify it for personal use. i can post the slightly modified code for the other columns as well, if anyone is in need of that. but first i'd like to know if there are any flaws in there, or if the code could be optimized anywhere?

specifically i'm not satisfied with the way the filename is "analyzed". the criteria i used here - first '-' occurs before the 5th position - is suboptimal, to say the least. it would be more precise to check whether there are one or more '-' in the filename. or, better still, i should check for ' - ' to avoid taking double name seperators (like in gil scott-heron) for column seperators.

so, any help/comment is more than welcome. if there is demand i'll post the optimized display code for all the columns here!

cheers, pano

[span style=\'font-size:8pt;line-height:100%\']moderation: Please use [ codebox ].[/span]
[span style=\'font-size:8pt;line-height:100%\']pano: can do, thx[/span]

layouts for untagged files

Reply #1
it's me, talking to myself again 

here's the code for the 'on screen display - format' field:

foo_osd|format:

Code: [Select]
//standard config: file with tags, filename starting with tracknumber, no sampler

$puts(has_tags,1)
$puts(has_number,1)
$puts(is_sampler,0)
$puts(temp_string,'')

//vars are set for standard file structure artist\album\tracknumber - title

$puts(nt_artist,$directory($extra(path_raw),2))
$puts(nt_title,$substr($extra(filename),$add($strchr($extra(filename),'-'),2),50))
$puts(nt_album,$directory($extra(path_raw),1))

//for files without tag

$if($not($meta_test(title)),$puts(has_tags,0))

//for sampler

$if($stricmp($directory($extra(path_raw),2),'sampler'),$puts(is_sampler,1))

//artist - title is stored in var temp_string, without leading tracknumber for files starting with it

$if($not($greater($strchr($extra(filename),'-'),5)),$puts(temp_string,$substr($extra(filename),$add($strchr($extra(filename),'-'),2),50)),$puts(temp_string,$extra(filename)))

//artist format

$if($strcmp($get(is_sampler),'1'),$puts(nt_artist,$substr($get(temp_string),1,$sub($strchr($get(temp_string),'-'),2))))

//title format

$if($strcmp($get(is_sampler),'1'),$puts(nt_title,$substr($get(temp_string),$add($strchr($get(temp_string),'-'),2),50)))

//album format
//no extra formatting needed - parent folder is assumed

//output

$rgb(206,0,0,255,255,255)$if($strcmp($get(has_tags),1),%artist%,$get(nt_artist))$char(10)
$rgb(0,255,0,255,255,255)$if($strcmp($get(has_tags),1),%title%,$get(nt_title))$char(10)
$rgb(0,255,0,0,0,0)$if($strcmp($get(has_tags),1),%album%,$get(nt_album))
there's another question for you script people:

how can i determine the length of a string? sounds like a stupid rtfm question but i really tried to figure it out and failed miserably. hence, the "take string from the '-' on" procedure is not optimal because i have to enter a fixed value, and the '50' i entered is way too short ...

[span style=\'font-size:8pt;line-height:100%\']moderation: Please use [ codebox ].[/span]
[span style=\'font-size:8pt;line-height:100%\']pano: can do, thx[/span]

layouts for untagged files

Reply #2
This is the code I use and might help you with untagged files in Columns UI.

Code: [Select]
FOR ARTIST COLUMN:
$if($meta_test(artist),%artist%,
$substr(%_filename%,1,$sub($strstr(%_filename%, - ),1)))

FOR TITLE COLUMN:
$if($or($meta_test(title),$not($strstr(%_filename%, - ))),
%title%,
$substr(%_filename%,$add($strstr(%_filename%, - ),3),$len(%_filename%)))

layouts for untagged files

Reply #3
hey mil3s,

thanx for the update. i optimized my code with the %_filename% tag instead of $extra(filename). and $len is just what i thought i searched the reference for *blush*. but the $strstr(%_filename%, - ) gives me some trouble: doesn't strings need to be put in ''? either way, it doesn't work here:

UPDATE:

sorry, i'm stupid. i didn't see that you exchanged 'strchr' with 'strstr' - works perfect now!!!

still, i'm thinking about a better criteria for the 'tracknumber in filename' check than
Code: [Select]
$if($not($greater($strstr(%_filename%, - ),4))...
the reason is that very short artists are not handled properly: a file like

E - Manchester Girl (BBC).wav

is shown like this:

ARTIST
  TITLE nchester Girl (BBC)

there has to be a smarter way to solve this 

 

layouts for untagged files

Reply #4
I have no problems with short filenames like that. You must have modified the code or something.

layouts for untagged files

Reply #5
the problem occurs when i crop the filenames to just artist - title, omitting the possible 'xx - ' just before it. the best check whether there is a tracknumber in the filename or not that i came up with is checking if the first '-' is in the first four characters of the filename.

a different check would be more precise: are there one or more '-' in the filename? but i couldn't translate that to code since there doesn't seem to be a '=' allowed? then the check would propably go like this:

Code: [Select]
$if($strstr(%_filename%, - )=$strrstr(%_filename%, - ),$puts(...))

layouts for untagged files

Reply #6
I recommend using Mp3tag to rename your files properly. Tracknumber shouldn't be in the filename, at least not in my opinion.

layouts for untagged files

Reply #7
why not overrides like xmplay ?


wav edit tag - Foobar2000


wav edit tag - Xmplay overrides (virtual tag, false tag ?)

--

mp3 files - winrar package - foobar2000


mp3 files -winrar package - xmplay (??? wow !)


there is this feature in foobar2000 ?