Bjr,
Pour une autre application que je suis en train de développer, j'utilise le très bon soft mutagen. J'ai donc récupéré qqles bouts de code et enveloppé le tout pour en faire un petit outil en ligne de commande.
Je vais surement faire par la suite un gui avec g2s et un script nautius.
Cette outils permet donc de copier, déplacer ou renommer des fichiers audio via leurs tags.
Il permet aussi d'extraire simplement les tags de fichiers dans une arborescence.
Dépendances: python-mutagen
sudo apt-get install python-mutagen
mvbytag.0.1.0: http://gwebradio2.googlecode.com/files/mvbytag.0.1.0.tar.gz
Décompresser l'archive et éxécuter mvbytag.py
Installable dans /bin pour utilisation en console.
(Désolé pour l'anglais approximatif qui suit ... D'ailleurs si un anglophone s'ennuie ...)
~$ mvbytag -h
VERSION: mvbytag 0.1.0
COPYRIGHT: LGPL V3 (2011)
SYNOPSIS:
Copy, move or rename audio files by their tags.
Audio file available: flac, ogg, mp3, mpc, wma
Dependance: python-mutagen
USAGE: mvbytag [options]
OPTIONS:
-h/ --help
Usage help
-n
Just output, don't act
-v
Verbose mode
--vvv
Output all metatags
--copy
Copy mode
--move
Move mode
--rename
Rename mode
--source <folder>
Folder to scan
--destination <folder>
The copy/move destination folder
--folders-pattern <PATTERN>
Create (sub)folders by PATTERN. (see end of help)
--files-pattern <PATTERN>
Rename files by PATTERN. (see end of help)
If %(title)s not in the pattern or title tag empty,
the original filename will be used.
--max-depth <int>
No recursivity by default. <int> between -1 to ... (-1 = all)
Don't use recursivity when copying/moving to a existing subfolder of
destination <folder> direction
Use it to extract or copy all audio files in a treepath to a other folder
or with --rename option.
--write <arg>
By default, if the destination file exists, the source will not be copied.
Use the argument over to overwrite or %s for numeric increment.
ex: ' ( %s ) ' will rename file 'filename ( 1 ) .mp3'
'_back%s' will rename file 'filename_back1.mp3'
PATTERN:
All metatags can be used with PATTERN.
Metatags: tracknumber, title, artist, album, year, length, ext,
genre, comment, name, fichier, bitrate
Exemples:
For files-pattern option: '%(artist)s - %(title)s'
For folders-pattern option : '%(artist)s/%(year)s/%(album)s'
EXEMPLES:
Create folders in current directory, move files and rename.
mvbytag -nv --source '/media/save' --files-pattern '%(artist)s-%(title)s' \
--folders-pattern '%(artist)s/%(album)s' --move
Rename files recursive.
mvbytag -nv --source '/media/save' --rename --max-depth -1 \
--files-pattern '%(artist)s - %(title)s'
Create folders in destination path and copy files.
mvbytag -nv --source '/media/save' --destination '/media/save2' \
--folders-pattern '%(artist)s/%(album)s' --copy
Get metatags.
mvbytag --vvv --source '/media/save'
Redirect logs
mvbytag -v --source '/media/save' ... 2>./error.log 1>./action.log
Mutagen est l'outil le plus performant que j'ai essayé, il est le seul à avoir réussi l'extraction sans erreur de mes fichiers audio. Il est capable de lire un grand nombre de formats, mon outils lui ce limite aux fichiers audio les plus courants.
Si vous êtes en possession de formats de fichiers non prient en charge par mon outil mais supportés par mutagen, vous seriez bien aimable de donner le retour de la commande
mutagen-inspect fichier pour que je l'ajoute à l'application.
Format supporté par mutagen: (extrait du README mutagen)
Mutagen is a Python module to handle audio metadata. It supports ASF,
FLAC, M4A, Monkey's Audio, MP3, Musepack, Ogg FLAC, Ogg Speex, Ogg
Theora, Ogg Vorbis, True Audio, WavPack and OptimFROG audio files. All
versions of ID3v2 are supported, and all standard ID3v2.4 frames are
parsed. It can read Xing headers to accurately calculate the bitrate
and length of MP3s.
Tout retour bienvenue !