Printable Version of Topic
-Brading Software Message Board +--Forum: Mp3/Tag Studio Support and Bug Reports +---Topic: Support Req: Advanced parsing help started by Zardoz Posted by: Zardoz on July 27 2006,23:41 I have a directory of files which already have valid tags that I wish to modify only one field, the track number. I'd like to do it like the advanced example where you extract the disk number and preface that on the track number to be the new track number, than rename the file(s) to be just <NewTrackNr> - <Title>.mp3 Here is an example file name: xxxxx yyyyyy zzzzzz_ttttttttttttttttttttttttttttt (Disc 1)_01_aaaaaaaaa.mp3 The advanced input template I tried to use is: <TRASH:55> <TrackNr-1[|]>)_<TrackNr-2[0|]>_<TRASH>.mp3 but there's something wrong with it that I don't see. The output template is: <TrackNr> - <Title>.mp3 but it shows in red as well. Any assistance would be appreciated. Z Posted by: calberga on July 28 2006,00:30 The red in the output template is there because there is no definition for <Title> in the input. If the "aaaaaaa" substring in you example filename is the title, then try (with another suggested change) <TRASH>(Disk <TrackNr-1[|]>)_<TrackNr-2[0|]>_<Title>.mp3 (the insertion of "(Disk " obviates the possibility of errors in counting, or files with different numbers of characters before the disc number). I, on the other hand, you are hoping to grab the "Title" tag from the file, I don't think it can be done in one step. In the direct rename you can only use tokens defined in the input template to build the output template. In that case you will need two steps (using Magnus's macro facility). First, simply rename the file with the output template: <TrackNr-1[|]><TrackNr-2[0|]>.mp3 Then rename from tags with: <TrackNr> - <Title> Wrap the two into a macro, and hey presto! However, two additional comments. First, why are you appending the "0" to the front of the original track number? You show the number as two digits in you example filename. If, in fact, it can vary (e.g., not have a leading zero for numbers less than 10) you are not going to get file names which sort reasonably, as "101 - xx" will be followed by "1010 - xx". You would be better off stashing the disk number in some un-used v2 tag, such as <V2_TPOS>, or if you are using that something really odd, like <V2_WCOM>, "Commercal Information". Then, after making sure the V1 and V2 tags are syncoronized you will have leading zeros on all the track numbers less than 10. ********* Magnus -- help me out here incase I've flubbed the regularizing of the tracknumber lengths. ********** [Note that this somewhat (hence the cry for help above) on the "Zero pad track numbers" setting in the "General tagging" area of the "Settings" checked and set to the appropriate number.] Then do a rename from files with: <V2_TPOS><TrackNr> - <Title> and as a cleanup, clear out the temporary tag you used. Second comment. In the direct rename there is no reason to use tokens with tag names, other than as a mnumonic. It is much cleaner (IMHO) to use simply <Custom1>, <Custom2>, etc. These are, after all, just parts of file names, which may, incidently have the same value of tags, but need not. Just my crazyness, probably. Posted by: calberga on July 28 2006,01:19 An addenda -- I hurried the last part of the previous post (dinner was being served), and while eating I realized that I should have been a bit more expansive (what? how?) in the last section. The key here is that by using <Custom1> etc. in the templates for direct file renaming it would have been impossible to make the error of trying to mix parts of the input file with tags from the file (as I said, a no-no). By using tokens which carry no freight of association with the tags one can ONLY focus on using parts of the old name, plus literals, to construct the new name. So, it is not only neater, it helps avoid errors. I believe, but have not experimented (yet -- maybe later, maybe not) that the syncronization step I proposed above is not needed. I think, although I may be wrong, that setting the "pad with zeros" parameter in the settings will apply to the use of track number tags as part of a file name. Magnus is due back tomorrow, so in a day or so I will be shown to be right or wrong. At least there isn't anything ELSE I can be! Cyril PS -- I really need a spelling checker her. I've been accused of orthographobia. Posted by: Zardoz on July 28 2006,04:55 I think I understand this a little better, but I'm still having a problem. The 'only' thing that I want to save from the original file name is the 'Disk #' (a single character) and the 'Track #' (a zero filled 2 character field). As such, I could do this in two passes by first renaming the file to JUST the newly constructed 3 character track # (they'd be guaranteed unique). I could then do a 2nd pass to use the already defined tag in the title field to rename them to ### - title.mp3. I did not need the zero padding as you suggested, but my newly modified template still has an error I don't understand. Here it is: <TRASH>(Disk <TrackNr-1>)_<TrackNr-2>_<TRASH>.mp3 Suggestions here? I thank you for looking at my issue. I can see this is a very powerful tool! Z Posted by: Magnus Brading on July 28 2006,12:28 I think there might be some confusion as to what you want to accomplish here Zardoz. Please give a full example with a real file name (not "aaaa" etc, but an actual existing file name) and the exact value you want the tracknumber field to have after the operation. If you want to do anything else than modifying the tracknumber field of the tag (like e.g. modify the name of the file, or any other tag field than TrackNr, please enter the complete existing and desired values for these). I will then help you. And thanks for the help as usual calberga. ![]() Posted by: calberga on July 28 2006,14:25 If I may horn in again -- I'm hard to stop once I start! I think that this is still what I would call a "catagory error". As I tried to say (not completely successfully) the use of tokens (<TrackNr>, etc.) from the tag-from-filename/rename-from-tags group of operations in the direct-rename panel leads to trouble. There should be (as seems to be) no reasonable meaning for the <name-#[prefix|suffix]> form here, other than, possably, with # = 1, and even this (if allowed) is unneeded. Remember, you are NOT dealing with tags here, you are simply giving temporary names to sub-strings of the old files name, and then concatanating those with literals to construct a new files name. I will repeat my advice -- ONLY use the <Custom#> tokens here! In your example you are treating two fields as part of the "Track number", but they are not, even though they have that meaning to you or others reading the filename. They are simply two substrings in the old filename, nothing more. Since the values of these substrings are simply to become parts of a new string there is no way for the program to know where to put them, as (dare I say?) sub-substrings. If some parts of the file name corresponded to your home town's name you would not fall into this error, since there is no <HomeTown> tag. I must confess that I only realized this after using the program of some time. I would use tag-naming tokens for arbitrary parts of the old file name (opus numbers for example) and then have to remember what <Album> actually stood for when building the new filename template. I would be nice if one could write <Temp-Opus-Number> or the like (<Temp-Disc-Number> and <Temp-Track-Number> in your case), but I can see the programming logic of having a fixed set of tokens, and am thankful that Magnus has provided us with <Custom1> through <Custom5> -- at least I've never need more than five up until now! This way the index to the value locations (probably an array, but I don't know C(+(+)) programming -- I'm an old (72 this year) assembler language programmer myself) is static, and one doesn't have to keep updating it on each operation. I don't think that I've missed the point here, that you want to combine data from the old filename with data from the tags in creating the new filename. As I've said, to the best of my knowledge this cannot be done in a single operation (assuming that the title is currently not part of the old filename -- hence Magnus's request for an actual instance of such a file name, rather than a schematic). Cyril the busy-body Posted by: Magnus Brading on July 28 2006,15:23 I agree that the mnenomics can be unnecessarily confusing, they should only be used when they are helpful in creating the template. As far as I can see though, Zardoz isn't using the direct file rename tool at all (neither should he, to accomplish what he inquires about in his original post in this thread). Rather, the auto tag tool (followed by a sweep with the auto tag tool) is/should be used. It is still not 100% clear though, which is why I asked for more details before putting together a solution. Through the years, I've come to learn that knowing the problem is often a good prerequisite to solving it. ![]() Posted by: calberga on July 28 2006,16:00 If you look at the original question, he is refering to two templates, an input template and an output template. From that I infered that he is using the direct rename operation, as the auto-tag has only a single template. The confusion is all due to the conflation of meaningful (to him) substrings in the filename with tags. When he says that he wishes "to modify one field" he is refering to part of the file name, not the tag. Again, a catagory error. In fact, he is not simply modifying one field" he is tossing away great chunks of the file name (55 characters at the beginning alone). Until an actual, living, breathing filename shows up it is impossible to know if this can be done in one pass by direct rename, as we don't know if, or where, the old filename contains the title. Cyril Posted by: Zardoz on July 28 2006,17:06 Wow! I wonder how excited you two would get if I wasn't posting a newbie question! ![]() Ok, here goes. I have been trying to use the Direct Rename Files function, as Calberga surmised. My goal is twofold. First, I want to construct a new Tag Number field from the information in the existing file name. Here is an actual example: Blind Willie McTell_The Classic Years 1927 - 1940 (Disc 1)_01_Writin' Paper Blues.mp3 The other existing ID3 tags are already set properly, and I see no need to try to replace any of them with data from the file name except for the track number tag. Once the Tag number field has the newly gleaned content, I intend to rename the files to be just <TrackNr> - <Title>.mp3 I see Calberga's point of how I am confused of how to go about doing this. The Help for Parsing Tempplates example seemed to imply that I could manipulate the TrackNr through the advance template, but I guess I was trying to hurdle more than one thing at a time. I would be fine with not renaming the original file name at all initially and just extracting and constructing the new TrackNr from the two parts in the file name, 'DiskNr' & TrackNr. Once the new 3 digit TrackNr was in place, renaming the file will be a snap. I guess that I should be using the 'Auto tag (from filename)' function, right? In that case, I would venture a guess that my Advanced Mode template might still look similar to Calberga's suggestion: <TRASH>(Disk <TrackNr-1[|]>)_<TrackNr-2[0|]>_<TRASH>.mp3 However, when I try that in preview mode, all that I get is 00 in every TrackNr field, so that can't be the way. If I need to use <Custom1> and <Custom2> variables to pull the information from the file name, how then do I concatenate the two custom fields and insert them into the TrackNr field? Thanks again for putting up with this newbie's ignorant ramblings, both of you! Z Posted by: calberga on July 28 2006,17:40 Okay, lets take this from the top. First problem, why are you getting 00 for the track numbers. In my experience this usually means that the template has picked up something non-numeric. Have you run this on a directory containing ONLY files with names matching your example? For one thing, in your example you have "Disc", while in the template I had (mistakenly) written "Disk". This alone would explain the result. Sorry about that! Now to the underlying problem. Two solutions, each with two steps, which can be wrapped in a macro. 1) a) Direct rename: <TRASH>(Disc <Custom1>)_<Custom2>_<Custom3>.mp3 mapped to <Custom1><Custom2> - <Custom3>.mp3 b) followed by auto-tag from file name <TrackNr> - <TRASH>.mp3 2) a) Auto-tag from file name <TRASH>(Disc <TrackNr-1[|]>)_<TrackNr-2[|]>_<TRASH>.mp3 b) Rename from tags <TrackNr> - <Title> I think these are correct, but be sure to proofread them, I am not immune to lapsus digiti, to coin a (probably bad) Latin phrase. Cyril Posted by: Zardoz on July 28 2006,18:04 Cyril, I didn't notice the letter transpose either, so it was equally my fault. replacing the 'k' with 'c' in the Direct Rename Files function yielded the right result with this for the 'Expected file name format': <TRASH>(Disc <Custom1>)_<Custom2>_<TRASH>.mp3 and then this for the 'Output file name format':<Custom1><Custom2>.mp3 This yielded every file to be just the new desired track number, which I then imported into the TrackNr field with the Auto Tage (from filename) function. Then I was able to rename all the files again with Auto Rename (from tags) to get the desired result. I do appreciate your time and input. Thank you. Z Posted by: calberga on July 28 2006,19:04 No problem, I've gotten lots of help here myself. You probably noticed me asking pretty dumb questions in the last couple of days! "How do I get a new line?" "Use the new line key!" I have used the program for a while, and so I've made most of the errors one can make, and I fortunate in being able to remember them. Also, I'm a touch-typist, so I can natter on at a great rate. (And, as you've probably noticed, I'm pretty opinonated! ![]() Cyril PS, and I can't spell English, which is the only language I know! Posted by: Magnus Brading on July 29 2006,11:55 Hehe, as usual, a big thanks to everyone who helps other users around here, calberga in particular. ![]() end |