You are not logged in.

#1 2008-01-20 20:56:36

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

[UPDATED] The Jamendo Tag Browser CLI interface

I have created a nifty browser in Bash. I know it has many flaws, but it just does the job, and quickly too tongue
It basically lets you search for multiple tags and choose the number of results you want to view. Then you can simply select the album and it will start playing straight away.

Please note that my experience in programming is minimal, in fact I'm still learning the basics.
For this script you will need MPD, mpc and w3m. Feel free to improve it, pass it on and such.

I'm also planning to start a project for a more complete Jamendo browser in ncurses. Of course that will be my learning experience for both C and Ncurses tongue

You can get it here.

Enjoy the music! smile

EDIT: I have updated the script, thanks for all your suggestions, especially Daenyth. You can get it at the same URL.


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#2 2008-01-22 01:26:42

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Wow. It's working "out of the box" for me, I'm listening to Jamendo right now! I'll read the code and give more feedback in a while. Thank you so much!

Offline

#3 2008-01-22 01:48:54

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Thank you for trying it out, I'm happy it's working fine for you smile


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#4 2008-01-22 17:31:06

gazj
Member
From: /home/gazj -> /uk/cambs
Registered: 2007-02-09
Posts: 681
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

This is Fantastic, didn't even know about the site until I saw this thread.  Fantastic cli interface as well smile Thanks

Offline

#5 2008-01-22 18:51:38

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Yeah! Jamendo is a fantastic project smile
Thanks for your comment big_smile


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#6 2008-01-23 01:18:03

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

If you're planning an ncurses version, you might want to write it in perl. I see from your script that you're pretty good at bash, sed and awk, and you say you're learning C; perl is like a mix of these languages, but it's very convenient to write and very powerful when it comes to manipulating strings.

Offline

#7 2008-01-23 10:58:35

Theomachos
Member
From: Germany
Registered: 2007-07-31
Posts: 67
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Minimal...functional...your script is....simply ARCH wink

Great work !


There is one thing even more vital to science than intelligent methods; and that is, the sincere desire to find out the truth, whatever it may be.
Charles S. Peirce

Offline

#8 2008-01-23 12:43:05

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

@ peets
Thanks for the feedback smile
Actually most of what I managed to do was out of intuition more than experience tongue I know very very little of awk, and just a bit of sed...
Anyway, I don't really like the approach I have used to do this, I find it a bit too trivial (everything is based on the line numbers, rather than on the album ID), and I hope I will not have to manipulate strings that way. I was thinking of learning C primarily because I think it's a good way to get into programming, and also because the Ncurses guide I found always brings parallels with C, and I didn't really understand.

@ Theomachos
Yeah, I love minimalism!
Thanks smile


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#9 2008-01-23 19:57:17

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Hey finferflu,

Great script. I'm not a mpd/mpc user so I adjusted the script for moc and it works beautifully.

If anyones interested here's the change:

# play album via moc
    mocp -c; mocp -a `w3m -no-cookie -dump \`w3m -no-cookie -dump http://www.jamendo.com/get/album/name/tag/audio/plain/${tag// /+}/?n=$n | sed -n "$number"p\``; mocp -p

Thanks

Last edited by Ashren (2008-01-23 20:00:03)

Offline

#10 2008-01-24 03:43:31

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Cool! I'm happy to see it's even "portable" big_smile


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#11 2008-01-27 02:42:17

George_K
Member
From: Russie, Saint-Pétersbourg
Registered: 2006-09-27
Posts: 75

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Thank you, it works well!
Came to this thread from here: http://kmandla.wordpress.com/2008/01/27 … r-project/

Offline

#12 2008-01-27 09:05:05

el mariachi
Member
Registered: 2007-11-30
Posts: 595

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Great script! I also found about it from K. Mandla.

It's not working with mpd for me though..
edit2: i didn't have mpc installed... it works now

Last edited by el mariachi (2008-01-27 09:11:11)

Offline

#13 2008-01-28 04:07:03

mauriicio
Member
From: São Paulo, Brasil
Registered: 2008-01-28
Posts: 6

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Hi finferflu !

I'm new on Linux, ubuntu-user.
I installed your program, but received error message:

53: Syntax error: Bad substitution

I have MPD, mpc and w3m.
Thanks for attention !
(Sorry my english... smile

Maurício

Offline

#14 2008-01-28 05:31:38

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Maurício, do you get that error every time?

This is line 53 in the version of the script I have:

w3m -no-cookie -dump http://www.jamendo.com/get/album/name/tag/desc1/plain/${tag// /+}/?n=$n > /tmp/jamdump;

The substitution taking place is this: all spaces in the tag you entered are replaced by '+'. It works for me.

Maybe what can go wrong is:
- bad bash version (unlikely)
- bad script version? (I think there's only one... make sure your line 53 is identical to mine)
- some locale/encoding error (accentuated characters, etc. (worked for me when I tried 'é' and 'è')
- something else?

Offline

#15 2008-01-28 09:17:30

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

@ George_K, el mariachi
Thanks for your feedback, I'm happy you liked it smile

@ mauriicio
I think peets knows more than me, but another suggestion I might add is: how did you "install" the script? If you copied it into a file, check that you didn't add any character into the script by mistake.

Thanks peets for helping out smile


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#16 2008-01-28 16:15:46

mauriicio
Member
From: São Paulo, Brasil
Registered: 2008-01-28
Posts: 6

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Hi guys !

I am new in Linux, I made this:
Copy the program into a file, authorized execution, named "jammpd.sh", and in the terminal, "sh jammpd.sh".
This is correct ?
My line 53 is the same.
I used other scripts, no problem.
Maybe I should install any other program ?
I missed something ?
Thanks for your attention !

Maurício

Offline

#17 2008-01-28 16:29:08

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Try to run it in this way: from the directory where you have the file, run:

./jammpd.sh

If it still gives you problems, try to remove the .sh from the file name. It works for me like that.


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#18 2008-01-28 16:51:36

mauriicio
Member
From: São Paulo, Brasil
Registered: 2008-01-28
Posts: 6

Re: [UPDATED] The Jamendo Tag Browser CLI interface

YES !!!

Is working !
Thanks !
What's the difference between "./jampd.sh" and "sh jampd.sh" ?
Thanks for attention !!!

Maurício

Offline

#19 2008-01-28 17:01:51

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

I'm not so sure, but I think that you were trying to invoke a bash script with shell. Bash has its own built-ins, which apparently do not always work with plain shell.


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#20 2008-01-28 17:14:29

mauriicio
Member
From: São Paulo, Brasil
Registered: 2008-01-28
Posts: 6

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Ok !
I using your program with moc and works !
Thanks for attention !
Peace !

Maurício

Offline

#21 2008-01-28 17:28:38

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Glad you like it smile
To inaugurate the event, let me suggest you an album: Gerador Zero - #!/bin/bash.

Enjoy the music big_smile


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#22 2008-01-28 17:41:35

mauriicio
Member
From: São Paulo, Brasil
Registered: 2008-01-28
Posts: 6

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Very good !

Listen to: www.jamendo.com/en/artist/pedro.collares
Relax sound, I like it too !
Enjoy !

Maurício

Offline

#23 2008-01-29 12:46:38

George_K
Member
From: Russie, Saint-Pétersbourg
Registered: 2006-09-27
Posts: 75

Re: [UPDATED] The Jamendo Tag Browser CLI interface

I would suggest to sort the list of albums (at least in case user selected to show all albums):

EDIT: this code is not working because it is not enough

52 # store the list in a temporary file
53 w3m -no-cookie -dump http://www.jamendo.com/get/album/name/tag/desc1/plain/${tag// /+}/?n=$n | ( [ "$n" = "all" ] && sort || cat ) > /tmp/jamdump;

Last edited by George_K (2008-01-29 12:51:30)

Offline

#24 2008-01-29 12:55:15

George_K
Member
From: Russie, Saint-Pétersbourg
Registered: 2006-09-27
Posts: 75

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Maybe I will rewrite this script in python.

Offline

#25 2008-01-29 13:03:31

George_K
Member
From: Russie, Saint-Pétersbourg
Registered: 2006-09-27
Posts: 75

Re: [UPDATED] The Jamendo Tag Browser CLI interface

Ok, this works:

57 # display a reformatted list with colourised line numbers for easy selection ;)
58 sed = /tmp/jamdump | sed 'N;s/\n/\t/' | ( [ "$n" = "all" ] && sort -k 2 || cat ) | \

(Previous patch of lines 52 and 53 is not needed).

Last edited by George_K (2008-01-29 13:04:21)

Offline

Board footer

Powered by FluxBB