# Discnumber Action

**URL:** https://community.mp3tag.de/t/discnumber-action/5793
**Category:** Support
**Created:** [November 25, 2007, 11:22am UTC](https://community.mp3tag.de/t/discnumber-action/5793 "2007-11-25T11:22:01Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![mville](https://community.mp3tag.de/user_avatar/community.mp3tag.de/mville/32/9437_2.png) [@mville](https://community.mp3tag.de/u/mville)
#### Post date: [November 25, 2007, 11:22am UTC](https://community.mp3tag.de/t/discnumber-action/5793/1 "2007-11-25T11:22:01Z")

</div>

I want to populate the Discnumber tag from a string in the directory name.

e.g.

If directory = 'Greatest Hits' then Discnumber = 01  
If directory = 'Greatest Hits CD1' then Discnumber = 01  
If directory = 'Greatest Hits CD2' then Discnumber = 02  
If directory = 'Greatest Hits CD3' then Discnumber = 03

etc.

I think I need to use an Action, probably Format Value but I'm not sure what to enter in the Format String field.

Please can anyone help?

Ta

mville

---

<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: [November 25, 2007, 1:42pm UTC](https://community.mp3tag.de/t/discnumber-action/5793/2 "2007-11-25T13:42:46Z")

</div>

Did you do a search for "discnumber" here in the forum?  
If so, you should get many results, which can help you to learn how to solve your problem.

Especially this thread seems to be a good starting point:  
[Generating %DISCNUMBER% Tags](https://community.mp3tag.de/t/4117/1)

DD.20071125.1542.CET

---

<div class="post-metadata">

### Author: ![mville](https://community.mp3tag.de/user_avatar/community.mp3tag.de/mville/32/9437_2.png) [@mville](https://community.mp3tag.de/u/mville)
#### Post date: [November 26, 2007, 10:11am UTC](https://community.mp3tag.de/t/discnumber-action/5793/3 "2007-11-26T10:11:33Z")

</div>

> [@DetlevD](#):
>
> Did you do a search for "discnumber" here in the forum?

Yes, I did search the forums but with little understanding of the scripting functions I could not get a neat solution.

I will endeavour to crack the the $if and $regexp functions and post if a get a result.

Thanks

mville

---

<div class="post-metadata">

### Author: ![mville](https://community.mp3tag.de/user_avatar/community.mp3tag.de/mville/32/9437_2.png) [@mville](https://community.mp3tag.de/u/mville)
#### Post date: [November 26, 2007, 11:00am UTC](https://community.mp3tag.de/t/discnumber-action/5793/4 "2007-11-26T11:00:53Z")

</div>

I have the answer

(please note this will only work where the directory name contains CD_n_ where _n_ = 1 thru 9)

$ifgreater($strstr(%\_directory%,'CD'),0,$num($mid(%\_directory%,$add($strstr(%\_directory%,'CD'),2),1),2),01)

Please let me know if there are errors with this.

---

<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: [November 26, 2007, 3:59pm UTC](https://community.mp3tag.de/t/discnumber-action/5793/5 "2007-11-26T15:59:11Z")

</div>

> [@mville](#):
>
> I have the answer  
> (please note this will only work where the directory name contains CD_n_ where _n_ = 1 thru 9)  
> $ifgreater($strstr(%\_directory%,'CD'),0,$num($mid(%\_directory%,$add($strstr(%\_directory%,' CD'),2),1),2),01)  
> Please let me know if there are errors with this.

Right, this looks good to me.  
You can make it a little bit more 'safe' by respecting the space character in the $strstr() functions.  
$ifgreater($strstr(%\_directory%,' CD'),0,$num($mid(%\_directory%,$add($strstr(%\_directory%,' CD'),3),1),2),01)

Try to understand how $regexp() works. A regular expressions e. g. can find a string fragment at end of the string, or e. g. can isolate only numbers at end of a string, and can help to solve so much more other problems you can think of.

**$num($if($eql($regexp(%\_directory%,'^.\* CD(\d\*)$','$1'),%\_directory%),1,$regexp(%\_directory%,'^.\* CD(\d\*)$','$1')),2)**

DD.20071126.1759

---

<div class="post-metadata">

### Author: ![wobbly](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/b782af/32.png) [@wobbly](https://community.mp3tag.de/u/wobbly)
#### Post date: [January 9, 2019, 4:03am UTC](https://community.mp3tag.de/t/discnumber-action/5793/6 "2019-01-09T04:03:51Z")

</div>

ok iam wondering if Mp3tag has a better way to write discnunber tag automatically yet based on folder name CD1 CD2 CD3 so you end up with 1/3 2/3 3/3

and yes i have searched looking for the answer for 2 days now with no joy

a lot of the stuff i found is over ten years old iam hoping things are better now

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 9, 2019, 6:00am UTC](https://community.mp3tag.de/t/discnumber-action/5793/7 "2019-01-09T06:00:01Z")

</div>

There is no function to detect and number discs.  
You have to create your own actions or simply set the value by hand or import the data from the folder (if it can be found there).  
When you look at your data: what criteria does it supply to find out with which disc one would be dealing at the moment?

---

<div class="post-metadata">

### Author: ![wobbly](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/b782af/32.png) [@wobbly](https://community.mp3tag.de/u/wobbly)
#### Post date: [January 9, 2019, 6:52am UTC](https://community.mp3tag.de/t/discnumber-action/5793/8 "2019-01-09T06:52:02Z")

</div>

will this is the best so far as an action  
format value DISCNUMBER$ifgreater($strstr(%\_directory%,'CD'),0,$num($mid(%\_directory%,$add($strstr(%\_directory%,'CD'),2),1),2),01)

and i get DISCNUMBER 01 02 03  
02 03  
better would be DISCNUMBER 1 2 3  
best would be DISCNUMBER 1/3 2/3 3/3

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 9, 2019, 6:56am UTC](https://community.mp3tag.de/t/discnumber-action/5793/9 "2019-01-09T06:56:56Z")

</div>

An action of the type "Guess value" may be shorter:  
Source: %\_directory%  
Format string: %dummy%CD%discnumber%  
then add another action to the action group:

Format value for DISCNUMBER  
Format string: $num(%discnumber%,1)  
this should remove all leading zeros.

---

<div class="post-metadata">

### Author: ![wobbly](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/b782af/32.png) [@wobbly](https://community.mp3tag.de/u/wobbly)
#### Post date: [January 9, 2019, 7:17am UTC](https://community.mp3tag.de/t/discnumber-action/5793/10 "2019-01-09T07:17:50Z")

</div>

now all i get is [SYNTAX ERROR IN FORMATTING STRING]

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 9, 2019, 7:21am UTC](https://community.mp3tag.de/t/discnumber-action/5793/11 "2019-01-09T07:21:35Z")

</div>

Sorry:  
Format string: $num(%discnumber%,1)  
should work

---

<div class="post-metadata">

### Author: ![wobbly](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/b782af/32.png) [@wobbly](https://community.mp3tag.de/u/wobbly)
#### Post date: [January 9, 2019, 7:28am UTC](https://community.mp3tag.de/t/discnumber-action/5793/12 "2019-01-09T07:28:28Z")

</div>

ok cool that worked now get

discnumber 1 2 3

that all do for now

can we get discnumber 1/3 2/3 3/3 yet ?

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 9, 2019, 7:31am UTC](https://community.mp3tag.de/t/discnumber-action/5793/13 "2019-01-09T07:31:31Z")

</div>

Only manually.  
Or with an action of the type "Format value" where you have to set the total manually.  
Or with the function Convert\>Tag-Tag  
In both cases use  
Field DISCNUMBER  
Format string: %discnumber%/3  
(and replace "3" with the correct total number)  
The Convert function may be easier to use than to edit the action.

---

<div class="post-metadata">

### Author: ![wobbly](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/b782af/32.png) [@wobbly](https://community.mp3tag.de/u/wobbly)
#### Post date: [January 9, 2019, 7:33am UTC](https://community.mp3tag.de/t/discnumber-action/5793/14 "2019-01-09T07:33:20Z")

</div>

an action where you have to set the total manually. would be fine

---

<div class="post-metadata">

### Author: ![wobbly](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/b782af/32.png) [@wobbly](https://community.mp3tag.de/u/wobbly)
#### Post date: [January 9, 2019, 7:34am UTC](https://community.mp3tag.de/t/discnumber-action/5793/15 "2019-01-09T07:34:58Z")

</div>

i will see if my music program likes discnumber 1 2 3

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 9, 2019, 7:35am UTC](https://community.mp3tag.de/t/discnumber-action/5793/16 "2019-01-09T07:35:17Z")

</div>

You could create a set of action, each for a different total - I think the totals of 2, 3 and 4 would be used most frequently.

---

<div class="post-metadata">

### Author: ![wobbly](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/b782af/32.png) [@wobbly](https://community.mp3tag.de/u/wobbly)
#### Post date: [January 9, 2019, 7:38am UTC](https://community.mp3tag.de/t/discnumber-action/5793/17 "2019-01-09T07:38:02Z")

</div>

can we not tell mp3tag to count the number of folders ?

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 9, 2019, 7:46am UTC](https://community.mp3tag.de/t/discnumber-action/5793/18 "2019-01-09T07:46:01Z")

</div>

Show me how.  
MP3tag only looks at the current file and does not know anything about previous or coming files (and their folders).  
As repeated a number of times: there is (currently) no special function for discnumbers.

---

<div class="post-metadata">

### Author: ![wobbly](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/b782af/32.png) [@wobbly](https://community.mp3tag.de/u/wobbly)
#### Post date: [January 9, 2019, 7:55am UTC](https://community.mp3tag.de/t/discnumber-action/5793/19 "2019-01-09T07:55:06Z")

</div>

ok can we have an input box to ender a string in an action ? enter total number of disks say 11 disks then mp3tag would know set discnumber as 1/11 2/11 3/11 and so on

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 9, 2019, 8:00am UTC](https://community.mp3tag.de/t/discnumber-action/5793/20 "2019-01-09T08:00:53Z")

</div>

This feature is currently not available.  
Here is a thread from 2007 about this topic:

> [@Can I create an action that takes input from the user?](https://community.mp3tag.de/t/can-i-create-an-action-that-takes-input-from-the-user/5345):
>
> I want to write a simple action that simply appends some text to an ID3 tag. I would like to be able to have this action query me for the string to append as opposed to having to modify the action every time I want to change the string to append. Is there any way to do this? Thank you!

An action is called for every file. So if there were such a feature you would have to enter that data umpteen times, once for each file.  
I think the Convert\>Tag-Tag function is much better in this case.

[Next page](https://community.mp3tag.de/t/discnumber-action/5793.md?page=2)
