コード例 #1
0
ファイル: Song.py プロジェクト: kristm/music-player
	def id(self):
		if getattr(self, "_id", None): return self._id
		if not self._useDb: return None
		
		# avoid recursive calls. those might happen because
		# calcNewSongId or getSongId will again access Song attribs.
		if getattr(self, "_recursive_id_call", False): return None
		self._recursive_id_call = True
		
		import songdb
		self._id = songdb.getSongId(self)
		if not self._id:
			self._id = songdb.calcNewSongId(self)
		
		self._recursive_id_call = False
		return self._id
コード例 #2
0
    def id(self):
        if getattr(self, "_id", None): return self._id
        if not self._useDb: return None

        # avoid recursive calls. those might happen because
        # calcNewSongId or getSongId will again access Song attribs.
        if getattr(self, "_recursive_id_call", False): return None
        self._recursive_id_call = True

        try:
            import songdb
            self._id = songdb.getSongId(self)
            if not self._id:
                self._id = songdb.calcNewSongId(self)
        except Exception:
            print "errors while getting song id"
            import sys
            sys.excepthook(*sys.exc_info())

        self._recursive_id_call = False
        return self._id
コード例 #3
0
ファイル: Song.py プロジェクト: MechanisM/music-player
	def id(self):
		if getattr(self, "_id", None): return self._id
		if not self._useDb: return None
		
		# avoid recursive calls. those might happen because
		# calcNewSongId or getSongId will again access Song attribs.
		if getattr(self, "_recursive_id_call", False): return None
		self._recursive_id_call = True
		
		try:
			import songdb
			self._id = songdb.getSongId(self)
			if not self._id:
				self._id = songdb.calcNewSongId(self)
		except Exception:
			print "errors while getting song id"
			import sys
			sys.excepthook(*sys.exc_info())
			
		self._recursive_id_call = False
		return self._id