Download covers from amazon

Discussion about user contributed plugins

Moderator: Moderator

playya
Posts: 22
Joined: Thu Feb 28, 2008 5:49 pm
Contact:

Download covers from amazon

Postby playya » Thu Feb 28, 2008 9:01 pm

Hi,

i just hacked up a short script to download covers from amazon. it works until i want to have the filename with an öäüß in it.



Code: Select all

    self.filenames = self.musicc.execute("SELECT au.filename AS filename, ar.name AS artist, al.name AS album FROM Audio au,Artist ar, Album al WHERE (au.Artist=ar.id AND au.Album=al.id)").fetchall()
sqlite3.OperationalError: Could not decode to UTF-8 column 'filename' with text '/home/playya/stuff/playya/share/mp3/D-Flame_Basstard/05_Sie Macht Mich Gl�cklich.mp3'



has this to be change when inserting into the database?

Greetings

Frederik

Fredde
veteran
Posts: 288
Joined: Tue Dec 06, 2005 7:18 am
Location: Sweden

Re: Download covers from amazon

Postby Fredde » Thu Feb 28, 2008 9:15 pm

You could try to iterate the result from the execute method (not using the fetchall method). And then encode it to utf8.

Code: Select all

    result = self.musicc.execute("SELECT au.filename AS filename, ar.name AS artist, al.name AS album FROM Audio au,Artist ar, Album al WHERE (au.Artist=ar.id AND au.Album=al.id)")

for r in result:
  print r[0].encode('utf8')

playya
Posts: 22
Joined: Thu Feb 28, 2008 5:49 pm
Contact:

please test

Postby playya » Mon Mar 03, 2008 11:50 pm

Hi

i think now is the time to show something.
atm there is no GUI available because i am not good in this disciplin and it has some issues with mutated vowels.
but i can remove the white borders from some amazon pics.

    download both files
    make them executable: chmod +x amazon.py updatepics.py



Download amazon.py
Download updatepics.py

thx to Uatschitchun

if you only want to test the cover download try ./amazon.py <artist> <album> and it tries to get the cover and downloads it to ~/.mms/covers

to update covers use ./updatepics.py without any parameters. it will save the picture to the dir of the file with the filename .front-cover.jpg


i will upload the code with comments tomorrow

gl&&hf
Frederik
Last edited by playya on Tue Mar 04, 2008 10:54 pm, edited 4 times in total.

User avatar
acmelabs
Overlord
Posts: 2365
Joined: Mon Feb 20, 2006 9:18 pm
Location: Germany
Contact:

Re: Download covers from amazon

Postby acmelabs » Tue Mar 04, 2008 7:01 am

playya wrote:...

http://pastebin.ca is your friend :-)
Great job anyway - thanks a lot!

playya wrote:...mutated vovels...
LOL :D

Regards,
Andreas

User avatar
Uatschitchun
Overlord
Posts: 3189
Joined: Tue Dec 06, 2005 6:55 pm
Location: Germany
Contact:

Postby Uatschitchun » Tue Mar 04, 2008 7:26 am

sorry. i do not have any webspace atm so you have to do a copy&paste.

Here you are:
http://www.prodeia.de/mms/pyglets/

Could you drop a few lines (Readme) on what these scripts do and how to use them?
Lg
Roman

playya
Posts: 22
Joined: Thu Feb 28, 2008 5:49 pm
Contact:

Postby playya » Tue Mar 04, 2008 9:57 pm

here a picture of the gui i designed. do think about the colors. just a shematic ;)

Image

User avatar
acmelabs
Overlord
Posts: 2365
Joined: Mon Feb 20, 2006 9:18 pm
Location: Germany
Contact:

Postby acmelabs » Wed Mar 05, 2008 6:40 am

playya wrote:here a picture of the gui i designed. do think about the colors. just a shematic ;)

http://img504.imageshack.us/img504/1657 ... cn6.th.jpg

Great :D

I would use for background the MMS neutral background, like the other Pyglets do. (Just a suggestion)

And would you mind to insert this masterpiece into our Wiki?
http://mymediasystem.org/wiki/index.php ... ad_Pyglets

Again, great work! Thanks a lot.

Regards,
Andreas

playya
Posts: 22
Joined: Thu Feb 28, 2008 5:49 pm
Contact:

Postby playya » Wed Mar 05, 2008 10:16 am

yes of course.

i first have to find out how to do this all in python.
thought of reading the colors from theme configuration if this is possible

regards
frederik

User avatar
acmelabs
Overlord
Posts: 2365
Joined: Mon Feb 20, 2006 9:18 pm
Location: Germany
Contact:

Postby acmelabs » Wed Mar 05, 2008 10:28 am

playya wrote:yes of course.

i first have to find out how to do this all in python.
thought of reading the colors from theme configuration if this is possible

regards
frederik

err, ... as far as I know the background is a picture (png) and it's a one- or two liner. Hadn't seen anybody using theme.conf so far.

Thanks!

Regards,
Andreas

playya
Posts: 22
Joined: Thu Feb 28, 2008 5:49 pm
Contact:

some problems :(

Postby playya » Tue Mar 11, 2008 9:30 pm

Hi,

just tried to build a gui. hope you like it. but now i have some problems.

http://pastebin.ca/index.php

think its in line 281.

i want to finalize it for the next weeks. have to do a lot of documentation, but can't keep my fingers of it ;)

regards frederik

Fredde
veteran
Posts: 288
Joined: Tue Dec 06, 2005 7:18 am
Location: Sweden

Re: some problems :(

Postby Fredde » Thu Mar 13, 2008 6:50 am

playya wrote:Hi,

just tried to build a gui. hope you like it. but now i have some problems.

http://pastebin.ca/index.php

think its in line 281.


The url seems to be a little bit to short.

User avatar
acmelabs
Overlord
Posts: 2365
Joined: Mon Feb 20, 2006 9:18 pm
Location: Germany
Contact:

Re: some problems :(

Postby acmelabs » Thu Mar 13, 2008 6:59 am

Fredde wrote:
playya wrote:Hi,

just tried to build a gui. hope you like it. but now i have some problems.

http://pastebin.ca/index.php

think its in line 281.


The url seems to be a little bit to short.

LOL :D good one!

playya
Posts: 22
Joined: Thu Feb 28, 2008 5:49 pm
Contact:

Postby playya » Sat Mar 15, 2008 3:02 pm

i'm an idiot

her the correct one
http://pastebin.ca/943716

Fredde
veteran
Posts: 288
Joined: Tue Dec 06, 2005 7:18 am
Location: Sweden

Postby Fredde » Sat Mar 15, 2008 3:45 pm

Well, you are using urllib, but I don't see any import of it.

Code: Select all

import urllib

playya
Posts: 22
Joined: Thu Feb 28, 2008 5:49 pm
Contact:

Postby playya » Sat Mar 15, 2008 7:18 pm

oops
copy mistake
this works now

but the picture in the middle isn't updating an the table in the middle appears only at the end.
do i have to use an additional thread to get some refreshes on the screen?

Regards
Frederik


Return to “user plugins”

Who is online

Users browsing this forum: No registered users and 1 guest