Ho fatto un'analisi dei due translate.cgi, ecco le differenze
1. A dicembre c'è in più la gestione del tipo matroska .mkv
2. A dicembre c'è una migliore compatibilitÃ* con la rfc3986 (http://www.ietf.org/rfc/rfc3986.txt) per cui alcuni caratteri che venivano accettati nella riga di comando non lo sono più
Di conseguenza alla 2 nasce l'incompatibilitÃ*.
Nota bene che rendere il media-translate compatibile con la rfc3986 aprirebbe la possibilitÃ* di trasformare il media player in un media server.
Io ti consiglierei di aggiornare media-translate, per evitare di restare con una versione che sarÃ* abbandonata, e correggere smartTV di consegueza.
Allego le differenze tra i due translate.cgi
Saluti,
H
Codice:
--- translate.cgi.agosto 2011-06-21 06:45:32.000000000 +0200
+++ translate.cgi.dicembre 2012-01-11 12:42:50.000000000 +0100
@@ -28,6 +28,10 @@
CACHEPATH=${CACHEPATH:-/opt/tmp}
TEMP=${TEMP:-/tmp}
+RESOLVE_CACHE_ENABLED=${RESOLVE_CACHE_ENABLED:-'yes'}
+RESOLVE_CACHE_MAX_AGE=${RESOLVE_CACHE_MAX_AGE:-259200}
+RESOLVE_CACHE_EXCLUSION_FILE=${RESOLVE_CACHE_EXCLUSION_FILE:-$BASEPATH/etc/cache.exclusion}
+
YOUTUBE_HD=${YOUTUBE_HD:-'yes'}
VIMEO_HD=${VIMEO_HD:-'yes'}
IVI_HD=${IVI_HD:-'yes'}
@@ -39,7 +43,7 @@
STREAM_TEST_TIMEOUT=15
-DEFAULTFILTER="(mp3|mp2|mpga|ogg|wav|wma|wax|m4a|mp4a|avi|mpeg|mpg|mpe|wmv|wvx|wm|wmx|flv|qt|mov|asf|asx|mp4|m4v|mp4v|mpg4|xspf|m3u|pls|cue|txt|flac|jpg|jpeg|jpe|png|gif|bmp)"
+DEFAULTFILTER="(mp3|mp2|mpga|ogg|wav|wma|wax|m4a|mp4a|avi|mpeg|mpg|mpe|mkv|wmv|wvx|wm|wmx|flv|qt|mov|asf|asx|mp4|m4v|mp4v|mpg4|xspf|m3u|pls|cue|txt|flac|jpg|jpeg|jpe|png|gif|bmp)"
UDPXY_URL=${UDPXY_URL:-'http://127.0.0.1:8080'}
UDPXY_URL=`echo "$UDPXY_URL" | awk '{sub(/\/$/, ""); gsub(/\//, "\\\/"); gsub(/\./, "\\\."); print}'`
@@ -53,6 +57,8 @@
[ ! -d $CACHEPATH ] && CACHEPATH=$TEMP
+echo $QUERY_STRING > /tmp/debug.log
+
arg_cmd=`echo "$QUERY_STRING" | awk -F, '{print $1}'`
arg_opt=`echo "$QUERY_STRING" | awk -F, '{print $2}'`
arg_url=`echo "$QUERY_STRING" | awk -F, '{for(i=3; i<NF; i++) printf "%s,", $(i); printf "%s", $(NF); }'`
@@ -60,6 +66,8 @@
arg_url=`urldecode_s "$arg_url"`
arg_opt=`urldecode_s "$arg_opt"`
+
+arg_url=`echo $arg_url | sed "s/'/%27/g"`
# http://127.0.0.1/translate[?<scan|*>]
# http://127.0.0.1/translate?stream,[<option1;...optionN>],<url>
@@ -111,7 +119,7 @@
icy_description=
ms_author=
-ms_title=
+ms_title=
server_type='' # icecast | shoutcast | youtube | vimeo | rutube | ivi
stream_status_url=''
@@ -329,6 +337,9 @@
avi|AVI|mpeg|MPEG|mpg|MPG|mpe|MPE)
type=video/mpeg
;;
+ mkv|MKV)
+ type=video/x-matroska
+ ;;
qt|QT|mov|MOV)
type=video/quicktime
;;
@@ -713,16 +724,68 @@
{
if [ "$arg_cmd" == "status" ]; then
check_server
- else
- check_stream
+ else
+ if [ -f "$RESOLVE_CACHE_EXCLUSION_FILE" ]; then
+ if (export arg_url; while read pattern; do if echo "$arg_url" | grep -qsi "$pattern"; then return 0; fi done; return 1) < "$RESOLVE_CACHE_EXCLUSION_FILE"; then
+ unset RESOLVE_CACHE_ENABLED
+ fi
+ fi
+ case $RESOLVE_CACHE_ENABLED in
+ yes|YES|Yes|1)
+ RESOLVE_CACHE_ENABLED=1
+ local tsttime
+ let tsttime=`date +%s`-$RESOLVE_CACHE_MAX_AGE
+
+ local RESOLVECACHE=$CACHEPATH/`$MD5 "$arg_url"`.resolve
+
+ local REFRESHCACHE=yes
+ if [ -f "$RESOLVECACHE" ]; then
+ [ `date +%s -r "$RESOLVECACHE"` -gt $tsttime ] && REFRESHCACHE=
+ fi
+
+ if [ -n "$REFRESHCACHE" ]; then
+ check_stream
+ if [ "$RESOLVE_CACHE_ENABLED" == "1" -a -n "$stream_url" ]; then
+ echo "$stream_url" > $RESOLVECACHE
+ echo "$stream_type" >> $RESOLVECACHE
+ echo "$stream_class" >> $RESOLVECACHE
+ echo "$protocol" >> $RESOLVECACHE
+ echo "$server_type" >> $RESOLVECACHE
+ echo "$stream_status_url" >> $RESOLVECACHE
+ echo "$icy_name" >> $RESOLVECACHE
+ echo "$icy_genre" >> $RESOLVECACHE
+ echo "$icy_br" >> $RESOLVECACHE
+ echo "$icy_description" >> $RESOLVECACHE
+ echo "$ms_author" >> $RESOLVECACHE
+ echo "$ms_title" >> $RESOLVECACHE
+ fi
+ else
+ stream_url=`sed -ne "1p" $RESOLVECACHE`
+ stream_type=`sed -ne "2p" $RESOLVECACHE`
+ stream_class=`sed -ne "3p" $RESOLVECACHE`
+ protocol=`sed -ne "4p" $RESOLVECACHE`
+ server_type=`sed -ne "5p" $RESOLVECACHE`
+ stream_status_url=`sed -ne "6p" $RESOLVECACHE`
+ icy_name=`sed -ne "7p" $RESOLVECACHE`
+ icy_genre=`sed -ne "8p" $RESOLVECACHE`
+ icy_br=`sed -ne "9p" $RESOLVECACHE`
+ icy_description=`sed -ne "10p" $RESOLVECACHE`
+ ms_author=`sed -ne "11p" $RESOLVECACHE`
+ ms_title=`sed -ne "12p" $RESOLVECACHE`
+ fi
+ ;;
+ *)
+ check_stream
+ ;;
+ esac
fi
echo "Content-type: text/xml"
echo
echo "<?xml version='1.0' encoding='UTF-8'?>"
echo "<info>"
- escaped_url="`echo $stream_url | sed 's/&/&/g'`"
+ escaped_url=`escapeXML $stream_url`
if [ "$protocol" == "http" -o "$protocol" == "mms" -o "$protocol" == "mmsh" -o "$protocol" == "rtsp" ]; then
- escaped_url="`echo $escaped_url | sed 's/ /%20/g'`"
+ escaped_url="`echo $escaped_url | sed 's/ /%20/g;s/"/%22/g'`"
fi
echo "<stream url=\"$escaped_url\" type=\"$stream_type\" class=\"$stream_class\" protocol=\"$protocol\" server=\"$server_type\" server_url=\"$stream_status_url\" />"
case $stream_class in
@@ -818,7 +881,7 @@
if(metaint != counter + 1)
{
split($0, a, "\x27;");
- if(match(a[1], /^.*StreamTitle=\x27(.*)/, arr))
+ if(match(a[1], /.*StreamTitle=\x27(.*)/, arr))
{
print arr[1];
}
@@ -853,16 +916,16 @@
esac
if echo "$meta_stream_title" | $TOUTF8 -t; then
- meta_stream_title=`echo "$meta_stream_title" | $XCODE -s | $TOUTF8`
+ meta_stream_title=`echo "$meta_stream_title" | $XCODE -s | $TOUTF8`
fi
if echo "$meta_stream_genre" | $TOUTF8 -t; then
- meta_stream_genre=`echo "$meta_stream_genre" | $XCODE -s | $TOUTF8`
+ meta_stream_genre=`echo "$meta_stream_genre" | $XCODE -s | $TOUTF8`
fi
if echo "$meta_stream_description" | $TOUTF8 -t; then
- meta_stream_description=`echo "$meta_stream_description" | $XCODE -s | $TOUTF8`
+ meta_stream_description=`echo "$meta_stream_description" | $XCODE -s | $TOUTF8`
fi
- print_status_item 'server-status' "${meta_server_status}"
+ print_status_item 'server-status' "${meta_server_status}"
print_status_item 'stream-status' "$meta_stream_status"
print_status_item 'listener-peak' "$meta_listener_peak"
print_status_item 'average-listener-time' "$meta_average_listener_time"
@@ -1215,10 +1278,30 @@
command_info
;;
stream|audio|video|image)
+ if [ -z "$stream_type" ]; then
+ local TIMELIFE=${STREAM_INFO_TIMELIFE:-60}
+ local CACHEFILE=$CACHEPATH/stream.`$MD5 "$arg_url"`
+ local tsttime
+ let tsttime=`date +%s`-$TIMELIFE
+ if [ -f $CACHEFILE ]; then
+ if [ `date +%s -r $CACHEFILE` -gt $tsttime ]; then
+ stream_url=`sed -ne "1p" $CACHEFILE`
+ stream_type=`sed -ne "2p" $CACHEFILE`
+ arg_opt=`sed -ne "3p" $CACHEFILE`
+ fi
+ fi
+ if [ -z "$stream_type" ]; then
+ check_stream
+ echo $stream_url > $CACHEFILE
+ echo $stream_type >> $CACHEFILE
+ echo $arg_opt >> $CACHEFILE
+ fi
+ fi
+
get_opt "Protocol"
case $opt in
mms|mmst|mmsh|http|rtsp|ftp)
- msdlopt='-p $opt'
+ msdlopt="-p $opt"
;;
*)
msdlopt=''
@@ -1236,33 +1319,18 @@
get_opt "Charset"
charset=$opt
-
- if [ -z "$stream_type" ]; then
- local TIMELIFE=${STREAM_INFO_TIMELIFE:-60}
- local CACHEFILE=$CACHEPATH/stream.`echo $arg_url | sed 's/[^0-9a-zA-Z]/_/g'`
- local tsttime
- let tsttime=`date +%s`-$TIMELIFE
- if [ -f $CACHEFILE ]; then
- if [ `date +%s -r $CACHEFILE` -gt $tsttime ]; then
- stream_url=`sed -ne "1p" $CACHEFILE`
- stream_type=`sed -ne "2p" $CACHEFILE`
- arg_opt=`sed -ne "3p" $CACHEFILE`
- fi
- fi
- if [ -z "$stream_type" ]; then
- check_stream
- echo $stream_url > $CACHEFILE
- echo $stream_type >> $CACHEFILE
- echo $arg_opt >> $CACHEFILE
- fi
- fi
echo "Content-type: $stream_type"
echo
if echo "$stream_url" | grep -qs "^rtmp"; then
get_opt "Rtmp-options"
killall -q $RTMPDUMP 2>&1
- exec nice $RTMPDUMP -q -o - -b 60000 -r "$stream_url" $opt
+# echo $RTMPDUMP -q -o - -b 60000 -r \"$stream_url\" $opt >/tmp/nnb.log
+ echo $arg_opt >> /tmp/debug.log
+ echo $RTMPDUMP -q -o - -b 1000 -r "$stream_url" $opt >> /tmp/debug.log
+ exec nice $RTMPDUMP -q -o - -r "$stream_url" $opt
+# exec nice $RTMPDUMP -q -o - -b 60000 -r "$stream_url" $opt
+# exec nice $RTMPDUMP -V -o - -b 60000 -r "$stream_url" $opt 2>/tmp/rtmpdump.log
elif [ "$charset" == "CP1251" ]; then
$MSDL $msdlopt -q -o - "$stream_url" | $TOUTF8 | sed 's/windows-125./utf-8/'
else