Welcome Guest

Pages: 1
[Solved] Action with for loop to extract genres?
PowderPostDecember 15, 2013, 06:52
Pro
Posts: 116
Registered:
March 4, 2013, 18:53
Normal topic[Solved] Action with for loop to extract genres?

Hi,

I would like to create symlinks for every genre to my release folder.

After Discgos-tagging the tags look like this:

Genre: Electronic, Rock, Pop
Mood: Downtempo, Abstract

Now I would like to loop through all of the Genres and Moods and create symlinks like this:

By_Genre/Electronic/Link_to_my_release_folder --> ../../my_release
By_Genre/Rock/Link_to_my_release_folder --> ../../my_release
By_Genre/Pop/Link_to_my_release_folder --> ../../my_release
By_Genre/Downtempo/Link_to_my_release_folder --> ../../my_release
By_Genre/Abstract/Link_to_my_release_folder --> ../../my_release

Whatโ€™s the best way to do the loop and handle empty fields as well?

GuestPostDecember 15, 2013, 09:49
Guest
Posts: 1
Registered:
Never
Normal topicRe: Action with for loop to extract genres?

I've been avoiding looping constructs like the plague ๐Ÿ™‚ Not because they're difficult to do, but because the support possibilities scare the hell out of me.

If you unfold the loop and have successive blocks of code or calls to routines it is possible now. (Yah I know it's pretty distasteful).

Copy Genre to Variable 1
if exists Variable 1
Copy Variable 1 to Variable 2
Find ',' in Variable 2 and remove it and everything after
Trim Variable 2
Find ', 'in Variable 1 and remove it and everything before
Trim Variable 1
# this assumes you never have ',,'
if exists variable 2
# do your work base on variable 2
end if

# duplicate the code (Variable 1 has the remainder of the list)
endif

Yuck!

Maybe something like the following:

For Each variable from field delimited by d run action

In your case:

For Each Variable 1 from Genre delimited by ',' run Create_Genre_Sym_Links1

Variable 1 would contain the non empty genre when Create_Genre_Sym_Links is called.

If multiple files were selected, the effective list would be the merge of the individual lists. The function would be case insensitive (optional?). Empty items would be ignored. A snapshot of the field would be taken at the start of execution. ie. changing the genre field would not affect the looping.

This will be somewhat simpler to support than a generic looping construct as the execution profile would always be finite.

This also has the advantage that you could use it to access individual elements when using multiple items as opposed to delimited items. You would simply use the multiple item delimiter. ';;;' or even better '\m'.

What do you think?

2MR2PostDecember 15, 2013, 19:18
Avatar photo
Administrator
Posts: 2083
Registered:
August 23, 2012, 19:27
Normal topicRe: Action with for loop to extract genres?

Actually I love this idea. I've implemented:

Repeat With variable in Field field {Case Insensitive} delimiter delim Run {Grouped} action

Test build in a day or two. ๐Ÿ™‚

PowderPostDecember 17, 2013, 15:26
Pro
Posts: 116
Registered:
March 4, 2013, 18:53
Normal topicRe: Action with for loop to extract genres?

Wohoo ๐Ÿ™‚

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.02 seconds.