IPB

Welcome Guest ( Log In | Register )

> Notice!

Please take a minute to check our Frequently Asked Questions. Use Search to reveal possible related topics.

Also make sure you've read the Forum Guidelines before posting in this forum.

 
Reply to this topicStart new topic
> Problem with Actions and Regular Expressions, Split from 1204
midtempo
post Jul 29 2009, 09:05
Post #1


Member


Group: Members
Posts: 3
Joined: 29-July 09
Member No.: 10646
Mp3tag Version: 2.43



I wanted a solution to a simple problem. Many of my tracks have blank Album Artist tag, and I wanted to replace those tags with the Artist tag whenever it is blank (equal to "null string," "empty tag," etc.) I found this action quite difficult, much more difficult than it needs to be.

First of all, what the program calls "Album Artist" is really the "Band" ID3 tag. That took me a little while to figure out in and of itself. The "Album Artist" tag, if it exists, is irrelevant. Because the tag "Album Artist" has a space in it, can't even be referred to anyways!

After a ton of searching, head-scratching, researching, and trial-and-error, I finally came up with something that works. Unfortunately, MP3tag does not seem to have a way of directly representing the null string, but I came up with this expression that works:

Action type: Format Value
Field: BAND
Format string: $if($geql($len(%band%),1),%band%,%artist%)

The literal way to read this code is: If the length of "Band" tag is greater than or equal to one character, then the "Band" tag is equal to the "Band" tag, otherwise the "Band" tag is equal to the "Artist" tag.

The effect of this is: It will check all selected files and, if the "Band" tag (i.e. Album Artist) is blank, it will replace it with the "Artist" tag; otherwise it will leave it alone. If there is a more elegant code to solve this problem, please feel free to correct it.
Go to the top of the page
 
+Quote Post
DetlevD
post Jul 29 2009, 09:55
Post #2


Member


Group: Full Members
Posts: 4893
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.63



QUOTE (midtempo @ Jul 29 2009, 10:05) *
I wanted a solution to a simple problem. ... I found this action quite difficult, much more difficult than it needs to be. ... That took me a little while to figure out in and of itself. ... After a ton of searching, head-scratching, researching, and trial-and-error, I finally came up with something that works. ... If there is a more elegant code to solve this problem, please feel free to correct it.

1. Thank you for sharing your Mp3tag knowledge. That is the stuff from what Mp3tag is living.

2. Do not post into a pinned thread when your content does not fit to the theme of the thread, e. g. this thread "Replying to Regular Expressions" works on the area of regular expressions.
Because you have written about a solution using standard scripting functions, then use another area of the Mp3tag forum to publish this into the right context to reach your target people.

3. Regarding the tag field BAND and other tag field names in Mp3tag and their usage in other programs look there: http://help.mp3tag.de/en/main_tags.html

4. The scripting functions help says: $if2(x,y) if x is true, x is returned, otherwise y.
You can simplify your expression to: $if2(%BAND%,%ARTIST%).

5. Look there to find some interesting messages about BAND and ALBUM ARTIST and so on:
http://www.google.de/search?q=site:mp3tag....art=30&sa=N

6. Regarding your statement "Because the tag "Album Artist" has a space in it, can't even be referred to anyways!" I think this is not correct, but I do not know for sure.

7. You should proove your opinion of ARTIST and ALBUM ARTIST and BAND.
My opinion is .... an ARTIST is not the BAND (not in all cases).

Anyway, welcome to Mp3tag, and have good luck with your further investigations!

DD.20090729.1100.CEST

This post has been edited by DetlevD: Jul 29 2009, 10:00


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
midtempo
post Nov 8 2009, 19:18
Post #3


Member


Group: Members
Posts: 3
Joined: 29-July 09
Member No.: 10646
Mp3tag Version: 2.43



In reply to post #25 on Jul 29 2009, 04:55:

MP3tag is a customizable program whose advanced features are difficult to figure out whose help file which is also rather abstruse. These forums are also hard to figure out. I still don't know what the term "regular expression" means in the context of MP3tag. I still think it just means a scripting/coding expression used in MP3tag. I didn't even know about the existence of the "$If2()" command. These difficulties are coming from someone who has taken a few C++ coding classes in college and is highly computer literate, so I certainly do have some familiarity with computer coding.

Not only that, but us English-speaking folks have to wade through forums which may be in either English or in German. And vice-versa, of course. Sprechen Sie Deutsch? And yeah, I took German in high school as well, but I'll be damned if I can still read it today, especially casually.

What I'm trying to say is, a post in the wrong category is completely unsurprising given the complexity of the program's scripting functions and the poor user-friendliness of the help program (i.e. this site). I posted in the "Regular Expressions" thread on this forum because I used the "Replace with Regular Expression" action. It made sense to me to post here. But thank you for replying to my post and adding to it - I just think that posting something which is _nearly_ on topic should not deserve criticism.

QUOTE
7. You should proove your opinion of ARTIST and ALBUM ARTIST and BAND.
My opinion is .... an ARTIST is not the BAND (not in all cases).


No, "Band" and "Artist" are certainly not the same, however, if the "Band" tag is blank or not available, the next-best option is to set it to whatever the "Artist" tag is. Most of the time they are the same for most albums, so this is a good enough solution for me, at least when dealing with lots and lots of songs and albums. Whenever "Artist" and "Band" are not the same, they can be corrected manually.

This post has been edited by midtempo: Nov 8 2009, 19:40
Go to the top of the page
 
+Quote Post
Florian
post Nov 8 2009, 20:45
Post #4


Developer


Group: Admin
Posts: 7710
Joined: 12-December 01
From: Germany, Dresden
Member No.: 203
Mp3tag Version: 2.63



Split from Regular exp​ressions since these posts did not contribute to the topic's intent to collect some useful regular expressions.


--------------------
♫ If you like using Mp3tag please donate to support further development.

Go to the top of the page
 
+Quote Post
Florian
post Nov 8 2009, 20:56
Post #5


Developer


Group: Admin
Posts: 7710
Joined: 12-December 01
From: Germany, Dresden
Member No.: 203
Mp3tag Version: 2.63



QUOTE (midtempo @ Nov 8 2009, 19:18) *
I still don't know what the term "regular expression" means in the context of MP3tag.

Please read Regular Expression (or at least the overview part of it) if you want to learn something new. Regular Expressions is a language that finds patterns in strings and can be used for searching or -- as in Mp3tag -- for replacing matches by a given string.

QUOTE
Not only that, but us English-speaking folks have to wade through forums which may be in either English or in German. And vice-versa, of course.

There is a clear distinction between the German and the English written parts of the forum. If you don't like to see the German forum please use this link when navigating to the forums. Please also select International part when using the search function.

QUOTE
I just think that posting something which is _nearly_ on topic should not deserve criticism.

Detlev was not criticising you but provided a helpful welcome post pointing you in some interesting directions.

Kind regards,
Florian


--------------------
♫ If you like using Mp3tag please donate to support further development.

Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 30th August 2014 - 15:11