Download covers from amazon

Discussion about user contributed plugins

Moderator: Moderator

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

Postby Fredde » Sun Mar 16, 2008 10:48 am

playya wrote: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?

The screen is updated after every user action. That usually means after some of the onAction, onClick, onFocus, ... methods have completed. If you can't wait for the methods to complete use the mmsv2gui.redraw() function to update the screen.

Hope that helps.

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

Postby playya » Tue Mar 18, 2008 1:26 pm

Hi,
this works now.

but does redraw return?

the script only downloads only 1 picture and stops.

any ideas?

i update the paste

User avatar
AndyWxy
Posts: 8
Joined: Sun Mar 16, 2008 4:09 pm

Postby AndyWxy » Tue Mar 18, 2008 1:53 pm

How to use plugin? I really wanna know ...

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

Postby acmelabs » Tue Mar 18, 2008 2:18 pm

AndyWxy wrote:How to use plugin? I really wanna know ...

@Playya
could you give us an update about your progresses?
Is the HowTo from your 3rd post in this thread still valid?

Are you about to put you script into wiki?
I can't even say, if this is a Pyglet at all, because I can't have a look at it.
Download source: http://www.prodeia.de/mms/pyglets/
Image
and this comes, if I try to download it : (Access forbidden)
Image

Could you please bring a bit light into the darkness ;-) ?

Thanks a lot,
Regards,
Andreas

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

Postby playya » Tue Mar 18, 2008 9:14 pm

Hi,

wiki: http://wiki.mymediasystem.org/wiki/inde ... ad_Pyglets

Download: http://rapidshare.de/files/38866015/gui.py.html


needed packages:
python-imaging python-sqlite

current issues:
-mms crashes if the script was started.
-the script stops after refreshing
-the script downloads all possible covers
-no other themes tested

to start the search go on left button and klick it.
to leave go back to the right.

i wil upload a smaller picture soon.

Best regards,

Frederik
Last edited by playya on Tue Mar 18, 2008 9:42 pm, edited 1 time in total.

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

Postby acmelabs » Tue Mar 18, 2008 9:28 pm

playya wrote:Hi,

i tried to add it to the wiki page but do not have edit permissions.

Hi Frederik,

You now have editor rights.

Regards,
Andreas

PS: thanks a lot for update

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

Postby Fredde » Tue Mar 18, 2008 9:42 pm

playya wrote:Hi,
...
-the script stops after refreshing
...

Saw in the python code that you use self.redraw(). That method is not present (that's problably why it stops) in the current version of the python plugin. You should instead use:

Code: Select all

mmsv2gui.redraw()

I need to update the python plugin docs :oops:

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

Postby acmelabs » Tue Mar 18, 2008 10:02 pm

Fredde wrote:
playya wrote:Hi,
...
-the script stops after refreshing
...

Saw in the python code that you use self.redraw(). That method is not present (that's problably why it stops) in the current version of the python plugin. You should instead use:

Code: Select all

mmsv2gui.redraw()

I need to update the python plugin docs :oops:

Fredde, don't beat me, but where are the python plugin docs? *duck*

Regards,
Andreas

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

Postby playya » Tue Mar 18, 2008 10:06 pm

HI,

thx fredde. missed that python doesn't inherit all methods in self.

new download: http://rapidshare.de/files/38867115/gui.py.html

i'l get my own webserver the next days

regards Frederik

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

Postby Fredde » Wed Mar 19, 2008 6:02 am

acmelabs wrote:Fredde, don't beat me

I promise not to :D
acmelabs wrote:but where are the python plugin docs? *duck*

They should be in

Code: Select all

mms-tree/doc/plugins/python/

Should contain 3 pdf-files, and a xml-file, but they are outdated. I will update them during next week.

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

Postby Fredde » Thu Mar 20, 2008 8:07 am

I tested the script. The script crash mms on exit if there is an update.

I checked the class PictureUpdater, method onAction:

Code: Select all

...
for p,f in imgs.iteritems():   
   print p,"#",f
   try:
      self.musicc.execute("INSERT INTO Covers VALUES (?,?)",(p+"/",f))
   except sqlite3.IntegrityError:
      self.musicc.execute("UPDATE Covers SET Cover=? WHERE Path=? AND Cover=''",(f,p+"/"))
...

musicc is not a attribute in this class (I found it in the class updatepics). calling self.musicc.execute("INSERT INTO Covers VALUES (?,?)",(p+"/",f)) will generate an exception that is not caught.

The attribute self.up (in class PictureUpdater) is of type updatepics. I tried using:

Code: Select all

self.up.musicc.execute("INSERT INTO Covers VALUES (?,?)",(p+"/",f))

But that didn't work.

I'am not familar with the mms audio db (how it is used). One problem could be that inserts, updates and deletes are not allowed from multiple threads with sqlite. The db could be opened and not closed before running this script (the python script is running from a thread that is separate from the thread that started the python plugin).

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

Postby playya » Thu Mar 20, 2008 1:55 pm

Hi,

yes it is a problem with the db because everyone who connects gets an own snapshot. this causes that the covers are only availble afeter a restart.

maybe we should also add the database connections to the python API.

just noticed that i write on the notification area.

regards frederik

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

new status control

Postby playya » Thu Mar 20, 2008 2:32 pm

hi again,

i tried this:

Code: Select all

class StatusList(mmsv2gui.ListControl):
        items = [ ]

        def __init__(self,xpos,ypos,xsize,ysize):
                mmsv2gui.ListControl.__init__(self,xpos,ypos,xsize,ysize)
                self.setLabel("Status")
        def addItem(self,item):
                print "add item:",len(self.items)
                if len(self.items) >=4:
                        print "deleting one item"
                        tmp = self.pop(0)
                        mmsv2gui.ListControl.removeItem(tmp)
                        #self.items = self.items[1:]
                self.items.append(item)
                print self.items
                mmsv2gui.ListControl.addItem(self,item)
                return True


to get a list of the for last items. but now nothing is displayed

do i need somethng like this:

Code: Select all

def redraw(self):
   return mmsv2gui.ListControl.redraw(self)


regards frederik

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

Re: new status control

Postby Fredde » Sat Mar 22, 2008 7:13 pm

playya wrote:hi again,

i tried this:

Code: Select all

class StatusList(mmsv2gui.ListControl):
        items = [ ]

        def __init__(self,xpos,ypos,xsize,ysize):
                mmsv2gui.ListControl.__init__(self,xpos,ypos,xsize,ysize)
                self.setLabel("Status")
        def addItem(self,item):
                print "add item:",len(self.items)
                if len(self.items) >=4:
                        print "deleting one item"
                        tmp = self.pop(0)
                        mmsv2gui.ListControl.removeItem(tmp)
                        #self.items = self.items[1:]
                self.items.append(item)
                print self.items
                mmsv2gui.ListControl.addItem(self,item)
                return True


to get a list of the for last items. but now nothing is displayed


Code: Select all

mmsv2gui.ListControl.__init__(self,xpos,ypos,xsize,ysize)

I did not implement any init method in the c code for controls. When you create a StatusList, just pass the same args as you would to a "normal" ListControl.

Code: Select all

self.setLabel("Status")

There is no setLabel method in the ListControl (only in LabelControl)

Code: Select all

tmp = self.pop(0)

There is no pop method in the ListControl. Should it be self.items.pop(0)?

Code: Select all

mmsv2gui.ListControl.removeItem(tmp)

There is no removeItem method in the ListControl. There probably should be one. I could add that.

playya wrote:do i need somethng like this:

Code: Select all

def redraw(self):
   return mmsv2gui.ListControl.redraw(self)


regards frederik

There is no redraw method for controls, only the "global" function mmsv2gui.redraw() that will render the current active window.

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

Postby Fredde » Mon Mar 24, 2008 5:56 pm

Fredde wrote:Should contain 3 pdf-files, and a xml-file, but they are outdated. I will update them during next week.

Update done!


Return to “user plugins”

Who is online

Users browsing this forum: No registered users and 3 guests