Пример #1
0
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
Пример #2
0
 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)
Пример #3
0
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
Пример #4
0
 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)
Пример #5
0
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)
Пример #6
0
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)
Пример #7
0
 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)
Пример #8
0
 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
Пример #9
0
 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)
Пример #10
0
 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
Пример #11
0
 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
Пример #12
0
 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
Пример #13
0
 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)
Пример #14
0
 def _get_id(self):
     """Gets the current MusicBrainz disc ID
     """
     assert self._success
     result = _LIB.discid_get_id(self._handle)
     return _decode(result)
Пример #15
0
 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)
Пример #16
0
 def _get_id(self):
     """Gets the current MusicBrainz disc ID
     """
     assert self._success
     result = _LIB.discid_get_id(self._handle)
     return _decode(result)
Пример #17
0
def _get_default_device():
    """Get the default device for the platform
    """
    device = _LIB.discid_get_default_device()
    return _decode(device)
Пример #18
0
 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)
Пример #19
0
 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)
Пример #20
0
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)
Пример #21
0
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)