]> code.delx.au - transcoding/blobdiff - identify-disc
identify-disc support for bluray
[transcoding] / identify-disc
diff --git a/identify-disc b/identify-disc
new file mode 100755 (executable)
index 0000000..21eb9b6
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+if [ -z "$1" -o -z "$2" ]; then
+    echo "Usage: $0 --bluray-device|--dvd-device SOMEDIRECTORY"
+    exit 1
+fi
+
+device_param="$1"
+device_path="$2"
+if [ "$device_param" = "--bluray-device" ]; then
+    device_param="-bluray-device"
+    device_scheme="bluray"
+elif [ "$device_param" = "--dvd-device" ]; then
+    device_param="-dvd-device"
+    device_scheme="dvd"
+else
+    echo "Unknown device type: $device_param"
+    exit 1
+fi
+
+mplayer 2> /dev/null \
+    -quiet \
+    -ao null \
+    -vo null \
+    -frames 0 \
+    -identify \
+    "$device_param" "$device_path" \
+    "${device_scheme}://" | \
+    sed -e 's/ID_\(DVD\|BLURAY\)_TITLE_\([0-9]*\)*_LENGTH=\(.*\)$/\2   \3/;tx;d;:x' | \
+    sort -n
+