Moving part of TITLE to GENRE

Thank you very much for this code and it's upgrade

I tested it, on real cases, and I could notice only one issue



##01  ##02  ##90

instead of

##01  ##02  ##90  ##99

Apparently because it:
1] sees the marker "##"
2] reads "99"
3] continues to read to the next marker [?]
4] compares read value with the list
5] cuts out than long [merged] characters

The hypothetical "SOMETHING-NOT-ON-THE-LIST" should not be there in the first place [and is most probably to be get rid off in this process of cleaning]. But, as proven by this example, it would be better, if the code would look for a marker and then read from its beginning to the last character adjacent to it [somewhat in "as a whole word" way]. Because it is batter to loose only "SOMETHING-NOT-ON-THE-LIST" and "##SOMETHING-NOT-ON-THE-LIST" than a "##listed_number" + "SOMETHING-NOT-ON-THE-LIST"

[And if you're wondering why there are word with numbers and not just numbers, it's because I have to be absolutely sure what words I want to code with numbers. Because one I'll start using numbers, any future change would bring a lot of potential errors coming out from the changed and re-changed codes and difficulty in re-memorizing. Right now I use only some umbers from the range of 1-10 and 50-99, and after dealing with 20% of my files I need to do cleaning / evaluation]

On the other note: there is an visual issue with a too long list

... you have to make sure, that the LIST_SORT text string offers the basic set of elements, ...
i. e. the list of all possible items, in the order of your desire.
The regular expressions in the algorithm can only work with items, remove items, return items, ...
which have been defined a priori.

You may try this modification, whether it works better for you or not ...


I understand the base on which this code is build

And also that system of mine requires the existence of a marker, so theoretically this should not be an issue at all

But it would be better if the code [in aforementioned example] would show that "##99"; because it I will most likely spot "SOMETHING-NOT-ON-THE-LIST" [as not beginning with "##"] and the removal of ##SOMETHING-NOT-ON-THE-LIST is most likely not to occur at all [and if it occurs then I will probably miss it]

And to achieve that, aside from making an impossible list containing all possible combinations / errors, I would additionally need to [before running the main code]:
cut every character [except pause], that is not in a string that begins with sign "#"

This would simply serve as a workaround / fails safe. Because


would stay [and be cut out in next action], and the


would be cut out. [And as I explained above, the difference for me comes to the probability of occurring]

Can you provide me please with this additional code?

Do you want a process, which runs prior to the already known sort process?
Hmm, the following expression should deliver all items, ...
which are member of the input list, but not member of the basic list of sorted items.



The input list to work on ...
LIST_IN <== 'BAD1|111|101|01|09|WATER|WATERFALL|BAD2|04|VILLAGE|06|UNDERWATER|03|10|11|BAD3'
Note: The bad values are 'BAD1','BAD2','BAD3' ... and should be removed.

The basic sorted list of allowed items ...
LIST_SORT <== '01|02|03|04|05|06|07|08|09|10|11|101|111|UNDERWATER|VILLAGE|WATER|WATERFALL'

Get all items from LIST_IN, which are not member of LIST_SORT ...
LIST_TMP1 <== $regexp($regexp($regexp(%LIST_IN%,'(?>\b('%LIST_SORT%')\b)',),'\|+','|'),'^\||\|$',)


Remove all items from LIST_IN, which are member of LIST_TMP1 ...
LIST_TMP2 <== $regexp($regexp($regexp(%LIST_IN%,'(?>\b('%LIST_TMP1%')\b)',),'\|+','|'),'^\||\|$',)


Get all items from LIST_SORT, which are not member of LIST_TMP2 ...
LIST_TMP3 <== $regexp($regexp($regexp(%LIST_SORT%,'(?>\b('%LIST_TMP2%')\b)',),'\|+','|'),'^\||\|$',)

LIST_TMP3 = 02|05|07|08

Remove all items from LIST_SORT, which are member of LIST_TMP3, so get the sorted list output ...
LIST_OUT <== $regexp($regexp($regexp(%LIST_SORT%,'(?>\b('%LIST_TMP3%')\b)',),'\|+','|'),'^\||\|$',)


Remove tag-fields LIST_TMP1, LIST_TMP2, LIST_TMP3, LIST_SORT, LIST_IN ...
LIST_TMP1 <== $char(0)
LIST_TMP2 <== $char(0)
LIST_TMP3 <== $char(0)
LIST_SORT <== $char(0)
LIST_IN <== $char(0)

Test2015_20150701.zerow.sort.mta (1.14 KB)
DD.20150701.1006.CEST, DD.20150701.1532.CEST

Test2015_20150701.zerow.sort.mta (1.14 KB)


It should be step 0 in this already established and tested action group

QUOTE (zerow @ Jun 24 2015, 23:51) <{POST_SNAPBACK}>

Here is

my action group: 1] Guess values %GENRE%: ##%GENRE%
2] Replace "GENRE": "##" -> |

3] Replace "GENRE": "  " -> ""

4] Format value "GENRE_ORDER": '00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|2 5|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|TRIBAL
| UNDERWATER|VILLAGE|WASTELAND|WATER|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|
7 5|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|9X'

5] Format value "GENRE": $regexp($regexp($regexp(%GENRE_ORDER%,$regexp(%GENRE_ORDER%,'(?>('%GENRE%'))',),),'\|+','|'),'\|$',)

6] Replace "GENRE": "|" -> "  ##"

7] Format value "GENRE": $trim(%GENRE%)

8] Format value "GENRE": ##%GENRE% It works if run it on a GENRE tag that has values in format     ##00  ##00  ##AAAAAAA  ##00  ##BBB [two hastags + two digit number or predifined capitalized word + two pauses]


If I use it on


in place of step 5, it delivers


If I use it between step 4 and 5, it delivers empty field

I think it would be easier and safer for me, knowing the kind of mistakes I can possibly make in this system of mine, if I would just cut out at the very begining all


and leave all


which wiould also automatically leave all the

See example there ...
Moving part of TITLE to GENRE


The provided example leaves me with empty LIST_IN; first it singles out errors [unwanted stuff not on the LIST_SORT] and then it cuts them out [leaving blank space]. What about all the stuff [listed on LIST_SORT] that should be left in LIST_IN. How is that suppose to happen???

I'm telling you, it will be safer for my system, if I could [before establishing LIST_SORT] cut out from LIST_IN strings of from any kind of characters not beginning with "#"

See new example there ...
Moving part of TITLE to GENRE


I am that stupid or this just gives out me every time


in the LIST_OUT, no matter what value was in the LIST_IN

But I've also came up with a workaround solution, without creating so many additional tag fields:

Replace "GENRE": " " -> "##"

Replace "GENRE": "####" -> |

Replace "GENRE": "##" -> |

Replace "GENRE": " " -> ""

Replace "GENRE": "\+|" -> "|"

Replace "GENRE": "|ACTION" -> "|11"
Replace "GENRE": "|TRIBAL" -> "|38"
Replace "GENRE": "|UNDERWATER" -> "|39"
Replace "GENRE": "|VILLAGE" -> "|41"
Replace "GENRE": "|WASTELAND" -> "|42"
Replace "GENRE": "|WATER" -> "|43"

Replace "GENRE": "|" -> "|0"

Guess values %GENRE%: |%GENRE%

Format value "GENRE_ORDER": '000|001|002|003|004|005|006|007|008|009|010|011|012|013|014|015|016|017|018|

Format value "GENRE": $regexp($regexp($regexp(%GENRE_ORDER%,$regexp(%GENRE_ORDER%,'(?>\b('%GENRE%')\b)',),),'\|+','|'),'\|$',)

Replace "GENRE": "011" -> "ACTION"
Replace "GENRE": "038" -> ""TRIBAL"
Replace "GENRE": "039" -> "UNDERWATER"
Replace "GENRE": "041" -> "VILLAGE"
Replace "GENRE": "042" -> "WASTELAND"
Replace "GENRE": "043" -> "WATER"

Replace "GENRE": "|" -> "  ##"

Format value "GENRE": $trim(%GENRE%)

Format value "GENRE": ##%GENRE%

Replace "GENRE": "##0" -> "##"

Replace "GENRE": "##" -> "" (only as a whole word)

Replace "GENRE": "####" -> "##"

Format value "GENRE_ORDER": $char(0)

At first I seemed that all I had to do with my previous version [while having already the data in aforementioned format "##00 ##00 ##ABCABCABC ##00", with the addition of possible errors like "##SOMETHING-NOT-ON-THE-LIST ABCABCABC"] was to just add at the beginning a simple

Replace "GENRE": "  " -> "##
"Replace "GENRE": "####" -> "|"

and eventually change code words to code numbers- but then of course in further testing the WATER came at me with its full power

But now this whole process works even better than I intended; because:
A] If I have a semi-correct "WATER" [without the marker], during the whole process it will automatically become fully correct "##WATER" [with the marker]
B] There is no more UNDERWATER / WATER / WATERFALL issue [by the way; thank you for directing my attention to WATERFALL variation of this glitch]
C] It will be easier to apply changes to temporary digit codes and much more error proof [that why I used a separate entry for every word-to-number / number-to-word replacement, instead of $replace command with a long list

Plus aside from that one main crucial line, all of those actions are readable for me and not just some bunch of %(|'$,WTF?). And that will come in handy in the future if I decide to make some big change and will have to adjust. And of course the minus is having not only a GENRE_ORDER / LIST_SORT but also kind of manually repeating it two times

[And when I was designing this system I wanted to use only numbers. But as I've processed 20% of my files, I can see now that without this word descriptions I would not be so efficient in categorizing music for RPG purposes. For example I use "ACTION" as code for ACTION / CHASE / FIGHT, which further explains what kind of music should be in this group]

The proposed sample code ...
Moving part of TITLE to GENRE
... should always return the same result, because the sample code has no room for unexpected errors.
Your experience suggests that there is any error on your side, when you run the sample code.


I'm starting to see now, how I can use provided codes from your sample

But am I right thinking that this still does not deal with the issue of UNDERWATER / WATER / WATERFALL? nOr should I read them again and again, till it becomes clear to me

On my previous tests, depending if [not used by me ] WATERALL was listed on my GENRE_ORDER / LIST_SORT, I could be left with such results like


[And I've dealt with that with a long workaround]

You may apply the given sample mta actionsgroup against a dummy test file, ...
and use extended tag view to see what has happened.

You may remove the last step from the given sample actionsgroup, ...
which is the removing of tag-fields, ...
and run the test again, ...
and use extended tag view to see what has happened for each step.

The actionsgroup reflects the problem of the set theory ...


OK, I'll think about some more and eventually do some further tests

Thank you for all the info