---
description: Mp3Tag things...
tags: Mp3Tag, dark
---
{%hackmd @ViafaSia/H18RVTzeK %}
# Ordering thing on Discnumber and Track
[TOC]
## Issue about ordering
When we are editing those tags/metadata of music files, we might have some chance to meet an album with 2 or more CDs/Discs. But what's the bother?

Here is a simple example. You may notice that the order of songs isn't I expected. What I want is simply put the numbers in order ascended or decended.

And if I really want to make this happen, I will have to click the title of the column of Discnumber, and let it re-order for me. Does it look good now? Almost
There is still a fly in the ointment, which is, when I make it with decreasing order, the column of Track is still using the ascending order, and of course, it's uncontrollable.
## Convert Tag to Filename

Okey, troublemaker (I meant myself), what do you want then ?
Here is the one method I noticed from others' idea, name Filenames as `Discnumber.Track` this kind of format.

And how do I achieve that?
Most people (included me) who wanted to rename the Filename, would probably use the following script, which is demonstrated in the official website.
```bash=2 !
$num(%track%,2). %title%
```
And here is my script. I simply use `$if()`, to make this script workable in the both situation.
> `$if(x,y,z)`
> if x is true, y is returned, otherwise z.
> [color=#ff9800] [name=Mp3tag Documentation]
```bash=3 !
$if($num(%discnumber%), $num(%discnumber%,).$num(%track%,2). %title%, $num(%track%,2). %title%)
```
Now you may use the built-in Convert function to remane the Filename.

## What if I don't want to touch Filename :weary:
What now? \*\&\%\^\&\%\#\$
OK, nevrmind. Lets work from Mp3Tag side, but the idea is the same.
Right-Click the column title and get into `Customize Columns...`.
Let's simply add a new column with combine Discnumber and Track. Our script is going to key-in into Value, because the thing we only wanted to do is ordering, As for Field, it is unnecessory at this moment, since we are not actually going to edit it via this section.

Feel free to add some random text, if you wish, like this.
```bash=4 !
Disc %discnumber%, Track $num(%track%,2)
```

Or even you may add `if()` into script!
```bash=5 !
$if(%discnumber%, %discnumber%, - ), $num(%track%,2)
```

Fin. :D
## ref
[Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting/)
[File List – Mp3tag Documentation](https://docs.mp3tag.de/customization/file-list/)
## Thanks
just a note, not sure if this may help any people.
Maybe one day I could make a collection of Mp3Tag things, and make it into Book Mode on HackMD...
-- Sia, 2023 Jan 10