-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathspshell.h
75 lines (69 loc) · 2.27 KB
/
spshell.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/** This file is part of SpotifyWebApi - <[email protected]> ===
*
* Copyright 2011,Hugo Lindström <[email protected]>
*
*
* Inspiration and reused functions has come from Spotifys spshell example
* and that code is:
* Copyright (c) 2006-2010 Spotify Ltd
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
#ifndef SPSHELL_H__
#define SPSHELL_H__
#include <stdlib.h>
#include <stdio.h>
#include <libspotify/api.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
/**
* BUF_SIZE
* IMPORTANT!
* If you are getting truncated responses, increase this
*/
#define BUF_SIZE 4096
#define PORT 5112
#define USERNAME ""
#define PASSWORD ""
#define STATUS_OK "HTTP/1.0 200 OK\n"
#define STATUS_ERR "HTTP/1.0 400 BAD REQUEST\n"
#define STATUS_CONTERR "HTTP/1.0 404 NOT FOUND\n"
#define STATUS_NIMPL "HTTP/1.0 501 NOT IMPLEMENTED\n"
#define STATUS_CONNERR "HTTP/1.0 503 SERVICE UNAVAILABLE\n"
#define JSON "Content-type: application/json; charset=UTF-8\n\n";
/**
* MYSQL
*/
// Is defined, if LibMysql is found in cmake
#ifdef USE_MYSQL
#include "sp_mysql.h"
#include <mysql.h>
#define _mHOST ""
#define _mUSER ""
#define _mPASS ""
#define _mDATABASE ""
#define _mPORT ""
extern MYSQL *g_conn;
#endif
/// Socket identifiers
int newfd, numbytes, DPORT;
extern sp_session *g_session;
extern void (*metadata_updated_fn)(void);
extern int spshell_init(const char *username, const char *password);
extern void notify_main_thread(sp_session *session);
extern void start_recv(void);
extern char * replace( char const * const original, char const * const pattern, char const * const replacement);
#endif // SPSHELL_H__