esquem
Usuario (China)

debe haber un montón, pero se me rompió el disco y -como no tengo un mango- tuve que volver por ahora a una vieja asus con 1Gb RAM. Instalé ubuntu, lo destripé para dejarlo consumiendo lo mínimo y anda bien. Para series y pelis está xbmc. Pero lo básico, tipo TN o tvpublica o el canal que sea son un plomo porque firefox y el pluguin-container consumen como hienas sedientas. Y no pienso armar playlists, porque las odio. Además, muchas veces da para escuchar sólo audio -caso noticias- y ahorrarse el render de video. La cpu queda tranqui al 3%. Hice entonces, un script bash -medio chapucero. Por ejemplo (9, 7 o el numero que sea). play 9 nv play de tvpublica con audio solo (mplayer). play 7 levanta tn en totem (video default de ubuntu) play 7 nv levanta audio solo de tn en mplayer, sin video play 3 radio continental (mplayer) y asi todo. y asi todo en el universo. play -h ayuda play -f tira la misma tabla con los streams Eso. Requiere que esté inatalado mplayer y totem (que es el player por defecto de ubuntu). Se puede cambiar totem por vlc, obvio, pero hay que revisar. Están las variables en el script managemedia Son 4 scripts. El que se ejecuta es play. Calculo que no se entiendió nada, pero ahí van. Son estos 4 scripts. Ok, no puedo linkear a nada. No sé. Van los scripts separados por grrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr nombre del script: play (editar y guardar) grrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr #!/bin/bash ######## RADIO ######## #mitre STATIONS_TYPE[$((++i))]='radio' STATIONS_NAME[${i}]='Mitre' STATIONS_STRM[${i}]='http://buecrplb01.cienradios.com.ar/Mitre790.aac' #lared STATIONS_TYPE[$((++i))]='radio' STATIONS_NAME[${i}]='La Red' STATIONS_STRM[${i}]='rtmp://vivolared.multimediosamerica.com.ar/streamlared/lared' #continental STATIONS_TYPE[$((++i))]='radio' STATIONS_NAME[${i}]='Continental' STATIONS_STRM[${i}]='http://69.31.54.135/CONTINENTAL' #radio10 STATIONS_TYPE[$((++i))]='radio' STATIONS_NAME[${i}]='Radio 10' STATIONS_STRM[${i}]='rtmp://radio10.stweb.tv:1935/radio10/live' #rocknpop STATIONS_TYPE[$((++i))]='radio' STATIONS_NAME[${i}]='Rock & Pop' STATIONS_STRM[${i}]='http://201.212.5.144/audio959-rockandpop' #metro95.1 STATIONS_TYPE[$((++i))]='radio' STATIONS_NAME[${i}]='Metro 95.1' STATIONS_STRM[${i}]='http://201.212.5.144/metro' ######## TELE ######## #tn STATIONS_TYPE[$((++i))]='tv' STATIONS_NAME[${i}]='TN' STATIONS_STRM[${i}]='rtsp://stream.tn.com.ar/live/tnhd1' #canal26 STATIONS_TYPE[$((++i))]='tv' STATIONS_NAME[${i}]='Canal 26' STATIONS_STRM[${i}]='http://200.115.194.1:8080/Canal26/' #tvpublica STATIONS_TYPE[$((++i))]='tv' STATIONS_NAME[${i}]='TV Publica' STATIONS_STRM[${i}]='rtsp://publish.fibertel.qaotic.net:1935/live/c7live01-20034_160p' #canal13 STATIONS_TYPE[$((++i))]='tv' STATIONS_NAME[${i}]='Canal 13' STATIONS_STRM[${i}]='rtsp://stream.eltrecetv.com.ar/live13/13tv/13tv1' #c5n STATIONS_TYPE[$((++i))]='tv' STATIONS_NAME[${i}]='C5N' STATIONS_STRM[${i}]='http://c5n.stweb.tv/c5n/live/playlist.m3u8' #dxtv STATIONS_TYPE[$((++i))]='tv' STATIONS_NAME[${i}]='DxTV' STATIONS_STRM[${i}]='rtmp://edge02.dcarsat.com.ar/liveedge/mp4XTV' #aljazeera STATIONS_TYPE[$((++i))]='tv' STATIONS_NAME[${i}]='Al Jazeera Eng' STATIONS_STRM[${i}]='rtmp://hd2.lsops.net/live/aljazeer_en_372' #BBC STATIONS_TYPE[$((++i))]='tv' STATIONS_NAME[${i}]='BBC News' STATIONS_STRM[${i}]='rtmp://hd4.lsops.net/live/bbcnews_en_364' #CNN STATIONS_TYPE[$((++i))]='tv' STATIONS_NAME[${i}]='CNN' STATIONS_STRM[${i}]='rtmp://hd1.lsops.net/live/cnn_en_584' source ~/scripts/managemedia nombre del script: format (editar y guardar) grrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr #formatting bold='e[1m' greenBG=${bold}'e[38;5;88me[48;5;136m' red=${bold}'e[38;5;88m' redBG=${bold}'e[38;5;136me[48;5;88m' desert='e[38;5;136m' end='e[0m' nombre del script: displaytable (editar y guardar) grrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr ############################################################################ # displaytable # ############################################################################ # Recibe el array ROWS # # Cada elemento de ROWS es texto, con las columnas separadas por ^ # # ROW[0] se asume como header row # # # # Ejemplo: # # # # ROWS[0]='header1^header2^tercer header' # # ROWS[1]='data1^data2data2data2data2^data3' # # ROWS[2]='data4^d5 data5 data5^data5 data5data5' # # # # mostrara: # # # # +----------+-----------------------+-----------------------+ # # | header1 | header2 | tercer header | # # +----------+-----------------------+-----------------------+ # # | data1 | data2data2data2data2 | data3 | # # | data4 | d5 data5 data5 | data5 data5data5 | # # +----------+-----------------------+-----------------------+ # # # ############################################################################ ######## regex matching color sequences re='s/(e[[0-9]{1,3}(;[0-9]{1,3})*m)*//g' ######## FILLERS ######## tableborder='------------------------------------------------------------------------------------------------------' tableblanks=' ' corner='+' vertical='|' if [[ ${border} -eq 0 ]]; then corner=' '; vertical=' ' fi IFS='^' ######## CALCULATE MAX COLUMN WIDTHS into Array COL_WIDTH ######## #init array COLS=(${ROWS[0]}) for (( c=0; c < ${#COLS[@]}; c++ )); do COLS_WIDTH[${c}]=0 done #calculate for (( r=0; r < ${#ROWS[@]}; r++ )); do COLS=(${ROWS[${r}]}) for (( c=0; c < ${#COLS[@]}; c++)); do str=$(echo ${COLS[${c}]}| sed -r ${re}) if (( ${#str} > ${COLS_WIDTH[${c}]} )); then COLS_WIDTH[${c}]=${#str} fi done done ######## HEADER ######## sep='' header='' for (( c=0; c < ${#COLS_WIDTH[@]}; c++ )); do COLS=(${ROWS[0]}) sep+=${def}${corner}${tableborder:0:$((${COLS_WIDTH[${c}]}+3))}${end} str=$(echo ${COLS[${c}]}| sed -r ${re}) header+=${def}${vertical}${head}' '${COLS[${c}]}${tableblanks:0:$((${COLS_WIDTH[${c}]} + 2 - ${#str}))}${end} done i=0 if ! [[ ${border} -eq 0 ]]; then TABLE[$((++i))]=${sep}${def}${corner}${end} fi TABLE[$((++i))]=${header}${def}${vertical}${end} if ! [[ ${border} -eq 0 ]]; then TABLE[$((++i))]=${sep}${def}${corner}${end} fi ######## DATA ######## for (( r=1; r < ${#ROWS[@]}; r++ )); do line='' COLS=(${ROWS[${r}]}) for (( c=0; c < ${#COLS_WIDTH[@]}; c++)); do str=$(echo ${COLS[${c}]}| sed -r ${re}) line+=${def}${vertical}' '${COLS[${c}]}${tableblanks:0:$((${COLS_WIDTH[${c}]} + 2 - ${#str}))}${end} done TABLE[$((++i))]=${line}${def}${vertical}${end} done ######## FOOTER ######## if ! [[ ${border} -eq 0 ]]; then TABLE[$((++i))]=${sep}${def}${corner}${end} fi ######## DISPLAY ######## for (( t=1; t <= ${#TABLE[@]}; t++ )); do line=${TABLE[${t}]} echo -e ' '${line} done IFS=' ' nombre del script: managemedia (editar y guardar) grrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr ######## VARIOS audioplayer='mplayer' videoplayer='totem' ######## COLORS & such source ~/scripts/format ######## TABLE STYLE def=${bold}${desert} head=${bold}${redBG} border=0 echo ######## USAGE function usage { echo 'Usage: '$(basename $0)' [id ] | | [-f] | [-h|--h]' echo ' play' echo ' Shows a list of available streams, highlightng the current playing one, if any' echo ' play id ' echo ' Plays the required stream and shows a list of available others, highligting the current playing one' echo ' id: id of the stream to be played' echo ' nv: Optional. In case of tv streams, play audio only' echo ' play stop' echo ' Stops playing' echo ' play -f' echo ' Shows streams and pids in list' echo ' play -h|--h' echo ' Shows this help' } ######## STATIONS function stations { attr_f=${end} if [[ $1 == '-f' ]]; then header1='^STREAM' header2='^PID(s)' fi ROWS[0]='ID^TYPE^STATION'${header1}${header2}'^PLAYER' currstream=$(ps -ef|grep ${audioplayer}|grep -v grep|tail -n 1|tr -s ' '|cut -d ' ' -f10) currstream+=$(ps -ef|grep ${videoplayer}|grep -v grep|tail -n 1|tr -s ' '|cut -d ' ' -f9) for (( i=1; i < $((${#STATIONS_NAME[@]}+1)); i++)); do pids=''; proc='' attr_i='' marker='' if [[ ${STATIONS_STRM[${i}]} == ${currstream} ]]; then attr_i=${greenBG} marker=' > ' pids=$(pidof ${audioplayer})' '$(pidof ${videoplayer}) onepid=$(echo ${pids}|tr -s ' '|cut -d ' ' -f1) procn=$(ps -p $(echo ${onepid}) |grep -v grep|tr -s ' '|tail -n 1|cut -c2-90| cut -d ' ' -f4) proc=${attr_i}' > '${procn} if [[ ${procn} == ${videoplayer} ]]; then proc+=' '${end}' '${greenBG}' > video on '${end} else proc+=' '${end}' '${redBG}' > video off '${end} fi fi stream='' if [[ $1 == '-f' ]]; then stream='^'${attr_i}${marker}${STATIONS_STRM[${i}]} showpids='^'${attr_i}${marker}${pids}' ' fi ROWS[$((${i}))]=${attr_i}${marker}${i}' '${attr_f}'^'${attr_i}${marker}${STATIONS_TYPE[${i}]}' '${attr_f}'^'${attr_i}${marker}${STATIONS_NAME[${i}]}' '${attr_f}${stream}${showpids}${end}'^'${proc} done clear; echo ######## display table source ~/scripts/displaytable } ######## PLAY function playthis { for (( i=1; i < $((${#STATIONS_NAME[@]} + 1)); i++)); do if [[ $1 == ${i} ]]; then type=${STATIONS_TYPE[${i}]} stream=${STATIONS_STRM[${i}]} if [[ ${type} == 'radio' || $2 == 'nv' ]]; then video=false fi if $video; then ${videoplayer} ${stream} >/dev/null 2>&1 & else ${audioplayer} -novideo ${stream} </dev/null >/dev/null 2>&1 & fi break fi done } ######## STOP function stop { killall ${audioplayer} >/dev/null 2>&1 killall ${videoplayer} >/dev/null 2>&1 } ######## MAIN action=$1 re='^[0-9]+$' #is numeric if [[ $1 =~ $re ]]; then if ! [ $# == 2 ] || [[ $2 == 'nv' ]]; then action='play' fi fi case ${action} in play) clear; echo -e ${def}'Loading stream...'${end} stop playthis $1 $2 sleep 2 stations;; stop) clear; echo -e ${def}'Stopping...'${end} stop stations;; -f) stations '-f';; -h|--h) usage;; *) if ! [ $# -eq 0 ]; then usage else stations fi;; esac echo