1. sakal
  2. VPlayer

Commits

A2K  committed 5098fbd

Do not resolve bitrate and album for deleted tracks

  • Participants
  • Parent commits 8fc8cf2
  • Branches default

Comments (0)

Files changed (8)

File albumresolver.py

View file
  • Ignore whitespace
                     continue
                 log.debug("Resolvind album for " + unicode(track))
                 track.get_album()
-                self.queue.popleft()
+                try: self.queue.popleft()
+                except: pass
                 log.debug('Resolved')
                 #if track._album is None:
                 #    track.got_album = False

File bitrateresolver.py

View file
  • Ignore whitespace
                     continue
                 #log.debug("Resolvind bitrate for " + unicode(track))
                 track.get_filesize()
-                self.queue.popleft()
+                try: self.queue.popleft()
+                except: pass
                 if track.filesize is None:
                     track.got_size = False
                     self.add(track)

File guicomponents/playlistwidget.py

View file
  • Ignore whitespace
 
     def playlist_updated(self, *args):
         count = self.playlist_model.rowCount()
-        print count
         self.ui.clear_button.setEnabled(bool(count))
 
         def sec_to_time(s):

File guicomponents/searchwidget.py

View file
  • Ignore whitespace
 
     def results_receiver(self, results):
         log.debug('Got %d search results' % len(results))
+        for track in self.results_model.tracks:
+            track.prepare_to_die()
         self.results_model.set_data(results)
 
     def more_results_receiver(self, results):

File guicomponents/trackinfowidget.py

View file
  • Ignore whitespace
             else:
                 self.ui.bitrate.setText(self.tr('Unknown'))
             if track.album:
-                print track.album
                 self.ui.album.setText(track.album)
             else:
                 self.ui.album.setText(self.tr('Unknown'))

File resultsmodel.py

View file
  • Ignore whitespace
 
     def set_data(self, data):
         "Use this method to set model content"
+        for track in self.tracks:
+            track.prepare_to_die()
         self.tracks = copy.copy(data)
         for track in self.tracks:
             track.set_parent(self)
                                 idx1, idx2)
 
     def clear(self):
+        for track in self.tracks:
+            track.prepare_to_die()
         self.tracks = []
         self.reset()
 
         log.debug('removeRows called! %d %d' % (row, count))
         self.beginRemoveRows(parent, row, row + count - 1)
         while count:
+            self.tracks[row].prepare_to_die()
             del self.tracks[row]
             count -= 1
         self.endRemoveRows()
             rows = len(newitems)
             self.beginInsertRows(QtCore.QModelIndex(), beginRow, beginRow + rows-1)
             for track in newitems:
-                ######################
-                ######################
-                ### MORE WORK HERE ###
-                ######################
-                ######################
                 self.insertRow(beginRow, QtCore.QModelIndex())
                 track.set_parent(self)
-                self.tracks[beginRow] = track#.insert(beginRow, track)
+                self.tracks[beginRow] = track
                 beginRow += 1
             self.endInsertRows()
         elif data.hasFormat('text/uri-list'):

File searchprocessor.py

View file
  • Ignore whitespace
 
 from PyQt4 import QtCore
 
-from search import Search
+from vplayer.logger import log
+from vplayer.search import Search
 
 class SearchProcessor(QtCore.QThread):
     request = ''

File track.py

View file
  • Ignore whitespace
         if not self.got_album:
             self.began_getting_album = False
 
+    def prepare_to_die(self):
+        self.resolver.remove(self)
+        self.album_resolver.remove(self)
 
     def __delete__(self, instance):
         self.resolver.remove(self)