def _get_features(): """Get the supported features for the platform. """ features = [] if _features_available: c_features = (c_char_p * 32)() _LIB.discid_get_feature_list(c_features) for feature in c_features: if feature: features.append(_decode(feature)) else: # libdiscid <= 0.4.0 features = ["read"] # no generic platform yet try: # test for ISRC/MCN API (introduced 0.3.0) _LIB.discid_get_mcn except AttributeError: pass else: # ISRC/MCN API found -> libdiscid = 0.3.x if (sys.platform.startswith("linux") and not os.path.isfile("/usr/lib/libdiscid.so.0.3.0") and not os.path.isfile("/usr/lib64/libdiscid.so.0.3.0")): features += ["mcn", "isrc"] elif sys.platform in ["darwin", "win32"]: features += ["mcn", "isrc"] return features
def _get_submission_url(self): """Give an URL to submit the current TOC as a new Disc ID to MusicBrainz. """ assert self._success result = _LIB.discid_get_submission_url(self._handle) return _decode(result)
def _get_version_string(): """Get the version string of libdiscid """ try: version_string = _LIB.discid_get_version_string() except AttributeError: return "libdiscid < 0.4.0" else: return _decode(version_string)
def _get_toc_string(self): """The TOC suitable as value of the `toc parameter` when accessing the MusicBrainz Web Service. """ assert self._success try: result = _LIB.discid_get_toc_string(self._handle) except AttributeError: return None else: return _decode(result)
def _get_track_isrc(self): if self._disc._success and "isrc" in self._disc._requested_features: try: result = _LIB.discid_get_track_isrc(self._disc._handle, self.number) except AttributeError: return None else: return _decode(result) else: return None
def _get_track_isrc(self): assert self._disc._success if "isrc" in self._disc._requested_features: try: result = _LIB.discid_get_track_isrc(self._disc._handle, self.number) except AttributeError: return None else: return _decode(result) else: return None
def _get_mcn(self): """Gets the current Media Catalogue Number (MCN/UPC/EAN) """ assert self._success if "mcn" in self._requested_features: try: result = _LIB.discid_get_mcn(self._handle) except AttributeError: return None else: return _decode(result) else: return None
def _get_freedb_id(self): """Gets the current FreeDB disc ID """ assert self._success result = _LIB.discid_get_freedb_id(self._handle) return _decode(result)
def _get_id(self): """Gets the current MusicBrainz disc ID """ assert self._success result = _LIB.discid_get_id(self._handle) return _decode(result)
def _get_error_msg(self): """Get the error message for the last error with the object. """ error = _LIB.discid_get_error_msg(self._handle) return _decode(error)
def _get_default_device(): """Get the default device for the platform """ device = _LIB.discid_get_default_device() return _decode(device)
def get_default_device(): """The default device to use for :func:`read` on this platform given as a :obj:`unicode` or :obj:`str <python:str>` object. """ device = _LIB.discid_get_default_device() return _decode(device)