From a145c9f54123a370b3403556fea2d09748a1e23d Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 7 Aug 2015 13:41:03 +0100 Subject: [PATCH] jpg2avi, big fix --- etc/profile.d/functions | 54 ++++++++++++++++++++++++++++++++--------- lib/css/db.css | 6 +++-- lib/php/db.php | 34 +++++++------------------- lib/php/db/table.php | 8 ++---- lib/php/page.php | 4 +-- 5 files changed, 60 insertions(+), 46 deletions(-) diff --git a/etc/profile.d/functions b/etc/profile.d/functions index 04912a4c..9c7e9c95 100644 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -15,17 +15,22 @@ shell_help() { # local msg="$1"; shift - case "$@" in - *-h*|*-help*|*--help*) - case $OSTYPE in - darwin*) printf "$msg\n" ;; - *) echo -e "$msg" ;; - esac - return 0 - ;; - *) return 1 ;; - esac + declare i + #while [ $# -gt 0 ]; do + for i in $@; do + case "$i" in + -h|-help|--help) + case $OSTYPE in + darwin*) printf "$msg\n" ;; + *) echo -e "$msg" ;; + esac + return 0 + ;; + esac + shift + done + return 1 } shell_help_noarg() { @@ -37,7 +42,7 @@ shell_help_noarg() { local args=""; args="$@" # zsh compatible [ -z "$args" ] && args="--help" - sem_help "$msg" "$args" + shell_help "$msg" "$args" } shell_functions() { @@ -251,3 +256,30 @@ print "[ $play - ".$_[0]." ]\n\n"; exec "mplayer",$_[1]; ' "$@" } + +jpg2avi() { + + shell_help_noarg "Usage: $FUNCNAME [-h] JPG_FILES AVI_FILE" "$@" && return + declare still; still=/tmp/$FUNCNAME.$$.txt; [ -x /dev/shm ] && tmp=/dev/shm/$FUNCNAME.$$.txt + #declare still; still=$FUNCNAME.txt + declare tot; tot=$# + declare count; count=0 + + declare avi; #avi=${@:$#} + declare jpg; #jpg=${@:1:$(($# - 1))} + + while [ $# -gt 0 ]; do + count=$(($count+1)) + + if [ "$count" = "$tot" ]; then + avi="$1"; shift; break + fi + + echo "$1" >> "$still" + shift + done + + #echo $(cat $still)" -> $avi" + mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -mf type=jpeg:fps=24 mf://@${still} -o $avi + rm -f "$still" +} diff --git a/lib/css/db.css b/lib/css/db.css index 6f64434f..89b37cc6 100644 --- a/lib/css/db.css +++ b/lib/css/db.css @@ -42,7 +42,9 @@ div.rows { text-align: center; } div.rows .row { text-align: left; } */ +div.rows { text-align: center; } div.rows .row { + text-align: left; vertical-align: top; /* margin: 0 0 0.5em 0; @@ -51,7 +53,7 @@ div.rows .row { padding: 0.2em; display: inline-block; width: 21em; - width: 16em; + overflow: auto; } div.rows .nav { @@ -77,7 +79,7 @@ div.rows .row label { div.rows .row span { width: 70%; display: inline-block; - white-space: pre; + white-space: normal; text-align: right; } /* diff --git a/lib/php/db.php b/lib/php/db.php index 1533ceef..e4f64e06 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -6,15 +6,14 @@ from any database *****************************************************************************/ -require_once(dirname(__FILE__).'/functions.php'); +require_once(dirname(__FILE__).'/nb.php'); require_once(dirname(__FILE__).'/db/table.php'); -require_once(dirname(__FILE__).'/db/field.php'); if (!defined('DB_HTML_FORM_BUTTONS')) define('DB_HTML_FORM_BUTTONS','' #.'' #.'' #.'' // NB 04.08.15 .'X' - .'' + .'' .'' .'' .'' @@ -23,7 +22,7 @@ if (!defined('DB_HTML_FORM_BUTTONS')) define('DB_HTML_FORM_BUTTONS','' #if (!defined('DB_HTML_BUTTON_ADD')) define('DB_HTML_BUTTON_ADD','Add'); #if (!defined('DB_HTML_BUTTON_ADD')) define('DB_HTML_BUTTON_ADD',''); -class db { +class db extends nb { public $pdo; public $conn; @@ -268,13 +267,16 @@ EOF; $r = '