add bitrate information

This commit is contained in:
Vincent Riquer 2013-03-14 13:10:48 +01:00
parent 0aa8a04ab0
commit 64603d856f
2 changed files with 33 additions and 21 deletions

53
atom
View File

@ -18,6 +18,7 @@ declare -A \
destinationformat \
destinationfrequency \
destinationid \
destinationmaxbps \
destinationnormalize \
destinationpath \
destinationquality \
@ -706,12 +707,13 @@ gettag() {
| sed -n "/^${1}=/I{s/^${1}=//I;p}"
}
getInfosMP3_version='ID3-0.2'
getInfosMP3_version='ID3-0.3'
tagreaders+=( "$getInfosMP3_version" )
getInfos::MP3() {
tagreader="$getInfosMP3_version"
infos=$(
soxi -a "$sourcepath/$filename" 2>/dev/null
soxi "$sourcepath/$filename" 2>/dev/null \
| sed 's/ *: /=/'
)
album=$(gettag album)
artist=$(gettag artist)
@ -724,10 +726,15 @@ getInfos::MP3() {
then
genre="${id3genres[$genre]}"
fi
getRateChannelSoxi
infos="${infos//: /=}"
channels=$(gettag channels)
rate=$(gettag 'sample rate')
bitrate=$(gettag 'bit rate')
bitrate=${bitrate%%.*}
bitrate=${bitrate%k}
}
getInfosOgg_version='Ogg-O.1'
getInfosOgg_version='Ogg-O.2'
tagreaders+=( "$getInfosOgg_version" )
getInfos::Ogg() {
tagreader="$getInfosOgg_version"
@ -751,8 +758,10 @@ getInfos::Ogg() {
fi
year=$(gettag date)
infos="${infos//: /=}"
rate=$(gettag rate)
channels=$(gettag channels)
rate=$(gettag rate|head -n1)
channels=$(gettag channels|head -n1)
bitrate=$(gettag 'nominal bitrate')
bitrate=${bitrate%%,*}
}
getInfosFLAC_version='FLAC-0.1'
@ -1123,21 +1132,22 @@ do
fi
if getTags
then
Update tags \
album "$album" \
albumartist "$albumartist" \
artist "$artist" \
composer "$composer" \
disc "$disc" \
genre "$genre" \
performer "$performer" \
title "$title" \
track "$tracknum" \
year "$year" \
last_change "$lastchange" \
rate "$rate" \
channels "$channels" \
tagreader "$tagreader" \
Update tags \
album "${album:-NULL}" \
albumartist "${albumartist:-NULL}" \
artist "${artist:-NULL}" \
composer "${composer:-NULL}" \
disc "${disc:-NULL}" \
genre "${genre:-NULL}" \
performer "${performer:-NULL}" \
title "${title:-NULL}" \
track "${tracknum:-NULL}" \
year "${year:-NULL}" \
last_change "$lastchange" \
rate "${rate:-NULL}" \
channels "${channels:-NULL}" \
bitrate "${bitrate:-NULL}" \
tagreader "$tagreader" \
>/dev/null <<<"source_file = $sourcefileid"
unset genre \
albumartist \
@ -1150,6 +1160,7 @@ do
composer \
performer \
rate \
bitrate \
channels
fi
done

View File

@ -52,6 +52,7 @@ CREATE TABLE tags (
performer TEXT,
rate INTEGER,
channels INTEGER,
bitrate INTEGER,
last_change FLOAT,
tagreader TEXT,
FOREIGN KEY (source_file) REFERENCES source_files(id)