int e;
if(playlist_parse_name(name, 0, 0)) {
- error(0, "invalid playlist name '%s'", name);
+ disorder_error(0, "invalid playlist name '%s'", name);
return EINVAL;
}
WITH_TRANSACTION(trackdb_playlist_get_tid(name, who,
return e;
/* Get sharability */
if(!(s = kvp_get(k, "sharing"))) {
- error(0, "playlist '%s' has no 'sharing' key", name);
+ disorder_error(0, "playlist '%s' has no 'sharing' key", name);
s = "private";
}
/* Check the read is allowed */
*sharep = xstrdup(s);
/* Get track count */
if(!(s = kvp_get(k, "count"))) {
- error(0, "playlist '%s' has no 'count' key", name);
+ disorder_error(0, "playlist '%s' has no 'count' key", name);
s = "0";
}
ntracks = atoi(s);
if(ntracks < 0) {
- error(0, "playlist '%s' has negative count", name);
+ disorder_error(0, "playlist '%s' has negative count", name);
ntracks = 0;
}
/* Return track count */
for(int n = 0; n < ntracks; ++n) {
snprintf(b, sizeof b, "%d", n);
if(!(s = kvp_get(k, b))) {
- error(0, "playlist '%s' lacks track %d", name, n);
+ disorder_error(0, "playlist '%s' lacks track %d", name, n);
s = "unknown";
}
tracks[n] = xstrdup(s);
char *owner;
if(playlist_parse_name(name, &owner, 0)) {
- error(0, "invalid playlist name '%s'", name);
+ disorder_error(0, "invalid playlist name '%s'", name);
return EINVAL;
}
/* Check valid share types */
/* Playlists with an owner must be public or private */
if(strcmp(share, "public")
&& strcmp(share, "private")) {
- error(0, "playlist '%s' must be public or private", name);
+ disorder_error(0, "playlist '%s' must be public or private", name);
return EINVAL;
}
} else {
/* Playlists with no owner must be shared */
if(strcmp(share, "shared")) {
- error(0, "playlist '%s' must be shared", name);
+ disorder_error(0, "playlist '%s' must be shared", name);
return EINVAL;
}
}
}
/* Check that the modification is allowed */
if(!(s = kvp_get(k, "sharing"))) {
- error(0, "playlist '%s' has no 'sharing' key", name);
+ disorder_error(0, "playlist '%s' has no 'sharing' key", name);
s = "private";
}
if(!playlist_may_write(name, who, s))
/* Sanity check track count */
if(ntracks < 0 || ntracks > config->playlist_max) {
- error(0, "invalid track count %d", ntracks);
+ disorder_error(0, "invalid track count %d", ntracks);
return EINVAL;
}
/* Set the tracks */
/* Extract owner; malformed names are skipped */
if(playlist_parse_name(name, &owner, 0)) {
- error(0, "invalid playlist name '%s' found in database", name);
+ disorder_error(0, "invalid playlist name '%s' found in database", name);
continue;
}
if(!share) {
- error(0, "playlist '%s' has no 'sharing' key", name);
+ disorder_error(0, "playlist '%s' has no 'sharing' key", name);
continue;
}
/* Always list public and shared playlists
case DB_LOCK_DEADLOCK:
return e;
default:
- fatal(0, "c->c_get: %s", db_strerror(e));
+ disorder_fatal(0, "c->c_get: %s", db_strerror(e));
}
vector_terminate(v);
if(playlistsp)
char *owner;
if(playlist_parse_name(name, &owner, 0)) {
- error(0, "invalid playlist name '%s'", name);
+ disorder_error(0, "invalid playlist name '%s'", name);
return EINVAL;
}
/* We've checked as much as we can for now, now go and attempt the change */
return e;
/* Check that modification is allowed */
if(!(s = kvp_get(k, "sharing"))) {
- error(0, "playlist '%s' has no 'sharing' key", name);
+ disorder_error(0, "playlist '%s' has no 'sharing' key", name);
s = "private";
}
if(!playlist_may_write(name, who, s))