def __init__ (self, parent, collections=None, songs=None, busName=None, busPath=None): SatyrObject.__init__ (self, parent, busName, busPath) self.configValues= ( ('collsNo', int, 0), ) self.loadConfig () self.signalMapper= QSignalMapper () self.collections= [] if songs is None: self.songs= [] self.count= 0 else: self.songs= songs self.count= len (songs) # if collections is not None we it means the may have changed if self.collsNo>0 and collections is None: logger.info ("loading collections from config", self.collsNo) for index in xrange (self.collsNo): collection= Collection (self, busName=busName, busPath="/collection_%04d" % index) self.append (collection) else: if collections is not None: for collection in collections: self.append (collection) self.signalMapper.mapped.connect (self.addSongs)
def __init__ (self, parent, playlist, busName, busPath): SatyrObject.__init__ (self, parent, busName, busPath) self.configValues= ( # actually it doesn't make much sense to save this one ('state', int, Player.STOPPED), ('stopAfter', configEntryToBool, False), # or this one... ('quitAfter', configEntryToBool, False), ) self.loadConfig () self.playlist= playlist self.media= Phonon.createPlayer (Phonon.MusicCategory) # self.media.finished.connect (self.next) # self.media.finished.connect () self.media.aboutToFinish.connect (self.queueNext) self.media.currentSourceChanged.connect (self.sourceChanged) self.media.stateChanged.connect (self.stateChanged)
def __init__ (self, parent, path="", relative=False, busName=None, busPath=None): SatyrObject.__init__ (self, parent, busName, busPath) self.songs= [] self.count= 0 # (re)defined by an aggregator if we're in one of those self.offset= 0 # BUG: path is not reread from the config file! # it breaks rescanning self.configValues= ( ('path', str, path), ) self.loadConfig () # print busPath, self.path # if the user requests a new path, use it if self.path!=path and path!="": path= os.path.abspath (path) self.path= path self.forceScan= True logger.info ("new path, forcing (re)scan") else: self.forceScan= False self.relative= relative logger.debug ("Collection(): %s", self.path) self.watch= KDirWatch (self) self.watch.addDir (self.path, KDirWatch.WatchMode (KDirWatch.WatchFiles|KDirWatch.WatchSubDirs)) self.watch.created.connect (self.newFiles) self.scanners= [] self.scanning= False self.loadMetadata= False if busPath is not None: self.collectionFile= str (KStandardDirs.locateLocal ('data', 'satyr/%s.tdb' % self.dbusName (busPath))) else: self.collectionFile= str (KStandardDirs.locateLocal ('data', 'satyr/collection.tdb'))