Update of /cvsroot/freevo/freevo/src/audio/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv21012
Modified Files:
coversearch.py
Log Message:
Initial revision is complete, current main problem is that it only
writes 'cover.jpg' someone could add a submenu to choose between
per-file or per-directory images, but I have to go to class now.
I've tested this, but please let me know if you find problems.
Index: coversearch.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/audio/plugins/coversearch.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** coversearch.py 7 Jun 2003 18:43:26 -0000 1.1
--- coversearch.py 10 Jun 2003 13:13:55 -0000 1.2
***************
*** 14,17 ****
--- 14,24 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.2 2003/06/10 13:13:55 outlyer
+ # Initial revision is complete, current main problem is that it only
+ # writes 'cover.jpg' someone could add a submenu to choose between
+ # per-file or per-directory images, but I have to go to class now.
+ #
+ # I've tested this, but please let me know if you find problems.
+ #
# Revision 1.1 2003/06/07 18:43:26 outlyer
# The beginnings of a cover search plugin to complement Dischi's IMDB plugin
***************
*** 92,138 ****
amazon.setLicense('...') # must get your own key!
cover = amazon.searchByKeyword('%s %s' % (artist,album) ,
product_line="music")
! print cover[0].ImageUrlLarge
!
! #name = os.path.basename(os.path.splitext(name)[0])
! #name = re.sub('([a-z])([A-Z])', point_maker, name)
! #name = re.sub('([a-zA-Z])([0-9])', point_maker, name)
! #name = re.sub('([0-9])([a-zA-Z])', point_maker, name.lower())
! #parts = re.split('[\._ -]', name)
!
! #name = ''
! #for p in parts:
! # name += '%s ' % p
!
! #items = []
! #for id,name,year,type in helpers.imdb.search(name):
! # items += [ menu.MenuItem('%s (%s, %s)' % (name, year, type),
! #self.imdb_create_fxd, (id, year)) ]
! #moviemenu = menu.Menu('IMDB QUERY', items)
box.destroy()
! #menuw.pushmenu(moviemenu)
! print album
! print artist
! box = PopupBox(text='Artist: %s\nAlbum: %s\nURL: %s\n' % (str(artist),
str(album),str(cover[0].ImageUrlLarge)))
! box.show()
! import time
! time.sleep(2)
! box.destroy()
return
! def imdb_create_fxd(self, arg=None, menuw=None):
"""
! create fxd file for the item
"""
! import helpers.imdb
import directory
box = PopupBox(text='getting data...')
box.show()
! filename = os.path.splitext(self.item.filename)[0]
! helpers.imdb.get_data_and_write_fxd(arg[0], filename, None, None,
! (self.item.filename, ), None)
# check if we have to go one menu back (called directly) or
--- 99,137 ----
amazon.setLicense('...') # must get your own key!
cover = amazon.searchByKeyword('%s %s' % (artist,album) ,
product_line="music")
! items = []
! for i in range(len(cover)):
! items += [ menu.MenuItem('%s' % cover[i].ProductName,
! self.cover_create, cover[i].ImageUrlLarge) ]
! moviemenu = menu.Menu('Cover Results', items)
box.destroy()
! menuw.pushmenu(moviemenu)
return
! def cover_create(self, arg=None, menuw=None):
"""
! create cover file for the item
"""
! import amazon
import directory
+ import urllib2
+ # image Image, cStringIO # Required if you want to convert the file into
something, Amazon
+ # only has JPEGs so it's a wasted step.
box = PopupBox(text='getting data...')
box.show()
! #filename = os.path.splitext(self.item.filename)[0]
! filename = '%s/cover.jpg' % (os.path.dirname(self.item.filename))
!
! fp = urllib2.urlopen(str(arg))
! m = open(filename,'wb')
! m.write(fp.read())
! m.close()
! fp.close()
! #img = cStringIO.StringIO(fp.read())
! #Image.open(img).save(filename)
!
# check if we have to go one menu back (called directly) or
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog