Updated mkmkv.sh script
This commit is contained in:
parent
33187149ef
commit
12f6890d14
56
bin/mkmkv.sh
Normal file → Executable file
56
bin/mkmkv.sh
Normal file → Executable file
@ -22,29 +22,47 @@
|
|||||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
getparams() {
|
||||||
|
SOURCE_DIR=$1
|
||||||
|
BASENAME=$2
|
||||||
|
find $SOURCE_DIR -name "$BASENAME-*.srt" | while read srt
|
||||||
|
do
|
||||||
|
SRTBASENAME=`basename "$srt"`
|
||||||
|
LANG=`echo "$SRTBASENAME" | sed -e 's/^\(.*\)\-\([a-z]\{3\}\)\.srt$/\2/'`
|
||||||
|
echo " --language 0:$LANG \"`ls "$srt"`\""
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# TODO : read parameters
|
# TODO : read parameters
|
||||||
|
#SOURCE_DIR=`pwd`
|
||||||
|
#TARGET_DIR=`pwd`
|
||||||
|
|
||||||
# TODO : scan source folder
|
SOURCE_FILE=$1
|
||||||
|
TARGET_DIR=`pwd`
|
||||||
|
VIDEO_LANG=$2
|
||||||
|
|
||||||
|
FILE=`basename "$SOURCE_FILE"`
|
||||||
|
echo "file=$FILE"
|
||||||
|
|
||||||
|
SOURCE_DIR=`dirname "$SOURCE_FILE"`
|
||||||
|
echo "source_dir=$SOURCE_DIR"
|
||||||
|
|
||||||
|
BASENAME=`echo "$FILE" | sed -e 's/^\(.*\)\.avi/\1/'`
|
||||||
|
echo "basename=$BASENAME"
|
||||||
|
|
||||||
|
PARAMS="-o \"$TARGET_DIR/$BASENAME.mkv\""
|
||||||
|
if [ -n "$VIDEO_LANG" ]
|
||||||
|
then PARAMS="$PARAMS --language 0:$VIDEO_LANG --language 1:$VIDEO_LANG"
|
||||||
|
fi
|
||||||
|
PARAMS="$PARAMS \"$SOURCE_FILE\""
|
||||||
|
|
||||||
|
SRTPARAMS=`getparams "$SOURCE_DIR" "$BASENAME"`
|
||||||
|
|
||||||
|
echo "$PARAMS $SRTPARAMS" | xargs mkvmerge
|
||||||
|
|
||||||
# TODO : for each avi file
|
|
||||||
# * check naming conventions (avi file and subtitles)
|
|
||||||
# * for each subtitle corresponding to avi file
|
|
||||||
# * get subtitle language
|
|
||||||
# * build mkvmerge parameters
|
|
||||||
# * call mkvmerge to build new mkvfile
|
# * call mkvmerge to build new mkvfile
|
||||||
# * move file to dest folder
|
# * move file to dest folder
|
||||||
# * remove source files (avi file and subtitles)
|
# * remove source files (avi file and subtitles)
|
||||||
# * update database (insert)
|
# * update database (insert)
|
||||||
|
|
||||||
# TODO : for each mkv file
|
|
||||||
# * check naming conventions (mkv file and subtitles)
|
|
||||||
# * for each subtitle corresponding to mkv file
|
|
||||||
# * get subtitle language
|
|
||||||
# * build mkvmerge parameters
|
|
||||||
# * call mkvmerge to build new mkvfile
|
|
||||||
# * move file to dest folder
|
|
||||||
# * remove source files ( subtitles)
|
|
||||||
# * update database (update)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user