opus tags

* differentiate Ogg Vorbis and Opus
* read Opus tags
This commit is contained in:
Vincent Riquer 2013-04-05 01:37:21 +02:00
parent 3fd3450875
commit eed0d035f2

48
atom
View File

@ -679,6 +679,17 @@ getFiles() {
EOWhere
then
mimetype=$(file -b --mime-type "$sourcepath/$filename")
if [[ $mimetype == application/ogg ]]
then
case "$(head -n1 "$sourcepath/$filename")" in
*'vorbis'*)
mimetype+=' vorbis'
;;
*'OpusHead'*)
mimetype+=' opus'
;;
esac
fi
mimetypeid=$(
InsertIfUnset mime_types <<-EOInsert
mime_text $mimetype
@ -837,6 +848,36 @@ getInfos::Ogg() {
bitrate=${bitrate%%,*}
}
getInfosOpus_version='Opus-1'
tagreaders+=( "$getInfosOpus_version" )
getInfos::Opus() {
tagreader="$getInfosOpus_version"
infos=$(
opusinfo "$sourcepath/$filename" \
| sed 's/\t//'
)
albumartist=$(gettag albumartist)
album=$(gettag album)
artist=$(gettag artist)
composer=$(gettag composer)
disc=$(gettag discnumber)
genre=$(gettag genre)
performer=$(gettag performer)
title=$(gettag title)
tracknum=$(gettag tracknumber)
tracktotal=$(gettag tracktotal)
if [ -n "$tracknum" -a -n "$tracktotal" ]
then
tracknum="$tracknum/$tracktotal"
fi
year=$(gettag date)
infos="${infos/: /=}"
rate=$(gettag 'original sample rate'|head -n1)
channels=$(gettag channels|head -n1)
bitrate=$(gettag 'average bitrate')
bitrate=${bitrate%%.*}
}
getInfosFLAC_version='FLAC-1'
tagreaders+=( "$getInfosFLAC_version" )
getInfos::FLAC() {
@ -943,7 +984,7 @@ tryAPE() {
&& type=APE
}
getTags_version='unknown-1'
getTags_version='unknown-2'
tagreaders+=( "$getTags_version" )
getTags() {
unset type
@ -951,7 +992,10 @@ getTags() {
audio/mpeg)
type=MP3
;;
application/ogg)
'application/ogg opus')
type=Opus
;;
application/ogg*)
type=Ogg
;;
audio/x-flac)