You are not logged in.
You have been more than generous with your help. I should (and will) retire to "lurking".
I just got so excited that it worked!!! And works as long as I don't run into unpadded tracks (... 9, 10, 11). I thought using "Name Digits" column for sorting would fix that, but if more than one folder no luck usually.
Last night I tested for mp3 case flexibility, and changed to:
if (WideExtractFileExt(FileName) = '.mp3') or
(WideExtractFileExt(FileName) = '.Mp3') or
(WideExtractFileExt(FileName) = '.MP3') then
Not elegant, but functioned. I have since made the good corrections you suggested. Thanks again. I truly appreciate the warning. I had created some empty mp3 files last night for rename testing, and had a case change in some extensions within a folder, things would have gotten messed up. Your help links to regexpstudio and delphibasics are great resources. And I installed a compiler.
In answer to your question as to why I used "Serialize Duplicates". I do not know how to get the serialize "rule" to operate only on mp3 files, and not the txt and jpg files located in the same folders. Also, I want to serialize by folder, not by tree, but process all folders in a tree. I have 3854 files in 256 folders in this instance.
I created two test directories today: "AudioBooks(UnPaddedNumbers)" and "AudioBooks(PaddedNumbers)" and archived them with updated ".rnp preset" file. The archive is 66K in size, located here if curious. http://scottfromboulder.home.comcast.ne … olders.zip
The two test cases may show the importance of "natural sort order" in some cases. Since ReNamer sorts by "all files in the directory tree", and not "files in each folder independently" sort by "NameDigits" may fail in these cases. In my case (which may be unique), "natural sort" would fix things.
If I pad all mp3 file names that have a single digit in the BaseName. That would resolve the sort order.
Update: "Pad to 2 digits" for all audio book tracks, using RegExp.
This takes care of the sorting problem of numbers of different widths.
Now studiying "Free Pascal" compiler with tutorials. Since I use "Macro Express" extensively, some "WinBatch", and a little "iMacros for FireFox" for routine stuff, I'll probably only use Pascal for ReNamer. I need coffee.
Fathom
sorry so verbose
Last edited by Fathom (2007-05-27 06:25)
Offline
Good news!
I was playing with the natural sorting algorithms, and eventually wrote one for ReNamer! Get latest development version, and try it out: ReNamerBeta.zip. Find "Use natural order sorting algorithm" option in the Settings, and that should make your task easier. Tell me how it goes, ok?
In answer to your question as to why I used "Serialize Duplicates". I do not know how to get the serialize "rule" to operate only on mp3 files, and not the txt and jpg files located in the same folders. Also, I want to serialize by folder, not by tree, but process all folders in a tree. I have 3854 files in 256 folders in this instance.
I'm not entirely sure about this one. So you want to: serialize only mp3 files, where each folder will have its own index? You shouldn't use the "Serialize duplicates" script, because it is meant for a different thing. If you confirm the details, I can write another script for that...
Offline
Your Natural sorting implementation worked wonderfully
Tested using directory containing 950 files in 79 folders with every possible track numbering scheme imaginable. I ran my preset "mp3 file track renaming and standardization" without one mis-numbered track
Serialize duplicates did cause a problem! With my preset, one audio book (of the 79) used "different names" (ie. chapter titles) for each track.
You shouldn't use the "Serialize duplicates" script, because it is meant for a different thing.
I used it because I didn't know enough to create my own that advanced (still don't). Cut and paste I can do.
I might have it if I refocus it on more than one mp3 extension (ie, duplicate extensions) rather than
I adapted a "Serialize duplicates" from a post you made (somewhere), because it operated on a 'by folder' basis.
I made several other simple changes, like the FileName := ... and to do only serialize mp3 file duplicates
I can write another script for that...
You have been very generous with your time and knowledge. I thought I had what I was going for. Today I realized you are right about using "duplicates". I have folders that contain mp3, txt, and jpg files. I need to serialize the mp3 files 'in each folder' (on a 'by folder' basis). I am having trouble understanding and usage of functions Add(), Exists(), etc that seem unique to ReNamer.
Thanks,
Fathom
Last edited by Fathom (2007-05-28 11:37)
Offline
So now you have only one problem left, the so called "serialize duplicates" or "track numbers" problem - is that right?
Do you sort your files by their original full path? So all files from the same folder are grouped together and are ordered by their TRACK NUMBER, correct? If so, then I will have no problem in writing a script that will process files one by one, serialize all mp3's, and reset index when the folder has changed (but files from the same folder must be grouped together). Will that work for you?
Offline
Yes, the one problem left is the track numbers.
All the files can be sorted by their full path. Folders that contain mp3 files with different names are prefixed with the track number.
All the mp3 files are grouped together. Txt and jpg may be above, below, or both, but the mp3 files are contiguous [touching or connected in an unbroken sequence] if that is what you are asking.
Thanks, I'm pulling my hair out here.
Fathom
Offline
Folders that contain mp3 files with different names are prefixed with the track number.
What do you mean? How/why would folders be prefixed with the track numbers???
If I take a bunch of grouped together mp3's, and insert 01, 02, 03, ... NN in front of them - would that correspond to their track numbers? I assumed the original fullpath sorting would ensure that, wouldn't?
By the way, it would be a hell a lot easier if those mp3's would have ID3 track number tags!
Last edited by den4b (2007-05-28 16:31)
Offline
Sorry, Ive been up all night.
I mean the files in the folders are prefixed with track numbers. Not the folders.
Yes, and yes to the other two questions.
Fathom
Last edited by Fathom (2007-05-28 16:34)
Offline
I think you should sleep a bit... And when you wake up, I should have that script ready for you
Offline
Thanks,
I listen to audio books to keep my mind off pain. I have a disease where pain signals are turned on to full intensity, all the time. I take morphine, percocet every four hours (and others as well) but they barely make a dent in the pain, just in my ability to think.
I download the books from libraries. The drm license expires in so many days, depending on the library. I re-record the books to remove the drm, but loose the id3 tags.
Too much pain to read, write, design, I can barely talk. I sleep once every three days for maybe 8 hours, no sdistraction from pain in bed. The books are the only help from pain. My focus is so bad I can re-read books and not remember having read them a month earlier.
Thanks, I will try for sleep, its been a few days,
Fathom
Offline
Shit... is it fixable? I mean.. are you going to get better?
Below is the code and the screenshot of it working, it should do the trick.
var
Initialized: Boolean;
LastFolder: WideString;
Folder, Ext: WideString;
Index: Integer;
function PadNum(const Num, NewLength: Integer): string;
begin
Result := IntToStr(Num);
while Length(Result) < NewLength do
Result := '0'+Result;
end;
begin
if not Initialized then
begin
Index := 1;
Initialized := True;
end;
Ext := WideExtractFileExt(FileName);
if not WideSameText('.MP3', Ext) then Exit;
Folder := WideExtractFileDir(FilePath);
if not WideSameText(Folder, LastFolder) then Index := 1;
FileName := PadNum(Index, 2) + ' ' + FileName;
LastFolder := Folder;
Index := Index + 1;
end.
Offline