slitaz-tools rev 746
Add: decode (new cmdline tool to decode audio/video files)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon Apr 30 10:35:44 2012 +0200 (2012-04-30) |
parents | cc27e2f27556 |
children | 0a1f578c3ddf |
files | Makefile po/slitaz-boxes/slitaz-boxes.pot po/slitaz-tools/slitaz-tools.pot po/tazbox/tazbox.pot po/tazdrop/tazdrop.pot po/tazinst/tazinst.pot tinyutils/decode |
line diff
1.1 --- a/Makefile Sun Apr 29 23:07:19 2012 +0200 1.2 +++ b/Makefile Mon Apr 30 10:35:44 2012 +0200 1.3 @@ -22,7 +22,7 @@ 1.4 @xgettext -o po/slitaz-tools/slitaz-tools.pot -L Shell \ 1.5 --package-name="SliTaz Tools" \ 1.6 ./tinyutils/tazlocale ./tinyutils/tazkeymap ./tinyutils/setmixer \ 1.7 - ./tinyutils/tazx 1.8 + ./tinyutils/tazx ./tinyutils/decode 1.9 @echo "done" 1.10 1.11 boxes-pot:
2.1 --- a/po/slitaz-boxes/slitaz-boxes.pot Sun Apr 29 23:07:19 2012 +0200 2.2 +++ b/po/slitaz-boxes/slitaz-boxes.pot Mon Apr 30 10:35:44 2012 +0200 2.3 @@ -8,7 +8,7 @@ 2.4 msgstr "" 2.5 "Project-Id-Version: SliTaz Boxes\n" 2.6 "Report-Msgid-Bugs-To: \n" 2.7 -"POT-Creation-Date: 2012-04-29 23:05+0200\n" 2.8 +"POT-Creation-Date: 2012-04-30 10:34+0200\n" 2.9 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 2.10 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 2.11 "Language-Team: LANGUAGE <LL@li.org>\n"
3.1 --- a/po/slitaz-tools/slitaz-tools.pot Sun Apr 29 23:07:19 2012 +0200 3.2 +++ b/po/slitaz-tools/slitaz-tools.pot Mon Apr 30 10:35:44 2012 +0200 3.3 @@ -8,7 +8,7 @@ 3.4 msgstr "" 3.5 "Project-Id-Version: SliTaz Tools\n" 3.6 "Report-Msgid-Bugs-To: \n" 3.7 -"POT-Creation-Date: 2012-04-29 23:05+0200\n" 3.8 +"POT-Creation-Date: 2012-04-30 10:34+0200\n" 3.9 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 3.10 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 3.11 "Language-Team: LANGUAGE <LL@li.org>\n" 3.12 @@ -86,3 +86,35 @@ 3.13 #: tinyutils/tazx:168 3.14 msgid "Quit Tazx utility" 3.15 msgstr "" 3.16 + 3.17 +#: tinyutils/decode:31 3.18 +msgid "Usage:" 3.19 +msgstr "" 3.20 + 3.21 +#: tinyutils/decode:33 3.22 +msgid "Decode audio and video files" 3.23 +msgstr "" 3.24 + 3.25 +#: tinyutils/decode:35 3.26 +msgid "Examples:" 3.27 +msgstr "" 3.28 + 3.29 +#: tinyutils/decode:49 3.30 +msgid "Missing decoder :" 3.31 +msgstr "" 3.32 + 3.33 +#: tinyutils/decode:50 3.34 +msgid "Skipping file :" 3.35 +msgstr "" 3.36 + 3.37 +#: tinyutils/decode:54 3.38 +msgid "Decoding:" 3.39 +msgstr "" 3.40 + 3.41 +#: tinyutils/decode:78 3.42 +msgid "Unsupported file:" 3.43 +msgstr "" 3.44 + 3.45 +#: tinyutils/decode:98 3.46 +msgid "No file:" 3.47 +msgstr ""
4.1 --- a/po/tazbox/tazbox.pot Sun Apr 29 23:07:19 2012 +0200 4.2 +++ b/po/tazbox/tazbox.pot Mon Apr 30 10:35:44 2012 +0200 4.3 @@ -8,7 +8,7 @@ 4.4 msgstr "" 4.5 "Project-Id-Version: TazBox\n" 4.6 "Report-Msgid-Bugs-To: \n" 4.7 -"POT-Creation-Date: 2012-04-29 23:05+0200\n" 4.8 +"POT-Creation-Date: 2012-04-30 10:34+0200\n" 4.9 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 4.10 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 4.11 "Language-Team: LANGUAGE <LL@li.org>\n"
5.1 --- a/po/tazdrop/tazdrop.pot Sun Apr 29 23:07:19 2012 +0200 5.2 +++ b/po/tazdrop/tazdrop.pot Mon Apr 30 10:35:44 2012 +0200 5.3 @@ -8,7 +8,7 @@ 5.4 msgstr "" 5.5 "Project-Id-Version: TazDrop\n" 5.6 "Report-Msgid-Bugs-To: \n" 5.7 -"POT-Creation-Date: 2012-04-29 23:05+0200\n" 5.8 +"POT-Creation-Date: 2012-04-30 10:34+0200\n" 5.9 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 5.10 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 5.11 "Language-Team: LANGUAGE <LL@li.org>\n"
6.1 --- a/po/tazinst/tazinst.pot Sun Apr 29 23:07:19 2012 +0200 6.2 +++ b/po/tazinst/tazinst.pot Mon Apr 30 10:35:44 2012 +0200 6.3 @@ -8,7 +8,7 @@ 6.4 msgstr "" 6.5 "Project-Id-Version: Tazinst\n" 6.6 "Report-Msgid-Bugs-To: \n" 6.7 -"POT-Creation-Date: 2012-04-29 23:05+0200\n" 6.8 +"POT-Creation-Date: 2012-04-30 10:34+0200\n" 6.9 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 6.10 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 6.11 "Language-Team: LANGUAGE <LL@li.org>\n"
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/tinyutils/decode Mon Apr 30 10:35:44 2012 +0200 7.3 @@ -0,0 +1,104 @@ 7.4 +#!/bin/sh 7.5 +# 7.6 +# Decode is a cmdline tool to decode all kind of files such as audio or video. 7.7 +# Let decode a single file, many file on cmdline or a full directory. 7.8 +# 7.9 +# Copyright (C) 2012 SliTaz GNU/Linux - BSD License 7.10 +# 7.11 +# Author: Christophe Lincoln <pankso@slitaz.org> 7.12 +# 7.13 +. /lib/libtaz.sh 7.14 + 7.15 +# NOTES: 7.16 +# Do we need a --out=/output/path options ? 7.17 +# Use convert for [.png|.jpg] --> .raw ? 7.18 +# Use separators and give decoded file size ? 7.19 +# Use mencoder for flash video files (and other format) ? 7.20 + 7.21 +# Internationalization 7.22 +. /usr/bin/gettext.sh 7.23 +TEXTDOMAIN='slitaz-tools' 7.24 +export TEXTDOMAIN 7.25 + 7.26 +# 7.27 +# Functions 7.28 +# 7.29 + 7.30 +# Small help and usage. 7.31 +usage() { 7.32 + cat << EOT 7.33 + 7.34 +$(gettext "Usage:") $(basename $0) [option] [file|url] [file2 url2 ... fileN urlN] 7.35 + 7.36 +$(gettext "Decode audio and video files") 7.37 + 7.38 +$(gettext "Examples:") 7.39 + $(basename $0) audio.mp3 audio.ogg 7.40 + $(basename $0) /path/files/* 7.41 + $(basename $0) http://www.myurl/file.avi 7.42 + 7.43 +EOT 7.44 +} 7.45 + 7.46 +# Check if a tool is installed. Dont force users and auto install package 7.47 +# Decode is a cmdline line tool, let have auto install option in GUI. 7.48 +check_tool() { 7.49 + name="$(basename "$file")" 7.50 + if [ ! -x /usr/bin/$1 ]; then 7.51 + echo "" 7.52 + gettext "Missing decoder :"; echo " $1" 7.53 + gettext "Skipping file :"; echo " $name" 7.54 + continue 7.55 + else 7.56 + echo "" 7.57 + gettext "Decoding:"; echo " $name" 7.58 + #separator 7.59 + fi 7.60 +} 7.61 + 7.62 +# Decode a file. 7.63 +decoder() { 7.64 + case "$file" in 7.65 + *.mp3|*.MP3) 7.66 + check_tool "mpg123" 7.67 + mpg123 --rate 44100 --stereo --buffer 3072 --resync \ 7.68 + -w "${file%.*3}.wav" "$file" ;; 7.69 + *.ogg) 7.70 + check_tool "oggdec" 7.71 + oggdec "$file" ;; 7.72 + *.avi|*.wmv|*.mov|*.flv) 7.73 + check_tool "ffmpeg" 7.74 + ext=${file##*.} 7.75 + # *.flv --> mencoder file.flv -ovc lavc -oac mp3lame -o file.avi 7.76 + ffmpeg -y -i "$file" "${file%.$ext}.mpg" 7.77 + du -sh "${file%.$ext}.mpg" ;; 7.78 + *.wav|*.mpg|--*) 7.79 + # Skip decoded files and --options. 7.80 + continue ;; 7.81 + *) echo ""; gettext "Unsupported file:"; echo " $file" ;; 7.82 + esac 7.83 +} 7.84 + 7.85 +# 7.86 +# Commands 7.87 +# 7.88 + 7.89 +case "$1" in 7.90 + "") usage ;; 7.91 + *) 7.92 + for file in "$@" 7.93 + do 7.94 + case "$file" in 7.95 + http://*) 7.96 + busybox wget "$file" 7.97 + file="$(basename "$file")" 7.98 + decoder && rm "$file" ;; 7.99 + *) 7.100 + [ ! -f "$file" ] && \ 7.101 + (gettext "No file:"; echo " $file") && continue 7.102 + decoder ;; 7.103 + esac 7.104 + done && echo "" ;; 7.105 +esac 7.106 + 7.107 +exit 0