initial commit
This commit is contained in:
commit
78f71a0fb1
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
*~
|
||||||
|
.DS_Store
|
||||||
|
*.pkg.tar.zst
|
||||||
|
*.pkg.tar.zst.sig
|
22
PKGBUILD
Normal file
22
PKGBUILD
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# Maintainer: Sebastian Hugentobler <shu@vanwa.ch>
|
||||||
|
|
||||||
|
pkgname=aax-tools
|
||||||
|
pkgver=0.1.0
|
||||||
|
pkgrel=2
|
||||||
|
pkgdesc="Ffmpeg incantations to get something useful from aax files."
|
||||||
|
arch=("any")
|
||||||
|
url="https://code.vanwa.ch"
|
||||||
|
license=('MIT')
|
||||||
|
depends=("ffmpeg")
|
||||||
|
source=(
|
||||||
|
"aax-to-chapter"
|
||||||
|
"aax-to-m4a"
|
||||||
|
)
|
||||||
|
sha256sums=("ff999cb350c5587824e2d513969f1d87e8879b8892716082ea9108a7347fc50a" "74018431b8838944e41afe9144cca79917ff834b0c2e100a6f9ef28c52fdf45c")
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "$srcdir/"
|
||||||
|
|
||||||
|
install -Dm 755 aax-to-chapter "$pkgdir/usr/bin/aax-to-chapter"
|
||||||
|
install -Dm 755 aax-to-m4a "$pkgdir/usr/bin/aax-to-m4a"
|
||||||
|
}
|
25
aax-to-chapter
Executable file
25
aax-to-chapter
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
input="$1"
|
||||||
|
EXT2="m4a"
|
||||||
|
|
||||||
|
if [ -z "$AAX_ACTIVATION_BYTES" ]; then
|
||||||
|
echo "set AAX_ACTIVATION_BYTES env var"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
json=$(ffprobe -activation_bytes "$AAX_ACTIVATION_BYTES" -i "$input" -loglevel error -print_format json -show_format -show_chapters)
|
||||||
|
title=$(echo $json | jq -r ".format.tags.title")
|
||||||
|
count=$(echo $json | jq ".chapters | length")
|
||||||
|
target=$(echo $json | jq -r ".format.tags | .date + \" \" + .artist + \" - \" + .title")
|
||||||
|
mkdir "$target"
|
||||||
|
|
||||||
|
for i in $(seq -w 1 $count); do
|
||||||
|
j=$((10#$i))
|
||||||
|
n=$(($j - 1))
|
||||||
|
start=$(echo $json | jq -r ".chapters[$n].start_time")
|
||||||
|
end=$(echo $json | jq -r ".chapters[$n].end_time")
|
||||||
|
name=$(echo $json | jq -r ".chapters[$n].tags.title")
|
||||||
|
ffmpeg -activation_bytes "$AAX_ACTIVATION_BYTES" -i $input -ss $start -to $end -metadata title="$title $name" -vn -c:a copy "$target/$i $name.$EXT2"
|
||||||
|
done
|
13
aax-to-m4a
Executable file
13
aax-to-m4a
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
input="$1"
|
||||||
|
output="$2"
|
||||||
|
EXT="m4a"
|
||||||
|
|
||||||
|
if [ -z "$AAX_ACTIVATION_BYTES" ]; then
|
||||||
|
echo "set AAX_ACTIVATION_BYTES env var"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ffmpeg -activation_bytes "$AAX_ACTIVATION_BYTES" -threads 0 -i "$input" -vn "$output.$EXT"
|
Loading…
Reference in New Issue
Block a user