File indexing completed on 2025-01-05 04:27:02

0001 /****************************************************************************************
0002  * Copyright (c) 2008 MP3tunes, LLC <copyright@mp3tunes.com>                            *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU Library General Public License as published by the Free         *
0006  * Software Foundation; either version 2.1 of the License, or (at your option) any      *
0007  * later version.                                                                       *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU Library General Public License along with *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 /**
0018  * \file locker.h
0019  * \brief The \e liboboe public header.
0020  */
0021 
0022 #ifndef __MP3TUNES_LOCKER_H__
0023 #define __MP3TUNES_LOCKER_H__
0024 
0025 #ifndef TRUE
0026 #define TRUE 1
0027 #define FALSE 0
0028 #endif
0029 
0030 #define MP3TUNES_SERVER_API_URL "ws.mp3tunes.com"
0031 #define MP3TUNES_SERVER_CONTENT_URL "content.mp3tunes.com"
0032 #define MP3TUNES_SERVER_LOGIN_URL "shop.mp3tunes.com"
0033 
0034 #define MP3TUNES_SERVER_API 0
0035 #define MP3TUNES_SERVER_CONTENT 1
0036 #define MP3TUNES_SERVER_LOGIN 2
0037 
0038 typedef struct {
0039   char *username, *password, *session_id, *firstname, *lastname, *nickname;
0040   char *partner_token;
0041   char *server_api, *server_content, *server_login;
0042   char *error_message;
0043 } mp3tunes_locker_object_t;
0044 
0045 struct mp3tunes_locker_list_item_s {
0046     int id;
0047     void *value;
0048     struct mp3tunes_locker_list_item_s *prev;
0049     struct mp3tunes_locker_list_item_s *next;
0050 };
0051 
0052 typedef struct mp3tunes_locker_list_item_s mp3tunes_locker_list_item_t;
0053 
0054 struct mp3tunes_locker_list_s {
0055     int last_id;
0056     mp3tunes_locker_list_item_t *first;
0057     mp3tunes_locker_list_item_t *last;
0058 };
0059 
0060 typedef struct mp3tunes_locker_list_s mp3tunes_locker_track_list_t;
0061 typedef struct mp3tunes_locker_list_s mp3tunes_locker_artist_list_t;
0062 typedef struct mp3tunes_locker_list_s mp3tunes_locker_album_list_t;
0063 typedef struct mp3tunes_locker_list_s mp3tunes_locker_playlist_list_t;
0064 
0065 typedef struct {
0066     int trackId;
0067     char *trackTitle;
0068     int trackNumber;
0069     float trackLength;
0070     char *trackFileName;
0071     char *trackFileKey;
0072     int trackFileSize;
0073     char *downloadURL;
0074     char *playURL;
0075     int albumId;
0076     char *albumTitle;
0077     int albumYear;
0078     char *artistName;
0079     int artistId;
0080 } mp3tunes_locker_track_t;
0081 
0082 typedef struct {
0083     int artistId;
0084     char* artistName;
0085     int artistSize;
0086     int albumCount;
0087     int trackCount;
0088 } mp3tunes_locker_artist_t;
0089 
0090 typedef struct {
0091     int albumId;
0092     char *albumTitle;
0093     int artistId;
0094     char *artistName;
0095     int trackCount;
0096     int albumSize;
0097     int hasArt;
0098 } mp3tunes_locker_album_t;
0099 
0100 typedef struct {
0101     char* playlistId;
0102     char* playlistTitle;
0103     char* title;
0104     char* fileName;
0105     int fileCount;
0106     int playlistSize;
0107 } mp3tunes_locker_playlist_t;
0108 
0109 int mp3tunes_locker_init( mp3tunes_locker_object_t **obj, const char *partner_token );
0110 int mp3tunes_locker_deinit( mp3tunes_locker_object_t **obj );
0111 int mp3tunes_locker_login( mp3tunes_locker_object_t *obj, const char* username, const char* password );
0112 int mp3tunes_locker_session_valid( mp3tunes_locker_object_t *obj );
0113 int mp3tunes_locker_artists( mp3tunes_locker_object_t *obj, mp3tunes_locker_artist_list_t **artists_return);
0114 int mp3tunes_locker_artists_search( mp3tunes_locker_object_t *obj, mp3tunes_locker_artist_list_t **artists_return, char *query);
0115 int mp3tunes_locker_albums_with_artist_id( mp3tunes_locker_object_t *obj, mp3tunes_locker_album_list_t **albums_return, int artist_id);
0116 int mp3tunes_locker_albums( mp3tunes_locker_object_t *obj, mp3tunes_locker_album_list_t **albums_return);
0117 int mp3tunes_locker_albums_search(  mp3tunes_locker_object_t *obj, mp3tunes_locker_album_list_t **albums_return, char *query);
0118 int mp3tunes_locker_playlists(mp3tunes_locker_object_t *obj, mp3tunes_locker_playlist_list_t **playlist_return);
0119 int mp3tunes_locker_search(mp3tunes_locker_object_t *obj, mp3tunes_locker_artist_list_t **artists_return, mp3tunes_locker_album_list_t **albums_return, mp3tunes_locker_track_list_t **tracks_return, const char *query);
0120 
0121 int mp3tunes_locker_tracks( mp3tunes_locker_object_t *obj, mp3tunes_locker_track_list_t **tracks_return);
0122 int mp3tunes_locker_tracks_search( mp3tunes_locker_object_t *obj, mp3tunes_locker_track_list_t **tracks_return, char *query);
0123 int mp3tunes_locker_tracks_with_playlist_id( mp3tunes_locker_object_t *obj, mp3tunes_locker_track_list_t **tracks_return, const char* playlist_id);
0124 int mp3tunes_locker_tracks_with_album_id( mp3tunes_locker_object_t *obj, mp3tunes_locker_track_list_t **tracks_return, int album_id);
0125 int mp3tunes_locker_tracks_with_artist_id( mp3tunes_locker_object_t *obj, mp3tunes_locker_track_list_t **tracks_return, int artist_id);
0126 int mp3tunes_locker_tracks_with_file_key( mp3tunes_locker_object_t *obj, const char *file_keys, mp3tunes_locker_track_list_t **tracks );
0127 int mp3tunes_locker_track_with_file_key( mp3tunes_locker_object_t *obj, const char *file_key, mp3tunes_locker_track_t **track );
0128 
0129 int mp3tunes_locker_track_list_deinit( mp3tunes_locker_track_list_t** list );
0130 int mp3tunes_locker_artist_list_deinit( mp3tunes_locker_track_list_t** list );
0131 int mp3tunes_locker_album_list_deinit( mp3tunes_locker_track_list_t** list );
0132 int mp3tunes_locker_playlist_list_deinit( mp3tunes_locker_track_list_t** list );
0133 
0134 char* mp3tunes_locker_generate_download_url_from_file_key(mp3tunes_locker_object_t *obj, char *file_key);
0135 char* mp3tunes_locker_generate_download_url_from_file_key_and_bitrate(mp3tunes_locker_object_t *obj, char *file_key, char* bitrate);
0136 
0137 char* mp3tunes_locker_generate_filekey(const char *filename);
0138 int mp3tunes_locker_upload_track(mp3tunes_locker_object_t *obj, const char *path);
0139 int mp3tunes_locker_load_track(mp3tunes_locker_object_t *obj, const char *url);
0140 
0141 int mp3tunes_locker_sync_down(mp3tunes_locker_object_t *obj, char* type, char* bytes_local, char* files_local, char* keep_local_files, char* playlist_id);
0142 #endif