
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
This script allows you to convert the audio format of the tracks in the playlist. The script takes a snapshot of the current playlist. Once the conversion has started, you can go back to using amaroK normally.
Supported files for both input and output include .flac, .ogg, .mp3, .mpc, .m4a, and .wav. Additionally, .wma, .ra, and are supported for input. (See below for the required packages.)
I don't know how to do anything with metatags from .wma or .ra. All I know is tags will get transferred to the output file if and only if the tags show up in the amaroK playlist. If they aren't there, I suggest converting the files, then using a real tag editor like Easy Tag to put them in to the converted files.
This has only been tested on amaroK 1.2.4, but it should work on any amaroK>=1.2
The original files are NOT deleted. If the output file will overwrite an existing file, a dialog will appear to ask you whether to go ahead and overwrite or to skip the track. If you try to convert a file into the format it's already in, a dialog will ask you how to handle this situation.
Depending on the number of tracks and the speed of your computer, this can take a long time to run. With each track, a passive popup will let you know what track it's processing. At any time, you can stop the script by clicking 'stop' in the amaroK script GUI.
Required Packages:
lame -- for .mp3 in and out
flac -- for .flac in and out
oggenc -- for .ogg out
oggdec -- for .ogg in
mppenc -- for .mpc out
mppdec -- for .mpc in
mplayler -- for .wma or .ra in
faad -- for .mp4/.m4a in
faac -- for .m4a out
13 years ago
v 0.7.0
++++++
The improvements in this release are due to Frederick Schaer, and I (we) thank him for his help!
The improvements are: 1) It now should handle full utf-8 character encoding for all the usual tags. 2) It corrects the error noted in the comments below about IndexError/AttributeError--something which I believe only affects more recent versions of Python.
v.6.2
++++++
For myriad reasons, a file can fail to convert but the script will continue on with the next file (as intended--I don't want one corrupted file to stop a 1,000 file batch). There is now an error log in the top-level directory where your transcoded files are saved that lists any files that failed to convert.
v.6.1
++++++
--amaroK switched the track number xml tag in their playlist from "TrackNo" to "Track". This catches up with the change, but should still work on versions earlier than 1.3.
v.6
++++++
--Fixed a piping bug that could cause the script to stop after a couple of files.
--Added a check for whether the output format is the same as the input format, with a dialog for how to handle this situation.
--Added a few more included options for encoders (OTHER still allows you to set your own options.)
13 years ago
v 0.7.0
++++++
The improvements in this release are due to Frederick Schaer, and I (we) thank him for his help!
The improvements are: 1) It now should handle full utf-8 character encoding for all the usual tags. 2) It corrects the error noted in the comments below about IndexError/AttributeError--something which I believe only affects more recent versions of Python.
v.6.2
++++++
For myriad reasons, a file can fail to convert but the script will continue on with the next file (as intended--I don't want one corrupted file to stop a 1,000 file batch). There is now an error log in the top-level directory where your transcoded files are saved that lists any files that failed to convert.
v.6.1
++++++
--amaroK switched the track number xml tag in their playlist from "TrackNo" to "Track". This catches up with the change, but should still work on versions earlier than 1.3.
v.6
++++++
--Fixed a piping bug that could cause the script to stop after a couple of files.
--Added a check for whether the output format is the same as the input format, with a dialog for how to handle this situation.
--Added a few more included options for encoders (OTHER still allows you to set your own options.)
diogorg
13 years ago
I look the script, and found the line that show the options, and for me I increment the options to 4 and 5. But, do you have any ideia to use the OTHER option?
The script is amazing, nice job.
And thank you.
Report
s4ik0
13 years ago
probably something is missing (i'm not using KDE...):
sh: kdialog: command not found
sh: kdialog: command not found
sh: kdialog: command not found
sh: kdialog: command not found
Traceback (most recent call last):
File "/home/.../.kde/share/apps/amarok/scripts/formatconverter0.7.0.amarokscript/formatconverter0.7.0.py", line 286, in <module>
outputFormat, destination, fileNameConven, error_log = configure(inPacks, outPacks)
File "/home/.../.kde/share/apps/amarok/scripts/formatconverter0.7.0.amarokscript/formatconverter0.7.0.py", line 56, in configure
fileNameConven = int(os.popen("kdialog --menu \"Please select the naming convention for your files.\" \"1\" \"[base directory]/trackno_title.[ext]\" \"2\" \"[base directory]/Artist/Album/trackno_title.[ext]\" \"3\" \"[base directory]/artist_album_trackno_title.[ext]\" ").readline()[:-1])
ValueError: invalid literal for int() with base 10: ''
Report
TGM
13 years ago
Report
bugmenot1234
11 years ago
Worked with Ubuntu 8.10 !!!!
Report
s4ik0
13 years ago
probably something is missing (i'm not using KDE...):
sh: kdialog: command not found
sh: kdialog: command not found
sh: kdialog: command not found
sh: kdialog: command not found
Traceback (most recent call last):
File "/home/.../.kde/share/apps/amarok/scripts/formatconverter0.7.0.amarokscript/formatconverter0.7.0.py", line 286, in <module>
outputFormat, destination, fileNameConven, error_log = configure(inPacks, outPacks)
File "/home/.../.kde/share/apps/amarok/scripts/formatconverter0.7.0.amarokscript/formatconverter0.7.0.py", line 56, in configure
fileNameConven = int(os.popen("kdialog --menu \"Please select the naming convention for your files.\" \"1\" \"[base directory]/trackno_title.[ext]\" \"2\" \"[base directory]/Artist/Album/trackno_title.[ext]\" \"3\" \"[base directory]/artist_album_trackno_title.[ext]\" ").readline()[:-1])
ValueError: invalid literal for int() with base 10: ''
Report
gzu
13 years ago
Thanks,
GZU
Report
moxie
13 years ago
Report
rominet777
14 years ago
I also had problems while trying to encode files : it was because of 2 things :
- empty tags (like comments)
- non englich chars (accentuated french chars)
I just created a patch to hopefully handle that (for me at least, it works...)
I don't see how to link a file, please send me a p.m (I'll try to send the patch to the author anyway...)
-Cheers
Report
striscio
14 years ago
I have similar problems converting songs...
Report
soulrebel
14 years ago
that would be great!
thanks alot for your work!
Report
beloncio
14 years ago
mp3 -> wav
File "/home/beloncio/.kde/share/apps/amarok/scripts/formatconverter.amarokscript/formatconverter.py", line 111, in getMetaInfo
exec getInfo[i]
File "", line 1, in ?
AttributeError: 'NoneType' object has no attribute 'nodeValue'
Why?
Thanks
Report
frufo
14 years ago
for i in range(len(getInfo)):
try:
exec getInfo[i]
except IndexError:
pass
except AttributeError:
pass
return title, artist, album, year, comment, track, genre
Report
mrnegitoro
15 years ago
It would be neat if it could somehow pass the files through normalize ( http://www1.cs.columbia.edu/~cvaill/normalize/ ) as well.
Report
mrnegitoro
15 years ago
It would be neat if it could somehow pass the files through normalize ( http://www1.cs.columbia.edu/~cvaill/normalize/ ) as well.
Report
doudou78
15 years ago
i try to convert ogg files in mp3. i really need to do it !!
please can you help me
Report
mlmitton
15 years ago
Report
Zargoon
15 years ago
Report
xeper
15 years ago
Error message is:
Traceback (most recent call last):
File "/srv/shares/home/cord/.kde/share/apps/amarok/scripts/formatconverter.amarokscript/formatconverter.py", line 273, in ?
mainEncodeLoop(outputFormat, destination, fileNameConven, dom_plist, options, checkOverwrite, checkInEqOut, transSkip, neverOver, FIELDS, INPUT, error_log)
File "/srv/shares/home/cord/.kde/share/apps/amarok/scripts/formatconverter.amarokscript/formatconverter.py", line 255, in mainEncodeLoop
doTranscode(infoPopup, decodeCommand, encodeCommand, rmWavCommand, transSkip)
File "/srv/shares/home/cord/.kde/share/apps/amarok/scripts/formatconverter.amarokscript/formatconverter.py", line 198, in doTranscode
os.system(infoPopup)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xbf' in position 95: ordinal not in range(128)
Report
mlmitton
15 years ago
Report
bdillahu
15 years ago
".encode( "utf-8" ) on each variable where the script complained... thus it went from:
error.write(outputFileName + "\n")
to:
error.write(outputFileName.encode( "utf-8" ) + "\n")
I had to change lines: 198, 200 and 264
I still have the problem that it creates the temp.wav file but I don't get the mp3 file (going from flac to mp3).
Report
capntripz
15 years ago
Report
mlmitton
15 years ago
So give it a try, and let me know. If it works, I'll include it in the release itself.
As for SHN, I actually have never heard of it before. Always been a FLAC man myself.
Report
yggdrasil
15 years ago
The error-log says
The error log for Audio Format Converter script for amaorK
/home/user/01_Track.mp3
The musepac-decoder mppdec is installed.Any hints?
Report
mlmitton
15 years ago
Oh, this might be overly pedantic, just remember to have amaroK open, with some MPC files in the playlist before you run the script from console.
Also, make sure that the first panel of the script indicates that you have the package required to decode MPC.
Report
kramg
15 years ago
What Genres will the script recognize?
Report