Update of /cvsroot/freevo/freevo/src/audio
In directory sc8-pr-cvs1:/tmp/cvs-serv25008

Modified Files:
        audiodiskitem.py 
Log Message:
o Don't show image menu when there is only one choice
o change event name to imdb_search_or_cover_search to make it possible to
  use imdb.py and cover_search.py with the same key


Index: audiodiskitem.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/audio/audiodiskitem.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** audiodiskitem.py    26 Apr 2003 20:55:45 -0000      1.12
--- audiodiskitem.py    23 Jun 2003 19:52:30 -0000      1.13
***************
*** 32,41 ****
  from playlist import Playlist, RandomPlaylist
  
- # CDDB Stuff
- try:
-     import DiscID, CDDB
- except:
-     pass
- 
              
  class AudioDiskItem(Playlist):
--- 32,35 ----
***************
*** 43,53 ****
      class for handling audio disks
      """
!     def __init__(self, disc_id, parent, name = '', devicename = None, display_type = 
None):
  
          Item.__init__(self, parent)
!         self.type = 'dir'
          self.media = None
          self.disc_id = disc_id
          self.devicename = devicename
          
          # variables only for Playlist
--- 37,48 ----
      class for handling audio disks
      """
!     def __init__(self, disc_id, parent, devicename = None, display_type = None):
  
          Item.__init__(self, parent)
!         self.type = 'audiocd'
          self.media = None
          self.disc_id = disc_id
          self.devicename = devicename
+         self.name = 'Unknown CD Album'
          
          # variables only for Playlist
***************
*** 57,61 ****
  
          # variables only for DirItem
-         self.dir          = dir
          self.display_type = display_type
  
--- 52,55 ----
***************
*** 66,77 ****
              setattr(self, v, eval('config.%s' % v))
  
-         (query_stat, query_info) = CDDB.query(self.disc_id)
-     
-         if query_stat == 200:
-             self.name = query_info['title']
-         elif query_stat == 210 or query_stat == 211:
-             self.name = query_info[0]['title']
-         else:
-             self.name = 'Unknown CD'
  
      def copy(self, obj):
--- 60,63 ----
***************
*** 80,84 ****
          """
          Playlist.copy(self, obj)
!         if obj.type == 'dir':
              self.dir          = obj.dir
              self.display_type = obj.display_type
--- 66,70 ----
          """
          Playlist.copy(self, obj)
!         if obj.type == 'audiocd':
              self.dir          = obj.dir
              self.display_type = obj.display_type
***************
*** 97,138 ****
          make a menu item for each file in the directory
          """
-         # Problems with disc id:
-         # [2114541066, 10, 150, 17220, 36170, 54412, 68800, 91162, 112110, 129230,
-         #  141320, 165100, 2392]
-         # Returns multiple results
-         print self.disc_id
-         (query_stat, query_info) = CDDB.query(self.disc_id)
-         
-         if query_stat == 200:
-             print ("success!\nQuerying CDDB for track info of `%s'... " % \
-                    query_info['title']),
-             (read_stat, read_info) = CDDB.read(query_info['category'],
-                                                query_info['disc_id'])
-             if read_stat != 210:
-                 print "failure getting track info, status: %i" % read_stat
-         elif query_stat == 210 or query_stat == 211:
-             print "multiple matches found! Matches are:"
-             for i in query_info:
-                  print "ID: %s Category: %s Title: %s" % \
-                        (i['disc_id'], i['category'], i['title'])
-             # We just pick the first one
-             query_info = query_info[0]
-             (read_stat, read_info) = CDDB.read(query_info['category'],
-                                                query_info['disc_id'])
-             query_stat = 200 # Good data, used below
-             if read_stat != 210:
-                 print "failure getting track info, status: %i" % read_stat
-         else:
-             print "failure getting disc info, status %i" % query_stat
- 
          play_items = []
!         for i in range(0, self.disc_id[1]):
!             if query_stat == 200 and read_stat == 210:
!                 title = read_info['TTITLE' + `i`]
!             else:
!                 title = '(Track %s)' % (i+1)
              item = AudioItem('cdda://%d' % (i+1), self, None, title)
-             item.set_info('', self.name, title, i+1, self.disc_id[1], '')
  
              if config.MPLAYER_ARGS.has_key('cd'):
                  item.mplayer_options += (' ' + config.MPLAYER_ARGS['cd'])
--- 83,96 ----
          make a menu item for each file in the directory
          """
          play_items = []
!         for i in range(0, len(self.info['tracks'])):
!             title=self.info['tracks'][i]['title']
              item = AudioItem('cdda://%d' % (i+1), self, None, title)
  
+             # XXX FIXME: set also all the other infos here if AudioInfo
+             # XXX will be based on mmpython
+             item.set_info('', self.name, title, i+1, self.disc_id[1], '')
+             item.info = self.info['tracks'][i]
+             item.length = item.info['length']
              if config.MPLAYER_ARGS.has_key('cd'):
                  item.mplayer_options += (' ' + config.MPLAYER_ARGS['cd'])




-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to