Implements JSPF, a variation of the XSPF playlist format.
More...
#include <yajl/yajl_gen.h>
#include <yajl/yajl_version.h>
#include <yajl/yajl_tree.h>
#include "yajl_helper.h"
#include "track.h"
#include "log.h"
#include "helper.h"
#include "jspf.h"
|
| #define | _XOPEN_SOURCE 500 |
| |
| #define | YAJL_GEN_STRING(hand, str) yajl_gen_string(hand, (unsigned char*)str, strlen(str)) |
| |
| #define | YAJL_GEN_ENTRY(hand, title, content) |
| |
| #define | YAJL_GEN_ENTRY_INT(hand, title, value) |
| |
| #define | YAJL_GEN_SCOPED_ENTRY(hand, title, content) |
| |
| #define | YAJL_GEN_SCOPED_ENTRY_INT(hand, title, content) |
| |
Implements JSPF, a variation of the XSPF playlist format.
XSPF and JSPF are two related, free and extensible formats for saving playlists. JSPF uses JSON as backing format.
- See also
- http://www.xspf.org/jspf/
-
http://json.org/
| #define _XOPEN_SOURCE 500 |
| #define YAJL_GEN_ENTRY |
( |
|
hand, |
|
|
|
title, |
|
|
|
content |
|
) |
| |
Value:{ \
} \
}
#define YAJL_GEN_STRING(hand, str)
Definition: jspf.c:56
| #define YAJL_GEN_ENTRY_INT |
( |
|
hand, |
|
|
|
title, |
|
|
|
value |
|
) |
| |
Value:
yajl_gen_integer(hand, value); \
}
#define YAJL_GEN_STRING(hand, str)
Definition: jspf.c:56
| #define YAJL_GEN_SCOPED_ENTRY |
( |
|
hand, |
|
|
|
title, |
|
|
|
content |
|
) |
| |
Value:{ \
yajl_gen_map_open(hand);
\
yajl_gen_map_close(hand); \
}
#define YAJL_GEN_ENTRY(hand, title, content)
Definition: jspf.c:58
| #define YAJL_GEN_SCOPED_ENTRY_INT |
( |
|
hand, |
|
|
|
title, |
|
|
|
content |
|
) |
| |
Value:{ \
yajl_gen_map_open(hand);
\
yajl_gen_map_close(hand); \
}
#define YAJL_GEN_ENTRY_INT(hand, title, value)
Definition: jspf.c:65
| #define YAJL_GEN_STRING |
( |
|
hand, |
|
|
|
str |
|
) |
| yajl_gen_string(hand, (unsigned char*)str, strlen(str)) |
Return a descriptive message for the error occured in the last call to jspf_*.
The memory returned is allocated statically, it must not be free'd. This function may only be used directly after an error occured(!), calling another jspf_* function after the failing call and jspf_error() is undefined behaviour.
- Returns
- Pointer the message
| static void jspf_filewriter |
( |
void * |
ctx, |
|
|
const char * |
str, |
|
|
size_t |
len |
|
) |
| |
|
static |
YAJL print callback function for writing JSPF.
- Parameters
-
| ctx | A context, here: a FILE* receiving the JSPF |
| str | The string to write to file |
| len | The length of str |
Read a JSPF playlist to a track_list.
- Parameters
-
| file | The file to read from |
- Returns
- The track_list containing data from
file (or an empty list in case of error)
| bool jspf_write |
( |
char * |
file, |
|
|
struct track_list * |
list |
|
) |
| |
Write a whole tracklist to file.
- Parameters
-
| file | The name of the file to write to |
| list | The tracklist to be written to file |
- Returns
true in case of success, false otherwise
| static void write_jspf_track |
( |
yajl_gen |
hand, |
|
|
struct track * |
track |
|
) |
| |
|
static |
Write a single track to file.
- Parameters
-
| hand | A YAJL handle (represents the document) |
| track | The track to be written to file |