# Help with scripting export configuration

**URL:** https://community.mp3tag.de/t/help-with-scripting-export-configuration/15821
**Category:** General Discussion
**Created:** [June 18, 2014, 8:24pm UTC](https://community.mp3tag.de/t/help-with-scripting-export-configuration/15821 "2014-06-18T20:24:46Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![aax](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@aax](https://community.mp3tag.de/u/aax)
#### Post date: [June 18, 2014, 8:24pm UTC](https://community.mp3tag.de/t/help-with-scripting-export-configuration/15821/1 "2014-06-18T20:24:46Z")

</div>

I'm trying to make a few export configs for backing up my tags. Since I tag MP3s and FLACs differently, I'll be making two backup .txt files for every album, one in FLAC and one in MP3 format.

Now, I'm trying to figure out how to export MP3's %track% and %discnumber% tags in format #/# to %track% & %tracktotal% and %discnumber% & %disctotal%.

Any ideas?

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [June 19, 2014, 3:30am UTC](https://community.mp3tag.de/t/help-with-scripting-export-configuration/15821/2 "2014-06-19T03:30:16Z")

</div>

> [@aax](#):
>
> ... I'm trying to figure out how to export MP3's %track% and %discnumber% tags in format #/# to %track% & %tracktotal% and %discnumber% & %disctotal%. Any ideas?

**TRACK \<== '02/05' $regexp(%TRACK%,'^(\d+)/(\d+)$','$1') ==\> '02' $regexp(%TRACK%,'^(\d+)/(\d+)$','$2') ==\> '05' $regexp(%TRACK%,'^0\*(\d+)/0\*(\d+)$','$1') ==\> '2' $regexp(%TRACK%,'^0\*(\d+)/0\*(\d+)$','$2') ==\> '5'**

DD.20140619.0730.CEST

... or ...

**$trimRight($trimRight(%TRACK%,'0123456789'),'/')==\> '02' $trimLeft($trimLeft(%TRACK%,'0123456789'),'/')==\> '05' $trimLeft($trimRight($trimRight(%TRACK%,'0123456789'),'/'),'0')==\> '2' $trimLeft($trimLeft($trimLeft(%TRACK%,'0123456789'),'/'),'0')==\> '5' $trimLeft($trimLeft(%TRACK%,'0123456789'),'/0')==\> '5' $num($trimRight($trimRight(%TRACK%,'0123456789'),'/'),1)==\> '2' $num($trimLeft($trimLeft(%TRACK%,'0123456789'),'/'),1)==\> '5'**

DD.20140620.0732.CEST

---

<div class="post-metadata">

### Author: ![aax](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@aax](https://community.mp3tag.de/u/aax)
#### Post date: [June 19, 2014, 11:48am UTC](https://community.mp3tag.de/t/help-with-scripting-export-configuration/15821/3 "2014-06-19T11:48:06Z")

</div>

Thanks, that worked.

---

<div class="post-metadata">

### Author: ![aax](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@aax](https://community.mp3tag.de/u/aax)
#### Post date: [June 19, 2014, 2:26pm UTC](https://community.mp3tag.de/t/help-with-scripting-export-configuration/15821/4 "2014-06-19T14:26:25Z")

</div>

One more thing – tricky, again, because of MP3's "#/#" format in %discnumber%. Would it be possible to automatically add "(Disc #)" to name of exported file if there is more than 1 disc?

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [June 19, 2014, 4:17pm UTC](https://community.mp3tag.de/t/help-with-scripting-export-configuration/15821/5 "2014-06-19T16:17:43Z")

</div>

> [@aax](#):
>
> ... add "(Disc #)" to name of exported file if there is more than 1 disc?

**$ifgreater($num(%DISCNUMBER%,1),1,' (Disc '$num(%DISCNUMBER%,1)')',)**

DD.20140619.2019.CEST

... or ...

**$ifgreater($num($trimLeft($trimLeft(%DISCNUMBER%,'0123456789'),'/'),1),1,' (Disc '$num($trimRight($trimRight(%DISCNUMBER%,'0123456789'),'/'),1)')',)**

DD.20140620.0708.CEST

---

<div class="post-metadata">

### Author: ![aax](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@aax](https://community.mp3tag.de/u/aax)
#### Post date: [June 19, 2014, 5:32pm UTC](https://community.mp3tag.de/t/help-with-scripting-export-configuration/15821/6 "2014-06-19T17:32:44Z")

</div>

That only looks at the part before the slash in #/#, so it doesn't check total number of discs.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [June 19, 2014, 7:23pm UTC](https://community.mp3tag.de/t/help-with-scripting-export-configuration/15821/7 "2014-06-19T19:23:20Z")

</div>

Maybe I did not understand the problem?  
Are you able to you rephrase what is and what is wanted?

DD.20140619.2323.CEST

---

<div class="post-metadata">

### Author: ![aax](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@aax](https://community.mp3tag.de/u/aax)
#### Post date: [June 19, 2014, 7:50pm UTC](https://community.mp3tag.de/t/help-with-scripting-export-configuration/15821/8 "2014-06-19T19:50:36Z")

</div>

I want to add "(Disc #)" to the name of the exported file if the album I'm exporting has more than 1 disc. For example "Tag backup - Album (Disc 2).txt".

This is pretty easy to do with FLAC because it keeps disc number and disc total in separate tags. For example:  
Tag backup - %album%$ifgreater(%disctotal%,1, (Disc %discnumber%),).txt

But MP3 stores disc info in a single %discnumber% tag, in the format **x/y** , where **x** is current disc, and **y** is total number of discs.

So, I first have to check if **y** is greater than 1, and if it is, add " (Disc **x** )" to the filename.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [June 20, 2014, 2:58am UTC](https://community.mp3tag.de/t/help-with-scripting-export-configuration/15821/9 "2014-06-20T02:58:24Z")

</div>

> [@aax](#):
>
> I want to add "(Disc #)" to the name of the exported file if the album I'm exporting has more than 1 disc. For example "Tag backup - Album (Disc 2).txt". ... MP3 stores disc info in a single %discnumber% tag, in the format **x/y** , where **x** is current disc, and **y** is total number of discs. So, I first have to check if **y** is greater than 1, and if it is, add " (Disc **x** )" to the filename.

You can check the first value **x** , and for this case you got a fitting format string.

DD.20140620.0658.CEST

---

<div class="post-metadata">

### Author: ![aax](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@aax](https://community.mp3tag.de/u/aax)
#### Post date: [June 20, 2014, 6:32am UTC](https://community.mp3tag.de/t/help-with-scripting-export-configuration/15821/10 "2014-06-20T06:32:31Z")

</div>

You mean **y**? (x/y)

I noticed that you added another string to your previous post,  
$ifgreater($num($trimLeft($trimLeft(%DISCNUMBER%,'0123456789'),'/'),1),1,' (Disc '$num($trimRight($trimRight(%DISCNUMBER%,'0123456789'),'/'),1)')',)

which does get **y** , and is exactly what I needed.  
Thanks.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [June 20, 2014, 8:21am UTC](https://community.mp3tag.de/t/help-with-scripting-export-configuration/15821/11 "2014-06-20T08:21:54Z")

</div>

> [@aax](#):
>
> You mean **y**? (x/y)

It does not matter what value you take for the requested purpose.  
I used the first value **x**.

> [@aax](#):
>
> I noticed that you added another string to your previous post ...

If you like the long formatstring, then use it, but the short formatstring delivers the same result.

DD.20140620.1221.CEST
