История изменений
Исправление Kroz, (текущая версия) :
1. Дать скрипт, которые разбивает CUE на отдельные файлы и устраняет сам корень проблемы.
Давай, чо.
Держи, чо!
Всю работу делают последние две команды, остальное - обертка для удобства.
cuesplit.sh
#!/bin/sh
find \( -name "*.[aA][pP][eE]" -or -name "*.[fF][lL][aA][cC]" -or -name "*.[wW][vV]" \) -print | while read IMAGE ; do
CUETAG="/home/kroz/bin/cuetag.sh"
CUEBREAKPOINTS="/usr/bin/cuebreakpoints"
SHNSPLIT="/usr/bin/shnsplit"
P=`pwd`
DIR=`echo "${IMAGE%/*}"`
cd "$DIR"
echo
echo "====== Image"
echo -n "Current dir: "
pwd
AUDIO=`echo "${IMAGE##*/}"`
echo "Image file: '$AUDIO'"
AUDIO_NOEXT=`echo "${AUDIO%.[aA][pP][eE]}"`
AUDIO_NOEXT=`echo "${AUDIO_NOEXT%.[fF][lL][aA][cC]}"`
AUDIO_NOEXT=`echo "${AUDIO_NOEXT%.[wW][vV]}"`
if [ "$AUDIO" = "$AUDIO_NOEXT" ] ; then
echo "ERROR: Neither APE nor FLAC file: '$AUDIO'"
cd "$P"
break
fi
CUE=`find -name "$AUDIO_NOEXT.[cC][uU][eE]" -or -name "$AUDIO_NOEXT.[aA][pP][eE].[cC][uU][eE]" -or -name "$AUDIO_NOEXT.[fF][lL][aA][cC].[cC][uU][eE]" -or -name "$AUDIO_NOEXT.[wW][vV].[cC][uU][eE]"| head -n 1`
CUE=`echo "${CUE##*/}"`
if [ -z "$CUE" ] ; then
echo "CUE file does not exist"
cd "$P"
continue
fi
echo "CUE file: '$CUE'"
OLD=`find -maxdepth 1 -name "split-track*.flac" `
if [ ! -z "$OLD" ] ; then
#There are old tracks
OLDDIR="old."`date +%s`
echo "WARNING: Old tracks detected. Moving to directory '$OLDDIR'"
mkdir "$OLDDIR"
mv split-track*.flac $OLDDIR/
fi
$CUEBREAKPOINTS "$CUE" | $SHNSPLIT -o flac "$AUDIO"
$CUETAG "$CUE" `ls split-track*.flac`
cd "$P"
done
Исправление Kroz, :
1. Дать скрипт, которые разбивает CUE на отдельные файлы и устраняет сам корень проблемы.
Давай, чо.
Держи!
cuesplit.sh
#!/bin/sh
find \( -name "*.[aA][pP][eE]" -or -name "*.[fF][lL][aA][cC]" -or -name "*.[wW][vV]" \) -print | while read IMAGE ; do
CUETAG="/home/kroz/bin/cuetag.sh"
CUEBREAKPOINTS="/usr/bin/cuebreakpoints"
SHNSPLIT="/usr/bin/shnsplit"
P=`pwd`
DIR=`echo "${IMAGE%/*}"`
cd "$DIR"
echo
echo "====== Image"
echo -n "Current dir: "
pwd
AUDIO=`echo "${IMAGE##*/}"`
echo "Image file: '$AUDIO'"
AUDIO_NOEXT=`echo "${AUDIO%.[aA][pP][eE]}"`
AUDIO_NOEXT=`echo "${AUDIO_NOEXT%.[fF][lL][aA][cC]}"`
AUDIO_NOEXT=`echo "${AUDIO_NOEXT%.[wW][vV]}"`
if [ "$AUDIO" = "$AUDIO_NOEXT" ] ; then
echo "ERROR: Neither APE nor FLAC file: '$AUDIO'"
cd "$P"
break
fi
CUE=`find -name "$AUDIO_NOEXT.[cC][uU][eE]" -or -name "$AUDIO_NOEXT.[aA][pP][eE].[cC][uU][eE]" -or -name "$AUDIO_NOEXT.[fF][lL][aA][cC].[cC][uU][eE]" -or -name "$AUDIO_NOEXT.[wW][vV].[cC][uU][eE]"| head -n 1`
CUE=`echo "${CUE##*/}"`
if [ -z "$CUE" ] ; then
echo "CUE file does not exist"
cd "$P"
continue
fi
echo "CUE file: '$CUE'"
OLD=`find -maxdepth 1 -name "split-track*.flac" `
if [ ! -z "$OLD" ] ; then
#There are old tracks
OLDDIR="old."`date +%s`
echo "WARNING: Old tracks detected. Moving to directory '$OLDDIR'"
mkdir "$OLDDIR"
mv split-track*.flac $OLDDIR/
fi
$CUEBREAKPOINTS "$CUE" | $SHNSPLIT -o flac "$AUDIO"
$CUETAG "$CUE" `ls split-track*.flac`
cd "$P"
done
Исходная версия Kroz, :
1. Дать скрипт, которые разбивает CUE на отдельные файлы и устраняет сам корень проблемы.
Давай, чо.
Держи!
cuesplit.sh
#!/bin/sh
find \( -name "*.[aA][pP][eE]" -or -name "*.[fF][lL][aA][cC]" -or -name "*.[wW][vV]" \) -print | while read IMAGE ; do
CUETAG="/home/kroz/bin/cuetag.sh"
CUEBREAKPOINTS="/usr/bin/cuebreakpoints"
SHNSPLIT="/usr/bin/shnsplit"
P=`pwd`
DIR=`echo "${IMAGE%/*}"`
cd "$DIR"
echo
echo "====== Image"
echo -n "Current dir: "
pwd
AUDIO=`echo "${IMAGE##*/}"`
echo "Image file: '$AUDIO'"
AUDIO_NOEXT=`echo "${AUDIO%.[aA][pP][eE]}"`
AUDIO_NOEXT=`echo "${AUDIO_NOEXT%.[fF][lL][aA][cC]}"`
AUDIO_NOEXT=`echo "${AUDIO_NOEXT%.[wW][vV]}"`
if [ "$AUDIO" = "$AUDIO_NOEXT" ] ; then
echo "ERROR: Neither APE nor FLAC file: '$AUDIO'"
cd "$P"
break
fi
CUE=`find -name "$AUDIO_NOEXT.[cC][uU][eE]" -or -name "$AUDIO_NOEXT.[aA][pP][eE].[cC][uU][eE]" -or -name "$AUDIO_NOEXT.[fF][lL][aA][cC].[cC][uU][eE]" -or -name "$AUDIO_NOEXT.[wW][vV].[cC][uU][eE]"| head -n 1`
CUE=`echo "${CUE##*/}"`
if [ -z "$CUE" ] ; then
echo "CUE file does not exist"
cd "$P"
continue
fi
echo "CUE file: '$CUE'"
OLD=`find -maxdepth 1 -name "split-track*.flac" `
if [ ! -z "$OLD" ] ; then
#There are old tracks
OLDDIR="old."`date +%s`
echo "WARNING: Old tracks detected. Moving to directory '$OLDDIR'"
mkdir "$OLDDIR"
mv split-track*.flac $OLDDIR/
fi
$CUEBREAKPOINTS "$CUE" | $SHNSPLIT -o flac "$AUDIO"
$CUETAG "$CUE" `ls split-track*.flac`
cd "$P"
done
cuetag.sh
#! /bin/sh
# cuetag.sh - tag files based on cue/toc file information
# uses cueprint output
# usage: cuetag.sh <cuefile|tocfile> [file]...
# originally - part of cuetools 1.3.1 . Modified by Kroz
CUEPRINT=cueprint
cue_file=""
usage()
{
echo "usage: cuetag.sh <cuefile|tocfile> [file]..."
}
# Vorbis Comments
# for FLAC and Ogg Vorbis files
vorbis()
{
# FLAC tagging
# --remove-vc-all overwrites existing comments
METAFLAC="metaflac --remove-all-tags --import-tags-from=-"
# Ogg Vorbis tagging
# -w overwrites existing comments
# -a appends to existing comments
VORBISCOMMENT="vorbiscomment -w -c -"
case "$2" in
*.[Ff][Ll][Aa][Cc])
VORBISTAG="$METAFLAC"
;;
*.[Oo][Gg][Gg])
VORBISTAG="$VORBISCOMMENT"
;;
esac
# space seperated list of recomended stardard field names
# see http://www.xiph.org/ogg/vorbis/doc/v-comment.html
# TRACKTOTAL is not in the Xiph recomendation, but is in common use
fields='TITLE VERSION ALBUM TRACKNUMBER TRACKTOTAL ARTIST PERFORMER COPYRIGHT LICENSE ORGANIZATION DESCRIPTION GENRE DATE LOCATION CONTACT ISRC'
# fields' corresponding cueprint conversion characters
# seperate alternates with a space
TITLE='%t'
VERSION=''
ALBUM='%T'
TRACKNUMBER='%n'
TRACKTOTAL='%N'
ARTIST='%c %p'
PERFORMER='%p'
COPYRIGHT=''
LICENSE=''
ORGANIZATION=''
DESCRIPTION='%m'
GENRE='%g'
DATE=''
LOCATION=''
CONTACT=''
ISRC='%i %u'
(for field in $fields; do
value=""
for conv in `eval echo \\$$field`; do
value=`$CUEPRINT -n $1 -t "$conv\n" "$cue_file"`
if [ -n "$value" ]; then
echo "$field=$value"
break
fi
done
done) | iconv -f cp1251 -t UTF8 | $VORBISTAG "$2"
}
main()
{
if [ $# -lt 1 ]; then
usage
exit
fi
cue_file="$1"
shift
ntrack=`cueprint -d '%N' "$cue_file"`
trackno=1
if [ $# -ne $ntrack ]; then
echo "warning: number of files does not match number of tracks"
fi
for file in "$@"; do
case "$file" in
*.[Ff][Ll][Aa][Cc])
vorbis $trackno "$file"
;;
*.[Oo][Gg][Gg])
vorbis $trackno "$file"
;;
*)
echo "$file: uknown file type"
;;
esac
trackno=$(($trackno + 1))
done
}
main "$@"