Ejemplo n.º 1
0
    def __init__(self, uri=None, sp_album=None, add_ref=True):
        assert uri or sp_album, 'uri or sp_album is required'

        if uri is not None:
            album = spotify.Link(uri).as_album()
            if album is None:
                raise ValueError(
                    'Failed to get album from Spotify URI: %r' % uri)
            sp_album = album._sp_album
            add_ref = True

        if add_ref:
            lib.sp_album_add_ref(sp_album)
        self._sp_album = ffi.gc(sp_album, lib.sp_album_release)
Ejemplo n.º 2
0
    def __init__(self, session, uri=None, sp_album=None, add_ref=True):
        assert uri or sp_album, 'uri or sp_album is required'

        self._session = session

        if uri is not None:
            album = spotify.Link(self._session, uri=uri).as_album()
            if album is None:
                raise ValueError(
                    'Failed to get album from Spotify URI: %r' % uri)
            sp_album = album._sp_album
            add_ref = True

        if add_ref:
            lib.sp_album_add_ref(sp_album)
        self._sp_album = ffi.gc(sp_album, lib.sp_album_release)