summaryrefslogtreecommitdiff
path: root/src/libpiano/piano.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libpiano/piano.h')
-rw-r--r--src/libpiano/piano.h42
1 files changed, 35 insertions, 7 deletions
diff --git a/src/libpiano/piano.h b/src/libpiano/piano.h
index 04f33b5..ce66171 100644
--- a/src/libpiano/piano.h
+++ b/src/libpiano/piano.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2008-2011
+Copyright (c) 2008-2013
Lars-Dominik Braun <lars@6xq.net>
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -42,19 +42,23 @@ THE SOFTWARE.
#define PIANO_RPC_HOST "tuner.pandora.com"
#define PIANO_RPC_PATH "/services/json/?"
+typedef struct PianoListHead {
+ struct PianoListHead *next;
+} PianoListHead_t;
+
typedef struct PianoUserInfo {
char *listenerId;
char *authToken;
} PianoUserInfo_t;
typedef struct PianoStation {
+ PianoListHead_t head;
char isCreator;
char isQuickMix;
char useQuickMix; /* station will be included in quickmix */
char *name;
char *id;
char *seedId;
- struct PianoStation *next;
} PianoStation_t;
typedef enum {
@@ -78,6 +82,7 @@ typedef enum {
} PianoAudioQuality_t;
typedef struct PianoSong {
+ PianoListHead_t head;
char *artist;
char *stationId;
char *album;
@@ -92,28 +97,27 @@ typedef struct PianoSong {
float fileGain;
PianoSongRating_t rating;
PianoAudioFormat_t audioFormat;
- struct PianoSong *next;
} PianoSong_t;
/* currently only used for search results */
typedef struct PianoArtist {
+ PianoListHead_t head;
char *name;
char *musicId;
char *seedId;
int score;
- struct PianoArtist *next;
} PianoArtist_t;
typedef struct PianoGenre {
+ PianoListHead_t head;
char *name;
char *musicId;
- struct PianoGenre *next;
} PianoGenre_t;
typedef struct PianoGenreCategory {
+ PianoListHead_t head;
char *name;
PianoGenre_t *genres;
- struct PianoGenreCategory *next;
} PianoGenreCategory_t;
typedef struct PianoPartner {
@@ -298,6 +302,27 @@ typedef enum {
PIANO_RET_P_RATE_LIMIT = PIANO_RET_OFFSET+1039,
} PianoReturn_t;
+/* list stuff */
+#ifndef __GNUC__
+# define __attribute__(x)
+#endif
+size_t PianoListCount (const PianoListHead_t * const l);
+#define PianoListCountP(l) PianoListCount(&(l)->head)
+void *PianoListAppend (PianoListHead_t * const l, PianoListHead_t * const e)
+ __attribute__ ((warn_unused_result));
+#define PianoListAppendP(l,e) PianoListAppend(&(l)->head, &(e)->head)
+void *PianoListDelete (PianoListHead_t * const l, PianoListHead_t * const e)
+ __attribute__ ((warn_unused_result));
+#define PianoListDeleteP(l,e) PianoListDelete(&(l)->head, &(e)->head)
+#define PianoListNextP(e) ((void *) (e)->head.next)
+void *PianoListPrepend (PianoListHead_t * const l, PianoListHead_t * const e)
+ __attribute__ ((warn_unused_result));
+#define PianoListPrependP(l,e) PianoListPrepend (&(l)->head, &(e)->head)
+void *PianoListGet (PianoListHead_t * const l, const size_t n);
+#define PianoListGetP(l,n) PianoListGet (&(l)->head, n)
+#define PianoListForeachP(l) for (; (l) != NULL; (l) = (void *) (l)->head.next)
+
+/* memory management */
PianoReturn_t PianoInit (PianoHandle_t *, const char *,
const char *, const char *, const char *,
const char *);
@@ -306,12 +331,15 @@ void PianoDestroyPlaylist (PianoSong_t *);
void PianoDestroySearchResult (PianoSearchResult_t *);
void PianoDestroyStationInfo (PianoStationInfo_t *);
+/* pandora rpc */
PianoReturn_t PianoRequest (PianoHandle_t *, PianoRequest_t *,
PianoRequestType_t);
PianoReturn_t PianoResponse (PianoHandle_t *, PianoRequest_t *);
void PianoDestroyRequest (PianoRequest_t *);
-PianoStation_t *PianoFindStationById (PianoStation_t *, const char *);
+/* misc */
+PianoStation_t *PianoFindStationById (PianoStation_t * const,
+ const char * const);
const char *PianoErrorToStr (PianoReturn_t);
#endif /* _PIANO_H */