Changes Made to TAG.EXE, Tags from text file & OptimFrog support |
- No over 30 sec clips of copyrighted music. Cite properly and never more than necessary for the discussion.
- No copyrighted software without permission.
- Click here for complete Hydrogenaudio Terms of Service
![]() ![]() |
Changes Made to TAG.EXE, Tags from text file & OptimFrog support |
May 2 2007, 09:20
Post
#51
|
|
![]() Group: Super Moderator Posts: 4887 Joined: 12-August 04 From: Exeter, UK Member No.: 16217 |
Thinking about it, I think this will be because Tag understands MP3 files, but has no idea how to decypher TAK files (or OptimFrog, WavPack, and maybe more). Part of the extended information involves writing the duration of the track, and Tag can't retrieve that as it doesn't know how to read the header.
That said, I believe using -1 for the duration is valid (certainly for streaming files), so I may see if I can get Tag to use -1 for the duration if it can't decypher the format, and use the meta data info that it should surely know about. I'll add it to my list of crap to stop me from doing proper work... Edit: FYI I have confirmed this. If Tag cannot obtain a duration it does not write the line at all. I'll report back here if I can make the change. This post has been edited by Synthetic Soul: May 2 2007, 10:16 -------------------- I'm on a horse.
|
|
|
|
May 2 2007, 20:09
Post
#52
|
|
![]() Group: Super Moderator Posts: 4887 Joined: 12-August 04 From: Exeter, UK Member No.: 16217 |
OK, you can give Tag 2.0.52 a go.
This version should write #EXTINF for any file. If it doesn't understand the file type it will use -1 as the duration. Edit: Removed beta status. This post has been edited by Synthetic Soul: May 4 2007, 08:04 -------------------- I'm on a horse.
|
|
|
|
May 5 2007, 22:59
Post
#53
|
|
![]() Group: Members Posts: 234 Joined: 18-September 02 From: the Netherlands Member No.: 3392 |
I use tag.exe to write the correct tags based on filenames with:
CODE tag --auto --chreplace *.flac I have changed the configuration file to mij needs (see below). The autorenaming from ^ to ? works correct. But somehow the conversion from ; to : doesn's work. Must the ; be escaped or something? CODE # Specify character replacement for tagging
# note: space is separator [CharReplacementForTag] ^ ? ; : -------------------- netjukebox - the flexible media share
http://www.netjukebox.nl |
|
|
|
May 6 2007, 13:24
Post
#54
|
|
![]() Group: Super Moderator Posts: 4887 Joined: 12-August 04 From: Exeter, UK Member No.: 16217 |
I can confirm that this is the case, but can't immediately see why.
FYI: prefixing the semicolon works, so a replacement of "@; :" will convert "@;" to ":"; however ";@ :" does not work as expected. It seems to be an issue with it beginning with ";". The ListSeparator is "; ", but I've checked in a hex editor and "^;^" results in 3F 3B 3F ("?;?"), not 3F 00 3F, as you would hope. Dunno... Here's the key code (taken from Tag.cpp) I believe (NB: swap is done in misc.cpp's ReplaceCharactersForTag): CODE case MCharReplaceTag: // settings under [CharReplacementForTag]
if ( (ReplaceTag->OldChars = (char **)realloc ( ReplaceTag->OldChars, sizeof (*ReplaceTag->OldChars) * (ReplaceTag->CharCount + 1) )) == NULL ) { fprintf ( stderr, "load_config: Memory allocation failed.\n" ); exit (1); } if ( (ReplaceTag->NewChars = (char *)realloc ( ReplaceTag->NewChars, ReplaceTag->CharCount + 1 )) == NULL ) { fprintf ( stderr, "load_config: Memory allocation failed.\n" ); exit (1); } p = temp; while ( *p && *p != ' ' ) p++; if ( (ReplaceTag->OldChars[ReplaceTag->CharCount] = (char *)malloc ( p - temp + 1 )) == NULL ) { fprintf ( stderr, "load_config: Memory allocation failed.\n" ); exit (1); } if ( p > temp ) { strncpy ( ReplaceTag->OldChars[ReplaceTag->CharCount], temp, p-temp ); } ReplaceTag->OldChars[ReplaceTag->CharCount][p-temp] = '\0'; if ( *p == ' ' ) p++; ReplaceTag->NewChars[ReplaceTag->CharCount] = *p; ReplaceTag->CharCount++; break; -------------------- I'm on a horse.
|
|
|
|
May 6 2007, 18:38
Post
#55
|
|
![]() Group: Super Moderator Posts: 4887 Joined: 12-August 04 From: Exeter, UK Member No.: 16217 |
Doh.
Just seen the real culprit just before that code in Tag.cpp: CODE while ( fgets_clean ( temp, sizeof (temp), fp ) != EOF ) { if ( temp[0] == '\0' || temp[0] == ';' || temp[0] == '#' ) // skip empty lines and comments continue; Not sure how to resolve this. It's possible to remove the check for ";", but what if people are using them for comment lines? I don't like to break backward compatibility. presumably "# :" wouldn't work either. I can see no way to escape the character. This post has been edited by Synthetic Soul: May 6 2007, 18:41 -------------------- I'm on a horse.
|
|
|
|
May 6 2007, 22:06
Post
#56
|
|
![]() Group: Members Posts: 234 Joined: 18-September 02 From: the Netherlands Member No.: 3392 |
Thanks for the clear explanation.
I understand that you don't wont to break backwards compatibility. A switch to disable the ; comment could be an option. But maybe I'm the only one who really needed this feature. -------------------- netjukebox - the flexible media share
http://www.netjukebox.nl |
|
|
|
May 7 2007, 06:48
Post
#57
|
|
![]() Group: Super Moderator Posts: 4887 Joined: 12-August 04 From: Exeter, UK Member No.: 16217 |
Well, users should really be able to swap any characters they choose.
I'd be tempted to stop ";" being a comment character just in that section. 1. The initial cfg file uses "#" so users may only think (as I did) that "#" is the only character that can be used (so no-one is using ";"). 2. "#" does not need replacing, as it is a valid filename character, so that can still be used. If you agree I can easily create 2.0.53b1 and upload for you (and all new full releases will act in this way). -------------------- I'm on a horse.
|
|
|
|
May 7 2007, 08:13
Post
#58
|
|
![]() Group: Members Posts: 234 Joined: 18-September 02 From: the Netherlands Member No.: 3392 |
If I understood correctly than the ; will still be a comment tag.
But only in the [CharReplacementForTag] section you can use ; That is really a good solution and still backwards compatible. So I agree and would like doing some tests with the upcoming tag 2.0.53b1 Thanks for your help. -------------------- netjukebox - the flexible media share
http://www.netjukebox.nl |
|
|
|
May 7 2007, 09:34
Post
#59
|
|
![]() Group: Super Moderator Posts: 4887 Joined: 12-August 04 From: Exeter, UK Member No.: 16217 |
You understand correctly. You can try 2.0.53b1.
FYI: all I have amended is: CODE if ( temp[0] == '\0' || (temp[0] == ';' && mode != MCharReplaceTag) || temp[0] == '#' ) // skip empty lines and comments
-------------------- I'm on a horse.
|
|
|
|
May 7 2007, 10:20
Post
#60
|
|
![]() Group: Members Posts: 234 Joined: 18-September 02 From: the Netherlands Member No.: 3392 |
Simply fixes are mostly the best
Everything seems to work as expected. If I find something strange I will post it here. I don't think that will happen with such a straightforward fix. Thanks again. -------------------- netjukebox - the flexible media share
http://www.netjukebox.nl |
|
|
|
May 11 2007, 15:33
Post
#61
|
|
![]() Group: Members Posts: 234 Joined: 18-September 02 From: the Netherlands Member No.: 3392 |
I have done some test the last days with tag 2.0.53b1 and everything related to the ; renaming worked perfectly.
With double albums I discovered that tag.exe gave the album tag a cd number like below: CODE Filename Album tag 101 - Album name.extension Album name (CD 1) 102 - Album name.extension Album name (CD 1) 201 - Album name.extension Album name (CD 2) 202 - Album name.extension Album name (CD 2) Can this behaviour somehow be configured or is this hard coded in the program? -------------------- netjukebox - the flexible media share
http://www.netjukebox.nl |
|
|
|
May 11 2007, 17:08
Post
#62
|
|
![]() Group: Super Moderator Posts: 4887 Joined: 12-August 04 From: Exeter, UK Member No.: 16217 |
It looks to me as though there is a way to get the value into a Disc tag instead, but I can't work out how.
The relevant code is in "guess.cpp". FYI, according to the code %D for Disc is a valid token, although it's not documented in the CFG file. I can't work out from the code what you're supposed to do to get the disc tag instead of it appending " (CD x)" to the album name. Edit: Got it. I don't know what I was doing wrong. CODE tag --auto --scheme "%L\%D%N - %T" "204 - Track name.wv" CODE Tag - Automatic Tag from filename
Copyright (c) 2002-2003 Case. Minor additions by Neil Popham, 2004-2007 Version 2.0.53b1, Compiled 2007-05-07 C:\Documents and Settings\Neil\Desktop\204 - Track name.wv Tag: Generated from name Title: Track name Artist: Album: Desktop Year: Track: 04 Genre: Comment: Disc=2 APE v2.0 tag written. This post has been edited by Synthetic Soul: May 11 2007, 17:20 -------------------- I'm on a horse.
|
|
|
|
May 11 2007, 19:10
Post
#63
|
|
![]() Group: Members Posts: 234 Joined: 18-September 02 From: the Netherlands Member No.: 3392 |
I don't want to be a pain in the arse
But still I found a problem with tag. CODE tag --auto --chreplace --scheme "%A\%Y - %L\%D%N - %T" *.flac When using the command line like this the "Vorbis comment" block is written as below: CODE METADATA block #2 type: 4 (VORBIS_COMMENT) is last: false length: 316 vendor string: reference libFLAC 1.1.4 20070213 comments: 11 comment[0]: REPLAYGAIN_REFERENCE_LOUDNESS=89.0 dB comment[1]: REPLAYGAIN_TRACK_GAIN=-6.36 dB comment[2]: REPLAYGAIN_TRACK_PEAK=0.98138428 comment[3]: REPLAYGAIN_ALBUM_GAIN=-6.48 dB comment[4]: REPLAYGAIN_ALBUM_PEAK=0.98852539 comment[5]: Disc=2 comment[6]: TITLE=Hatoa comment[7]: ARTIST=Bonobo comment[8]: ALBUM=Days to come comment[9]: TRACKNUMBER=07 comment[10]: DATE=2006 METADATA block #3 type: 1 (PADDING) is last: true length: 3820 The %D is written as "Disc", I think that this must be "DISCNUMBER" for "Vorbis comment". When using the same line "%A\%Y - %L\%D%N - %T" in the [Schemes] section of tag.cfg it doesn't work at all. -------------------- netjukebox - the flexible media share
http://www.netjukebox.nl |
|
|
|
May 11 2007, 19:36
Post
#64
|
|
|
Group: Banned Posts: 157 Joined: 23-December 02 Member No.: 4209 |
I have a feature request. Tag currently doesn't work properly with tracknumbers like "01/19" when renaming. It just renames file to "01-19 (something)". It would be better if it would rename file to "01 (something)" in this case.
|
|
|
|
May 11 2007, 21:48
Post
#65
|
|
![]() Group: Super Moderator Posts: 4887 Joined: 12-August 04 From: Exeter, UK Member No.: 16217 |
The %D is written as "Disc", I think that this must be "DISCNUMBER" for "Vorbis comment". I can easily (I think) change it to write Discnumber for all formats. I'm tempted by this, as IIRC it is the suggested filed name for that data. I'm confused why foobar uses Disc now, when I thought that it had previously moved from Disc to Discnumber.When using the same line "%A\%Y - %L\%D%N - %T" in the [Schemes] section of tag.cfg it doesn't work at all. The code that creates the disc tag has the comment "// quick hack". I have a feature request. Tag currently doesn't work properly with tracknumbers like "01/19" when renaming. It just renames file to "01-19 (something)". It would be better if it would rename file to "01 (something)" in this case. I'm sorry, but this is beyond me. -------------------- I'm on a horse.
|
|
|
|
May 12 2007, 00:59
Post
#66
|
|
|
Group: Banned Posts: 157 Joined: 23-December 02 Member No.: 4209 |
I'm sorry, but this is beyond me. Ok, can you please try this patch? I was unable to build all this mess because of libFLAC. CODE --- guess-old.cpp 2005-06-12 20:37:10.000000000 +0400
+++ guess.cpp 2007-05-12 03:11:51.981339500 +0400 @@ -678,6 +678,7 @@ char temp [_MAX_PATH * 2 + 1]; char tempname[4096]; char* src = NULL; + char* sl; char* f; size_t s_pos = 0; size_t i; @@ -713,8 +714,14 @@ } if ( src != NULL ) { - if ( src == TagValue ( APE_TAG_FIELD_TRACK, Info ) && (strlen (src) == 1) ) { - *f++ = '0'; + if ( src == TagValue ( APE_TAG_FIELD_TRACK, Info ) ) { + if (strlen (src) == 1) { + *f++ = '0'; + } + sl = strchr ( src, '/' ); + if ( sl != NULL ) { + strncpy ( sl, '\0', 1 ); + } } f += sprintf ( f, "%s", src ); |
|
|
|
May 12 2007, 08:23
Post
#67
|
|
![]() Group: Super Moderator Posts: 4887 Joined: 12-August 04 From: Exeter, UK Member No.: 16217 |
Ok, can you please try this patch? I was unable to build all this mess because of libFLAC. Your patch causes an application error.NB: I have written a guide regarding how to set up the source structure to build Tag. I did this ages ago, as it took me so long to just work out how to compile it when I made my first changes; it may be obvious to you. The guide can be found here: http://www.synthetic-soul.co.uk/tag/setup.txt It seems pretty f***ed up that you, as a C programmer, should be asking me, a non-C programmer, to make changes. As I've said many times now, I find my lack of knowledge frustrating, and trying to action people's requests is now just pissing me off. I wish I'd stopped at version 2.0.40 sometimes. I rarely even use Tag, although I do find it very useful to check what foobar is up to. Sorry, don't mean to rant, and it's not aimed at you specifically. Edit: Hang on, now I bother to look at your code, you never end up doing anything with sl do you? This post has been edited by Synthetic Soul: May 12 2007, 08:46 -------------------- I'm on a horse.
|
|
|
|
May 12 2007, 13:08
Post
#68
|
|
|
Group: Banned Posts: 157 Joined: 23-December 02 Member No.: 4209 |
Your patch causes an application error. Oops... QUOTE It seems pretty f***ed up that you, as a C programmer, should be asking me, a non-C programmer, to make changes. I'm not a C programmer. In fact, I don't know C at all. I just analized the code and made a change that could do the thing in theory. But I could mess up something with pointers because I don't know how they work in C. I will try your guide, maybe it'll help me to find those missing headers libFLAC wants. |
|
|
|
May 12 2007, 13:19
Post
#69
|
|
![]() Group: Super Moderator Posts: 4887 Joined: 12-August 04 From: Exeter, UK Member No.: 16217 |
I'm not a C programmer. In fact, I don't know C at all. I just analized the code and made a change that could do the thing in theory. But I could mess up something with pointers because I don't know how they work in C. Ah, I see. Seems like we are in the same boat.
-------------------- I'm on a horse.
|
|
|
|
May 12 2007, 15:03
Post
#70
|
|
|
Group: Banned Posts: 157 Joined: 23-December 02 Member No.: 4209 |
Your patch causes an application error. I found why. Replace CODE + strncpy ( sl, '\0', 1 ); with CODE + strncpy ( sl, "\0", 1 ); How could I do such a stupid mistake? PS: I spent an hour trying to build it with VS2003, but ended up with nothing. Everything builds but linker shows errors. So, it's again an unverified patch.. Hope it'll work this time.. |
|
|
|
May 12 2007, 16:01
Post
#71
|
|
![]() Group: Super Moderator Posts: 4887 Joined: 12-August 04 From: Exeter, UK Member No.: 16217 |
That appears to work.
Shouldn't it still pad the number though? Edit: S'OK, I just changed it to: CODE if ( src == TagValue ( APE_TAG_FIELD_TRACK, Info ) ) { sl = strchr ( src, '/' ); if ( sl != NULL ) { strncpy ( sl, "\0", 1 ); } if (strlen (src) == 1) { *f++ = '0'; } } 2.0.53b2 This post has been edited by Synthetic Soul: May 12 2007, 16:06 -------------------- I'm on a horse.
|
|
|
|
May 12 2007, 17:57
Post
#72
|
|
|
Group: Banned Posts: 157 Joined: 23-December 02 Member No.: 4209 |
Thank you very much! It works!
|
|
|
|
Oct 31 2007, 18:13
Post
#73
|
|
![]() Group: Members Posts: 2296 Joined: 18-May 03 From: Denmark Member No.: 6695 |
Ummm, is it possible to avoid printing the copyright notice? Currently it outputs to the screen no matter what.
-------------------- Can't wait for a HD-AAC encoder :P
|
|
|
|
Oct 31 2007, 21:03
Post
#74
|
|
![]() Group: Super Moderator Posts: 4887 Joined: 12-August 04 From: Exeter, UK Member No.: 16217 |
I don't think that you can, but I don't think that you need to. You may want to look at --stdout.
Using that switch you can output the important bits to STDOUT, and leave the header writing to STDERR (IIRC). E.g.: CODE TAG.EXE --stdout --hideinfo --hidenames file.mp3 > tags.txt
-------------------- I'm on a horse.
|
|
|
|
Nov 26 2007, 14:23
Post
#75
|
|
|
Group: Members Posts: 3 Joined: 3-October 07 Member No.: 47545 |
Thanks for the tool. Will not prompt, how I can write a cover in a wv-file? Whether it is possible to register separate tags (for example Cover Art (Front) and Cover Art (Back))?
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 24th May 2013 - 19:15 |