Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make Artist#albums work; a copy-paste error and a logic error in crea…

…te_album_full. :-)
  • Loading branch information...
commit 47d6736cbcb035fddb52d8cac4656665139b75f6 1 parent 7e7038e
jorgenpt authored
View
2  src/bindings/python/src/artist.pxi
@@ -62,7 +62,7 @@ cdef class Artist(SpotifyObject):
cdef get_full_data(self):
if self.full_data == None:
- self.full_data = AlbumDataFull()
+ self.full_data = ArtistDataFull()
self.full_data.browse = despotify_get_artist(self.ds, self.data.id())
self.data = self.full_data
View
10 src/bindings/python/src/sessionstruct.pxi
@@ -14,13 +14,13 @@ cdef class SessionStruct:
cdef Album create_album(self, album* album, bint take_owner=False):
cdef Album instance
- if not album:
- return None
-
instance = NEW_ALBUM(Album)
instance.ds = self.ds
- instance.data = AlbumData()
- instance.data.data = album
+ if not album:
+ instance.data = None
+ else:
+ instance.data = AlbumData()
+ instance.data.data = album
instance.take_owner = take_owner
View
122 src/bindings/python/src/spytify.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.12 on Fri Feb 5 16:59:48 2010 */
+/* Generated by Cython 0.12 on Fri Feb 5 17:19:27 2010 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -1184,8 +1184,8 @@ static struct __pyx_obj_7spytify_Album *__pyx_f_7spytify_13SessionStruct_create
int __pyx_v_take_owner = ((int)0);
struct __pyx_obj_7spytify_Album *__pyx_v_instance;
struct __pyx_obj_7spytify_Album *__pyx_r = NULL;
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
__Pyx_RefNannySetupContext("create_album");
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
@@ -1198,76 +1198,79 @@ static struct __pyx_obj_7spytify_Album *__pyx_f_7spytify_13SessionStruct_create
/* "/Users/jorgenpt/Projects/despotify/bindings/python/src/sessionstruct.pxi":17
* cdef Album instance
*
- * if not album: # <<<<<<<<<<<<<<
- * return None
- *
- */
- __pyx_t_1 = (!(__pyx_v_album != 0));
- if (__pyx_t_1) {
-
- /* "/Users/jorgenpt/Projects/despotify/bindings/python/src/sessionstruct.pxi":18
- *
- * if not album:
- * return None # <<<<<<<<<<<<<<
- *
- * instance = NEW_ALBUM(Album)
- */
- __Pyx_XDECREF(((PyObject *)__pyx_r));
- __Pyx_INCREF(Py_None);
- __pyx_r = ((struct __pyx_obj_7spytify_Album *)Py_None);
- goto __pyx_L0;
- goto __pyx_L3;
- }
- __pyx_L3:;
-
- /* "/Users/jorgenpt/Projects/despotify/bindings/python/src/sessionstruct.pxi":20
- * return None
- *
* instance = NEW_ALBUM(Album) # <<<<<<<<<<<<<<
* instance.ds = self.ds
- * instance.data = AlbumData()
+ * if not album:
*/
- __pyx_t_2 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_7spytify_Album)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = ((PyObject *)PY_NEW(((PyObject *)((PyObject*)__pyx_ptype_7spytify_Album)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_v_instance));
- __pyx_v_instance = ((struct __pyx_obj_7spytify_Album *)__pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_v_instance = ((struct __pyx_obj_7spytify_Album *)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/Users/jorgenpt/Projects/despotify/bindings/python/src/sessionstruct.pxi":21
+ /* "/Users/jorgenpt/Projects/despotify/bindings/python/src/sessionstruct.pxi":18
*
* instance = NEW_ALBUM(Album)
* instance.ds = self.ds # <<<<<<<<<<<<<<
- * instance.data = AlbumData()
- * instance.data.data = album
+ * if not album:
+ * instance.data = None
*/
__pyx_v_instance->__pyx_base.__pyx_base.ds = __pyx_v_self->ds;
- /* "/Users/jorgenpt/Projects/despotify/bindings/python/src/sessionstruct.pxi":22
+ /* "/Users/jorgenpt/Projects/despotify/bindings/python/src/sessionstruct.pxi":19
* instance = NEW_ALBUM(Album)
* instance.ds = self.ds
- * instance.data = AlbumData() # <<<<<<<<<<<<<<
- * instance.data.data = album
- *
+ * if not album: # <<<<<<<<<<<<<<
+ * instance.data = None
+ * else:
*/
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7spytify_AlbumData)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __Pyx_GOTREF(__pyx_v_instance->data);
- __Pyx_DECREF(((PyObject *)__pyx_v_instance->data));
- __pyx_v_instance->data = ((struct __pyx_obj_7spytify_AlbumData *)__pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_t_2 = (!(__pyx_v_album != 0));
+ if (__pyx_t_2) {
- /* "/Users/jorgenpt/Projects/despotify/bindings/python/src/sessionstruct.pxi":23
+ /* "/Users/jorgenpt/Projects/despotify/bindings/python/src/sessionstruct.pxi":20
* instance.ds = self.ds
- * instance.data = AlbumData()
- * instance.data.data = album # <<<<<<<<<<<<<<
+ * if not album:
+ * instance.data = None # <<<<<<<<<<<<<<
+ * else:
+ * instance.data = AlbumData()
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __Pyx_GOTREF(__pyx_v_instance->data);
+ __Pyx_DECREF(((PyObject *)__pyx_v_instance->data));
+ __pyx_v_instance->data = ((struct __pyx_obj_7spytify_AlbumData *)Py_None);
+ goto __pyx_L3;
+ }
+ /*else*/ {
+
+ /* "/Users/jorgenpt/Projects/despotify/bindings/python/src/sessionstruct.pxi":22
+ * instance.data = None
+ * else:
+ * instance.data = AlbumData() # <<<<<<<<<<<<<<
+ * instance.data.data = album
+ *
+ */
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7spytify_AlbumData)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_v_instance->data);
+ __Pyx_DECREF(((PyObject *)__pyx_v_instance->data));
+ __pyx_v_instance->data = ((struct __pyx_obj_7spytify_AlbumData *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "/Users/jorgenpt/Projects/despotify/bindings/python/src/sessionstruct.pxi":23
+ * else:
+ * instance.data = AlbumData()
+ * instance.data.data = album # <<<<<<<<<<<<<<
*
* instance.take_owner = take_owner
*/
- __pyx_v_instance->data->data = __pyx_v_album;
+ __pyx_v_instance->data->data = __pyx_v_album;
+ }
+ __pyx_L3:;
/* "/Users/jorgenpt/Projects/despotify/bindings/python/src/sessionstruct.pxi":25
- * instance.data.data = album
+ * instance.data.data = album
*
* instance.take_owner = take_owner # <<<<<<<<<<<<<<
*
@@ -1290,7 +1293,7 @@ static struct __pyx_obj_7spytify_Album *__pyx_f_7spytify_13SessionStruct_create
__pyx_r = ((struct __pyx_obj_7spytify_Album *)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("spytify.SessionStruct.create_album");
__pyx_r = 0;
__pyx_L0:;
@@ -4512,7 +4515,7 @@ static PyObject *__pyx_pf_7spytify_6Artist_get_uri(PyObject *__pyx_v_self, PyObj
*
* cdef get_full_data(self): # <<<<<<<<<<<<<<
* if self.full_data == None:
- * self.full_data = AlbumDataFull()
+ * self.full_data = ArtistDataFull()
*/
static PyObject *__pyx_f_7spytify_6Artist_get_full_data(struct __pyx_obj_7spytify_Artist *__pyx_v_self) {
@@ -4526,7 +4529,7 @@ static PyObject *__pyx_f_7spytify_6Artist_get_full_data(struct __pyx_obj_7spyti
*
* cdef get_full_data(self):
* if self.full_data == None: # <<<<<<<<<<<<<<
- * self.full_data = AlbumDataFull()
+ * self.full_data = ArtistDataFull()
* self.full_data.browse = despotify_get_artist(self.ds, self.data.id())
*/
__pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_self->full_data), Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4538,13 +4541,12 @@ static PyObject *__pyx_f_7spytify_6Artist_get_full_data(struct __pyx_obj_7spyti
/* "/Users/jorgenpt/Projects/despotify/bindings/python/src/artist.pxi":65
* cdef get_full_data(self):
* if self.full_data == None:
- * self.full_data = AlbumDataFull() # <<<<<<<<<<<<<<
+ * self.full_data = ArtistDataFull() # <<<<<<<<<<<<<<
* self.full_data.browse = despotify_get_artist(self.ds, self.data.id())
* self.data = self.full_data
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7spytify_AlbumDataFull)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7spytify_ArtistDataFull)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7spytify_ArtistDataFull))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->full_data);
__Pyx_DECREF(((PyObject *)__pyx_v_self->full_data));
@@ -4553,7 +4555,7 @@ static PyObject *__pyx_f_7spytify_6Artist_get_full_data(struct __pyx_obj_7spyti
/* "/Users/jorgenpt/Projects/despotify/bindings/python/src/artist.pxi":66
* if self.full_data == None:
- * self.full_data = AlbumDataFull()
+ * self.full_data = ArtistDataFull()
* self.full_data.browse = despotify_get_artist(self.ds, self.data.id()) # <<<<<<<<<<<<<<
* self.data = self.full_data
*
@@ -4561,7 +4563,7 @@ static PyObject *__pyx_f_7spytify_6Artist_get_full_data(struct __pyx_obj_7spyti
__pyx_v_self->full_data->browse = despotify_get_artist(__pyx_v_self->__pyx_base.__pyx_base.ds, ((struct __pyx_vtabstruct_7spytify_ArtistData *)__pyx_v_self->data->__pyx_vtab)->id(__pyx_v_self->data));
/* "/Users/jorgenpt/Projects/despotify/bindings/python/src/artist.pxi":67
- * self.full_data = AlbumDataFull()
+ * self.full_data = ArtistDataFull()
* self.full_data.browse = despotify_get_artist(self.ds, self.data.id())
* self.data = self.full_data # <<<<<<<<<<<<<<
*
Please sign in to comment.
Something went wrong with that request. Please try again.