def get(self, LUID): try: DataProvider.DataSource.get(self, LUID) songuri = str(self.dbus.GetTrackInfo(LUID, 'location')) f = RhythmboxAudio(URI=songuri) f.set_UID(LUID) f.set_open_URI(songuri) return f except DBusClosedConnectionError: raise Exceptions.SyncronizeFatalError()
def get_all(self): DataProvider.DataSource.get_all(self) try: # LUID is now a Rhythmbox ID, that only makes sense to Rhythmbox songs = [] #only consider enabled playlists for playlist in [ p for p in self.allPlaylists if p in self.playlists ]: for song in self.dbus.GetPlaylistTracks(playlist): songs.append(str(song)) return songs except DBusClosedConnectionError: raise Exceptions.SyncronizeFatalError()
def put(self, data, overwrite, LUID=None): DataProvider.DataSink.put(self, data, overwrite, LUID) if self.slow: time.sleep(1) if self.count >= self.errorAfter: if self.errorFatal: raise Exceptions.SyncronizeFatalError( "Error After:%s Count:%s" % (self.errorAfter, self.count)) else: raise Exceptions.SyncronizeError("Error After:%s Count:%s" % (self.errorAfter, self.count)) self.count += 1 newData = TestDataType(data.get_UID()) return newData.get_rid()
def get(self, LUID): DataProvider.DataSource.get(self, LUID) if self.slow: time.sleep(1) index = int(LUID) if index >= self.errorAfter: if self.errorFatal: raise Exceptions.SyncronizeFatalError( "Error After:%s Count:%s" % (self.errorAfter, index)) else: raise Exceptions.SyncronizeError("Error After:%s Count:%s" % (self.errorAfter, index)) mtime = DEFAULT_MTIME if self.newMtime: mtime = datetime.datetime.now() hash = DEFAULT_HASH if self.newHash: hash = Utils.random_string() data = TestDataType(LUID, mtime, hash) return data
def _get_info(self, info): try: return self.dbus.GetTrackInfo(self.get_UID(), info) except DBusClosedConnectionError: raise Exceptions.SyncronizeFatalError()
def _transfer_file(self, vfsFile, newURI, overwrite): try: vfsFile.transfer(newURI, overwrite) except File.FileTransferError: raise Exceptions.SyncronizeFatalError("Transfer Cancelled")