Using fb2k’s Scripting Language In It’s Masstagger?!?

Well, what I’m trying to do I thought would be very simple: Add a new tag to each file that’s been added to fb2k’s media library holding the current system date and hence add a “added to library” tag. The tagz script to achieve this is not even the problem.

$if($meta(ADDED_TO_FOOBAR),,%cwb_systemdatetime%)

Or, what seams to be semantically equivalent but more readable (refer to tagz reference to understand the commands):

$if($not($meta(ADDED_TO_FOOBAR)),%cwb_systemdatetime%)

This even checks if the file has a tag already. Using the tagz parser in the preference dialog (Ctrl+P -> Display -> Title Formatting) confirms it’s working correctly when playing a song without a tag and one with the time stamp set.

The set-up is this:

  • with masstagger (right-click on song -> tagging -> manage scripts, if you haven’t changed the default context menu structure) add “Format value from other fields…“, select destination field name (ADDED_TO_FOOBAR) and use the stated script as formatting pattern. Hit Return and name your masstagger script and (important:) click the save button. Note: Using “Set value…” or the like will not work since it, despite intuitive guesses, does not evaluate tagz scripts but outputs it as a string.
  • in fb2k’s preferences dialog select Tools -> New File Tagger and from the drop-down list select Tagging/Scripts/your name (do this after extensive testing on single files with the file’s preferences box open!)

Now each time a file is added to fb2k’s lib this script is run on it. BUT: It doesn’t do what it’s supposed to! What ends up in the files tags is

  1. a ‘?’ for those with no time stamp
  2. deleting the existing field when value = ‘?’

That’s when I noticed the two scripts are not equivalent: The first add an empty string to the requested field if present where the later does simply nothing in that case because there is no else branch. But still, even the later does not do the desired job.

Then I came up with this script:

$if($not($meta_test(ADDED_TO_FOOBAR)),%cwb_systemdatetime%,$meta(ADDED_TO_FOOBAR))

But once again, the only effort is frustration but not the desired time stamp. After all it leaves existing fields untouched.

I could work around this issue with the “Stamp current Time and Date…” bit but since after reinstalling my OS and using fb2k before my music files partly are stamped already. Sidenote: Probably because of this the field name should rather be something like “ADDED_TO_LIBRARY”. Though moving on…

A working workaround I figured out is to

  1. add a “Stamp current Time and Date…”,
  2. use the following script
  3. $if($not($meta_test(ADDED_TO_FOOBAR)),$meta(TIMESTAMP),$meta(ADDED_TO_FOOBAR))
  4. add “Remove Field…” with selected “TIMESTAMP” field.

So that leaves me with speculating about a bug in either the masstagger or in foo_cwb_hooks. By the way, the time stamping option might be in foo_masstag_addons. You might want to include this masstagger script from a file.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: