Short story:
Is there a way of copying the contents of parentheses to a field if they contain certain text without using GUESS VALUES?
Long story:
I have embarked on a project of converting a couple of thousand ZX Spectrum “tzx” tape files to FLAC so they can be played into a real machine, and so far so good on that. The problem is the erratic naming of them, which I feel an urge to tidy up, trim and standardise. Move the things I want into certain tag fields - Title, Year, Label (as Artist), Comment, Model - then restructure the file name as:
- Title (?demo) (Year) (Label) (?Model) (?Comment e.g. if re-release or magazine covertape) (?Tape number/side)
GUESS VALUES only gets me so far, as only the first three items are guaranteed to be in the right place in the filenames as generated. E.g.:
- Atic Atac (1983) (Ultimate Play The Game).flac
…Is easy. Others with more junk in them are more difficult, and some may have keepers that others don’t, so there will be variable numbers of () and there may be junk parentheses before useful ones, or not:
- Addams Family, The (Demo) (1992) (Ocean) (128K) (Side A) (Your Sinclair Covertape) [a]
…Is less easy. At the beginning of files like this, I can replace (Demo) with {Demo} so it doesn’t get in the way of GUESS VALUE, then change it back in TITLE - I would rather something more elegant but it’s okay. Some can be identified and removed early in the process by REPLACE, e.g. protection methods like:
- Bubble Bobble (1987) (Elite) (Speedlock).flac
…as there aren’t many, and I can name them explicitly for removal at the beginning of the process.
There are quite a few with:
-
(Tape 1 of 2)
-
(Tape 2 of 2 Side B) etc
GUESS VALUE seems to work here using:
- %dummy% (Tape %tapeno%
Unfortunately, getting:
-
(48K-128K)
-
(128K)
-
(16K)
…into a MODEL field is troublesome. I can modify these in the filename to (model 24K-128K), (model 128K) etc to make them easier to find; however, GUESS VALUES has trouble with this, maybe there is too much other noise in brackets. I would also like to put instances of “re-release” or e.g. “Crash Covertape” into %COMMENT%.
I have been using ChatGPT to solve problems with mixed success, but if it doesn’t get it right first time, it goes around in very small circles for an alternative.
The solution that has come closest is:
-
FORMAT VALUE
-
TAPENO
-
$regexp(%_FILENAME%,'.*\[(Tape [^]]*)\].*',$1)
…This will populate the TAPENO field if the filename contains e.g. (Tape 1 Side A), with “1 Side A”, which I can work with. However, when there IS no (Tape ***) in the filename, the entire filename crosses into TAPENO and I haven’t the know-how to debug it, I can only kind of see what’s going on. Neither can ChatGPT, it just gives the same solution over and over.
Thanks for reading all this!