web-dev-qa-db-fra.com

Conversion des noms de fichiers m4a

Salut tout le monde en espérant pouvoir trouver une réponse à ma question liée à la musique. Je suis passé de PC à Ubuntu et j'avais déjà exécuté iTunes.

J'ai beaucoup de musique pour laquelle j'ai les CD mais je les ai chargés un par un dans le système.

Le problème est que bien que les fichiers existent toujours, ils ont été nommés quelque chose d'inutile comme "AVHB", "GCDF" ou autre. Je peux lire les fichiers dans Rhythmbox et sur mon Android et le nom correct apparaît, mais le nom FILE n'est pas un descripteur accuarte du fichier.

Donc, ma question est: comment créer un script avec python ou quoi que ce soit pour exécuter ces fichiers via le CODEC et renommer correctement les fichiers? Les joueurs ont les conversions que je ne semble pas être capable de sauter l'écart.

Merci!

3
Dustin

Vous pouvez utiliser id3ren qui est un renommeur de fichier ID3Tag. L'application est dans les référentiels, elle peut donc être facilement installée. Cela devrait également fonctionner avec .m4a des dossiers.

Sudo apt-get install id3ren

Pour l'utiliser, accédez au dossier où se trouve votre musique, de préférence dans un dossier réel où vous avez de la musique que vous souhaitez renommer. Ensuite, vous pouvez renommer à l'aide d'un modèle proposé par id3ren. Les options de modèle sont les suivantes:

   -template=TEMPLATE
          Use TEMPLATE as the basis for renaming files.  The default tem‐
          plate used is '[%a]-[%s].mp3'.  Identifiers that can be used in
          the template are:
            %a  - Artist name
            %c  - Comment
            %s  - Song name
            %t  - Album title
            %n  - Track Number
            %y  - Year
            %g  - Genre

En utilisant un répertoire de mon système que je connais mal nommé, nous pouvons voir les fichiers avant d'exécuter id3ren sur les fichiers:

$ ls -l *.mp3
-rwxrwxrwx 1 root root 3851479 Jul 10 20:31 01 - Track 1.mp3
-rwxrwxrwx 1 root root 3726796 Jul 10 20:31 02 - Track 2.mp3
-rwxrwxrwx 1 root root 5001982 Jul 10 20:31 03 - Track 3.mp3
-rwxrwxrwx 1 root root 3111721 Jul 10 20:32 04 - Track 4.mp3
-rwxrwxrwx 1 root root 4680892 Jul 10 20:32 05 - Track 5.mp3
-rwxrwxrwx 1 root root 4504918 Jul 10 20:32 06 - Track 6.mp3
-rwxrwxrwx 1 root root 5135839 Jul 10 20:32 07 - Track 7.mp3
-rwxrwxrwx 1 root root 5397715 Jul 10 20:32 08 - Track 8.mp3
-rwxrwxrwx 1 root root 3229732 Jul 10 20:32 09 - Track 9.mp3
-rwxrwxrwx 1 root root 3760156 Jul 10 20:32 10 - Track 10.mp3

Maintenant, exécutez id3ren sur le dossier avec les options de modèle pour Track Number - Song Name.mp3 en utilisant tout mp3 des dossiers (*.mp3) dans ce dossier:

$ id3ren -template='%n - %s.mp3' *.mp3
01 - Track 1.mp3                       => 01 - Your Song.mp3                   
02 - Track 2.mp3                       => 02 - Daniel.mp3                      
03 - Track 3.mp3                       => 03 - Honky Cat.mp3                   
04 - Track 4.mp3                       => 04 - Goodbye Yellow Brick Road.mp3   
05 - Track 5.mp3                       => 05 - Saturday Nights Alright.mp3     
06 - Track 6.mp3                       => 06 - Rocket Man.mp3                  
07 - Track 7.mp3                       => 07 - Benny and the Jets.mp3          
08 - Track 8.mp3                       => 08 - Dont Let the Sun Go Down on Me.mp3
09 - Track 9.mp3                       => 09 - Border Song.mp3                 
10 - Track 10.mp3                      => 10 - Crocodile Rock.mp3              
Processed: 10  Failed: 0  Total: 10

Comme nous pouvons le voir maintenant, le dossier a vu les fichiers renommés pour correspondre à l'ID3Tag contenu dans le .mp3 fichier lui-même:

$ ls -l *.mp3
-rwxrwxrwx 1 root root 3851479 Oct 24 15:39 01 - Your Song.mp3
-rwxrwxrwx 1 root root 3726796 Oct 24 15:39 02 - Daniel.mp3
-rwxrwxrwx 1 root root 5001982 Oct 24 15:39 03 - Honky Cat.mp3
-rwxrwxrwx 1 root root 3111721 Oct 24 15:39 04 - Goodbye Yellow Brick Road.mp3
-rwxrwxrwx 1 root root 4680892 Oct 24 15:39 05 - Saturday Nights Alright.mp3
-rwxrwxrwx 1 root root 4504918 Oct 24 15:39 06 - Rocket Man.mp3
-rwxrwxrwx 1 root root 5135839 Oct 24 15:39 07 - Benny and the Jets.mp3
-rwxrwxrwx 1 root root 5397715 Oct 24 15:39 08 - Dont Let the Sun Go Down on Me.mp3
-rwxrwxrwx 1 root root 3229732 Oct 24 15:39 09 - Border Song.mp3
-rwxrwxrwx 1 root root 3760156 Oct 24 15:39 10 - Crocodile Rock.mp3

EDIT: Exécuté également avec le nom de l'artiste pour renommer le lot. Cela fonctionne tant que la balise Artist est correcte dans la balise ID3:

Ceci avec [artiste] - [piste] - [nom]

$ id3ren -template='%a - %n - %s.mp3' *.mp3
01 - Your Song.mp3                     => Elton John - 01 - Your Song.mp3      
02 - Daniel.mp3                        => Elton John - 02 - Daniel.mp3         
03 - Honky Cat.mp3                     => Elton John - 03 - Honky Cat.mp3      
04 - Goodbye Yellow Brick Road.mp3     => Elton John - 04 - Goodbye Yellow Brick Road.mp3
05 - Saturday Nights Alright.mp3       => Elton John - 05 - Saturday Nights Alright.mp3
06 - Rocket Man.mp3                    => Elton John - 06 - Rocket Man.mp3     
07 - Benny and the Jets.mp3            => Elton John - 07 - Benny and the Jets.mp3
08 - Dont Let the Sun Go Down on Me.mp3 => Elton John - 08 - Dont Let the Sun Go Down on Me.mp3
09 - Border Song.mp3                   => Elton John - 09 - Border Song.mp3    
10 - Crocodile Rock.mp3                => Elton John - 10 - Crocodile Rock.mp3 
Processed: 10  Failed: 0  Total: 10

Ceci avec [piste] - [artiste] - [nom]

$ id3ren -template='%n - %a - %s.mp3' *.mp3
Elton John - 01 - Your Song.mp3        => 01 - Elton John - Your Song.mp3      
Elton John - 02 - Daniel.mp3           => 02 - Elton John - Daniel.mp3         
Elton John - 03 - Honky Cat.mp3        => 03 - Elton John - Honky Cat.mp3      
Elton John - 04 - Goodbye Yellow Brick Road.mp3 => 04 - Elton John - Goodbye Yellow Brick Road.mp3
Elton John - 05 - Saturday Nights Alright.mp3 => 05 - Elton John - Saturday Nights Alright.mp3
Elton John - 06 - Rocket Man.mp3       => 06 - Elton John - Rocket Man.mp3     
Elton John - 07 - Benny and the Jets.mp3 => 07 - Elton John - Benny and the Jets.mp3
Elton John - 08 - Dont Let the Sun Go Down on Me.mp3 => 08 - Elton John - Dont Let the Sun Go Down on Me.mp3
Elton John - 09 - Border Song.mp3      => 09 - Elton John - Border Song.mp3    
Elton John - 10 - Crocodile Rock.mp3   => 10 - Elton John - Crocodile Rock.mp3 
Processed: 10  Failed: 0  Total: 10

J'espère que cela t'aides!

4
Terrance

L'application Gnome EasyTAG , entre autres fonctionnalités, fournit une interface graphique qui permet de renommer en bloc les fichiers musicaux à partir des métadonnées, y compris les fichiers .m4a, en utilisant des modèles de modèle.

Bulk renamer screenshot

Par exemple, le modèle %n - %a - %t renommerait les fichiers en:

[track number] - [artist] - [title].[extension]

Vous pouvez comparer en toute sécurité les effets de différents modèles avant de vous engager à renommer les fichiers. Plus d'aide sur cette fonctionnalité est fournie avec l'application et est également disponible ici .

Vous pouvez installer EasyTAG à partir de la ligne de commande en tapant:

Sudo apt-get install easytag
1
Martin Thornton