maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Multimedia (https://talk.maemo.org/forumdisplay.php?f=32)
-   -   GoEar listen/download music for free bash script (https://talk.maemo.org/showthread.php?t=81037)

pulketo 2011-12-21 22:59

GoEar listen/download music for free bash script
 
Goear is a music website where you can listen to a lot of tracks for free...

i modified someone else's script to download and/or play streaming mp3 from this source.

files here, updated: 2011-12-28
update: goear changed to friendly urls

you will need to have already installed bash, wget & mplayer

Addison 2011-12-21 23:24

Re: GoEar listen/download music for free bash script
 
Can you winzip your script?

I think I somehow copied and pasted this wrong.


/usr/bin/music: line 7: *: command not found
/usr/bin/music: line 8: *: command not found
/usr/bin/music: line 9: *: command not found
/usr/bin/music: line 10: *: command not found
/usr/bin/music: line 21: *: command not found
/usr/bin/music: line 25: *: command not found
/usr/bin/music: line 26: *: command not found
/usr/bin/music: line 28: *: command not found
/usr/bin/music: line 30: wget: command not found
/usr/bin/music: line 31: *: command not found
grep: /tmp/17397-titulos.txt: No such file or directory


I have an older N800 by the way.

Addison 2011-12-21 23:26

Re: GoEar listen/download music for free bash script
 
This is what I have...


#!/bin/bash
# example: goear corey+sunglasses+at+night
# author: at least 3 bash coders
#Si el usuario no pone lo que busca en la linea de comandos, se lo pedimos.
##################
if [ -z "$1" ]; then
* * * * echo "Sintaxis:"
* * * * echo " * *$0 <artist+word1+word2>"
* * * * echo * * *Note: Argument must be plus\(+\) separated or between \"\"
* * * * exit
fi
##################
tmpdir=/tmp
prefix=$RANDOM
SEARCH=$tmpdir/$prefix-titulos.txt
CANCIONES=$tmpdir/$prefix-canciones.txt
ENLACES=$tmpdir/$prefix-enlaces.txt
TITULOS=$tmpdir/$prefix-titulos.txt
TODOWNLOAD=$tmpdir/$prefix-download.txt
##################
*
if [ $1 ]; then
* * * * TITULO="$@"
else
* * * * echo "Title and Artist:"
* * * * read TITULO
fi
*
#Descargamos el PHP correspondiente al título.
wget http://goear.com/search.php?q="$TITULO" -O $SEARCH
*
#line number containing links is always changing so looking for a pattern
head -$(grep -i -n -e 'ventana independiente' $SEARCH | cut -d ":" -f 1) $SEARCH | tail -1 > $CANCIONES
*
#Mediante ER, obtenemos una lista de canciones y una lista de enlaces.
#By using RegExp... we get song list and links
egrep -o 'listen/......./[^"]*' $CANCIONES > $ENLACES
egrep -o '"Escuchar[^"]*' $CANCIONES | grep -v 'en una ventana independiente' > $TITULOS
*
#Mostramos al usuario los que ha encontrado en la primera página.
Linea=1
cat $TITULOS | while read line;
* * * * do {
* * * * * * * * echo $Linea: ${line:9}
* * * * * * * * let 'Linea += 1'
* * * * }
* * * * done
*
#Si no encuentra nada, sale.
CONDICION=`wc -l $TITULOS | awk '{print $1}'`
if [ $CONDICION == 0 ]; then
* * * * echo "No hay resultados. Prueba buscando otra cosa."
* * * * rm -f $SEARCH $CANCIONES $ENLACES $TITULOS
* * * * exit
fi
*
#Leemos qué canción quiere el usuario bajarse.
echo "¿Cuál te quieres bajar? Indica el número: (0 para Cancelar)"
read NUMERO
*
#Cero para Cancelar
if [ $NUMERO = 0 ]; then
* * * * rm -f $SEARCH $CANCIONES $ENLACES $TITULOS
* * * * echo "Hasta pronto."
* * * * exit
fi
*
#Concatenamos http://www.goear.com con el contenido de aBajar.txt.
#PD: Alguien sabe hacerlo de manera más sencilla?
GOEAR=http://www.goear.com/
head -$NUMERO $ENLACES | tail -1 > $TODOWNLOAD
for LISTEN in `cat $TODOWNLOAD`
do
* * * * ENLACE=${GOEAR}${LISTEN}
done
echo $ENLACE
*
#A partir de aquí el script no es mío, pero es muy sencillo de leer.
fileid=`echo $ENLACE | cut -d '/' -f 5`
xmlurl="http://www.goear.com/tracker758.php?f="$fileid
infoline=`wget -qO- $xmlurl | grep ".mp3"`
mp3url=`echo $infoline | cut -d '"' -f6`
artist=`echo $infoline | cut -d '"' -f10`
title=`echo $infoline | cut -d '"' -f12`
rm -f $SEARCH $CANCIONES $ENLACES $TITULOS $TODOWNLOAD
wget $mp3url -O "$artist"_-_"$title.mp3"
#mplayer -cache 1024 -softvol -softvol-max 1000 $mp3url

pulketo 2011-12-22 00:21

Re: GoEar listen/download music for free bash script
 
http://www.megaupload.com/?d=DX0FPT4E

anthonie 2011-12-22 00:44

Re: GoEar listen/download music for free bash script
 
@Addison

Clean out the code by removing the unwanted characters that have been copy/pasted by accident (the * characters, that is) and the code will run fine, be it slow.

Edit: Oh, and make sure you have wget installed.

Addison 2011-12-22 04:18

Re: GoEar listen/download music for free bash script
 
Neat script.

Thank you. :)

I've tried 4 different artists, but for each of them, there was only one song available to choose from.

Also, the audio quality was fairly low, maybe at best, a constant 160 kbps.

Still cool though downloading from Xterm. :)

pulketo 2011-12-22 06:47

Re: GoEar listen/download music for free bash script
 
that site is mainly for spanish speakers, let's make it global, upload your music :) www.goear.com

Quote:

Originally Posted by Addison (Post 1140638)
Neat script.

Thank you. :)

I've tried 4 different artist, but for each of them, there was only one song available to choose from.

Also, the audio quality was fairly low, maybe at best, a constant 160 kbps.

Still cool though downloading from Xterm. :)


Addison 2011-12-22 07:14

Re: GoEar listen/download music for free bash script
 
I'd rather take than give when it comes to music. :)


All times are GMT. The time now is 06:36.

vBulletin® Version 3.8.8