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: Formatting Syntax - using sys/current time & date to add to metadata (Read 2216 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Formatting Syntax - using sys/current time & date to add to metadata

Heya,
maybe one of you guys more prolific with foobar syntax & context doesn't mind giving a pointer:

I would love to inject a date into metadata when a specific operation has been executed (i.e. a tag write from foo_discogs to be exact), so I stumbled upon this:
http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#Time_and_date_functions
foo_discogs has it's own mapping dialogue, and I would assume one can use foobar syntax, but I can not figure out how to use:
$date(time)
with it... the field just stays empty...

Cheerio.
c.

Re: Formatting Syntax - using sys/current time & date to add to metadata

Reply #1
Hm...after poking this a bit more:

$year(time)
produces:
0000

Whereas
$date(time)
is a string w 0 length.

Meh. I'm even more confused now.
c.

Re: Formatting Syntax - using sys/current time & date to add to metadata

Reply #2
Are you literally passing it the word "time"? You need to pass it some input, like %date% or %timestamp% or whatever tag you want.

Re: Formatting Syntax - using sys/current time & date to add to metadata

Reply #3
Yea, I find syntax combining & foobars functions rather confusing... and assumed/was hoping 'time' is a global system time value...
But you're right, the documentation wording "These functions are used to manipulate time/date strings, " should have been a hint :/

I've played around with %date%, but that is contextual to the release-date of the file being edited. %timestamp% I got nothing from.
And I have not found a way to retrieve system time. i,e, now/today, which is what I am after really.

Churs.
c.

Re: Formatting Syntax - using sys/current time & date to add to metadata

Reply #4
There is no way to retrieve the system time with default title formatting functions or variables, and even if there were, there is no way to force the caller to refresh the script on any given time interval, if that's what you're after. Which I suppose it isn't, but I just thought I'd be clear on that one.

Re: Formatting Syntax - using sys/current time & date to add to metadata

Reply #5
It wasn't meant for interval refreshes, I just wanted to mark (in a custom field as a human readable YYYY_MM_DD format) when certain tag update operation has been performed last.
Bummer there's no system time within foobars' default syntax.
Thanks for the info! Muchly appreciated!
c.


Re: Formatting Syntax - using sys/current time & date to add to metadata

Reply #7
Interesting!

I use masstagger, so a quick try revealed:

In foo_masstagger gui:
$date(%now%)
=
2017-01-08

But in foo_discogs, using the same:
$date(%now%)
=
nada, zilch, nothing

Should the masstagger %now% variable be available for other components to use ?

Cheers.
c.

Re: Formatting Syntax - using sys/current time & date to add to metadata

Reply #8
Hm,
poking around w foobars' 'Automatically Fill Values...' window  and %now% / $date(%now%) only produces empty strings or function errors for me, so could it be %now% is only exposed within masstagger gui context ? (disclaimer... I have no clue how variables & functions are inherited in foobar.. :D )
Cheers.
c.

Re: Formatting Syntax - using sys/current time & date to add to metadata

Reply #9
could it be %now% is only exposed within masstagger gui context ?
Yes.
You could ask the maintainer (zoomorph) of the foo_discogs component to add a "now"-thingy, but I think it has been asked before, which is no reason to ask again :-)

Re: Formatting Syntax - using sys/current time & date to add to metadata

Reply #10
@alec.tron
Here's a two-step method to make a new timestamp after a Discogs tagging session.

Create a new standard field
Open Preferences from the file menu.
Select Advanced → Display → Default User Interface → Properties dialog → Standard fields :
Append this to the end of the string:
;Discogs update=MODIFIED
(remember the semicolon as delimiter). Click OK to save changes.
"Discogs update" will now appear as a standard field in the Properties window. It doesn't change any of your tracks (unless you fill in a value of course).

Create a Masstagger script
Right-click an album in your Media Library Viewer and
Select Tagging → Manage scripts. Press the Clear button and OK to Clear all actions.
Click Add and Format values from other fields...
Type MODIFIED in the Destination field name:
and insert $left(%last_modified%,10) as Formatting pattern. Se notes.
Give the script a useful name, e.g. Latest Discogs update, and click Save.

Create a shortcut calling the script
Open Preferences from the file menu.
Select Keyboard Shortcuts.
Click Add new.
In Field list by: in the Action area type latest discogs to narrow down the list.
Point at Latest Discogs update.
Select a key combination. Don't make it a global hotkey. Click OK.

Test
Update an album with the Discogs tagger component.
Press the new shortcut. Open Properties (Alt+Enter) to check that everything is as expected.

Notes
%last_modified% is giving e.g. 2017-01-08 10:13:55
$left(%last_modified%,10) is giving e.g. 2017-01-08. (That is 10 chars counted from the left of the complete timestamp, 2017-01-08 10:13:55; the hh:mm:ss part is not necessary in this context, IMO.
$left(%last_modified%,7) gives 7 chars counted from the left of the complete timestamp, e.g. 2017-01.
$left(%last_modified%,10) is the same as $date(%last_modified%).
You might use %now% instead of %last_modified%, but strictly speaking is %last_modified% more correct than %now%, isn't it?

Instead of a hotkey you could assign a button to call the scipt.

(disclaimer... I have no clue how variables & functions are inherited in foobar.. :D )
I would be careful with messing with the Discogs tagger component's tagging functions. From the manual:

Quote
Tag formatting strings are an extension of foobar2000 titleformatting strings. The general syntax is similar, but our extension is quite a bit more complicated. You ought to understand titleformatting syntax before attempting to understand our extended tag formatting syntax.

Re: Formatting Syntax - using sys/current time & date to add to metadata

Reply #11
Wow, thanks a ton for the idea!
For now, and to just make it work, I just hand-input the date to a custom field in foo_discogs dialogue (only needs to be done once a day, when I do a tag update session :D ), which works, but isn't ideal. I'll see if I can set it up your suggested way! If zoomorph has no interest in implementing a %now% /  %last_modified%  variable into foo_discogs.

Cheerio!
c.

Re: Formatting Syntax - using sys/current time & date to add to metadata

Reply #12
Here's the illustrated, abridged version :)).

Edit. Hm. The HA forums doesn't seem to accept file attachments at the moment.
Masstagger screenshot: https://imgur.com/elMUtJ9.
Keyboard shortcut screenshot: https://imgur.com/zyvIWo1.