1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00

tdm-media: Converted to nuxr-runner

Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
Tony Tkáčik 2019-02-03 16:25:31 +01:00
parent 163a2b820b
commit 851914ff75

View file

@ -1,9 +1,13 @@
#!/usr/bin/env nux-runner #!/usr/bin/env nuxr-nuxsh
type ffmpeg > /dev/null 2>&1 && FFMPEG_OR_LIBAV=ffmpeg type ffmpeg > /dev/null 2>&1 && FFMPEG_OR_LIBAV=ffmpeg
type avconv > /dev/null 2>&1 && FFMPEG_OR_LIBAV=avconv type avconv > /dev/null 2>&1 && FFMPEG_OR_LIBAV=avconv
function task.video.change.container { QUALITY=${QUALITY:=90}
@namespace task. {
function :video.change.container {
CONTAINER=$1; CONTAINER=$1;
shift; shift;
echo "Using $FFMPEG_OR_LIBAV for conversion." echo "Using $FFMPEG_OR_LIBAV for conversion."
@ -14,13 +18,11 @@ function task.video.change.container {
done done
} }
function task.nikon-mp4 { function :nikon-mp4 {
task.video.change.container mp4 "$@" task.video.change.container mp4 "$@"
} }
function task.downscale { function :downscale TARGET SIZE {
local TARGET=$1; shift;
local SIZE=$1; shift
local i=0; local i=0;
local count="$#"; local count="$#";
mkdir -p $TARGET; mkdir -p $TARGET;
@ -40,16 +42,14 @@ function task.downscale {
-quality 90 \ -quality 90 \
$target_file $target_file
done done
} }
## to:: <jpg|png> <image...> ## to:: <jpg|png> <image...>
## ##
## Convert image to ## Convert image to
## ##
function task.to { function :to target {
target=$1;
shift;
if ! nux.check.function "media.to.$target" ; then if ! nux.check.function "media.to.$target" ; then
echo Target type "$target" is not supported. echo Target type "$target" is not supported.
return -1 return -1
@ -61,8 +61,10 @@ function task.to {
media.to.$target "$file" "$target_full" media.to.$target "$file" "$target_full"
echo $file $target_file echo $file $target_file
done done
}
} }
function media.to.jpg { function media.to.jpg {
convert "$1" -quality 90 -auto-orient "$2" convert "$1" -quality $QUALITY -auto-orient "$2"
} }