return 0;
}
if(dcgi_client
- && !disorder_part(dcgi_client, (char **)&s,
+ && !disorder_part(dcgi_client,
track,
!strcmp(context, "short") ? "display" : context,
- part)) {
+ part,
+ (char **)&s)) {
if(!strcmp(context, "short"))
s = truncate_for_display(s, config->short_display);
return sink_writes(output, cgi_sgmlquote(s)) < 0 ? -1 : 0;
struct sink *output,
void attribute((unused)) *u) {
dcgi_lookup(DCGI_VOLUME);
- return sink_printf(output, "%d",
+ return sink_printf(output, "%ld",
!strcmp(args[0], "left")
? dcgi_volume_left : dcgi_volume_right) < 0 ? -1 : 0;
}
if(!dcgi_client)
return 0;
- if(disorder_resolve(dcgi_client, &track, args[0]))
+ if(disorder_resolve(dcgi_client, args[0], &track))
return 0;
dcgi_lookup(DCGI_PLAYING);
if(dcgi_playing && !strcmp(track, dcgi_playing->track))
void attribute((unused)) *u) {
char *r;
- if(dcgi_client && !disorder_resolve(dcgi_client, &r, args[0]))
+ if(dcgi_client && !disorder_resolve(dcgi_client, args[0], &r))
return sink_writes(output, r) < 0 ? -1 : 0;
return 0;
}
/* Get the list */
if(fn(dcgi_client, dir, re, &tracks, &ntracks))
return 0;
- /* Sort it. NB trackname_transform() does not go to the server. */
- tsd = tracksort_init(ntracks, tracks, type);
- /* Expand the subsiduary templates. We chuck in @sort and @display because
- * it is particularly easy to do so. */
- for(n = 0; n < ntracks; ++n)
- if((rc = mx_expand(mx_rewritel(m,
- "index", make_index(n),
- "parity", n % 2 ? "odd" : "even",
- "track", tsd[n].track,
- "first", n == 0 ? "true" : "false",
- "last", n + 1 == ntracks ? "false" : "true",
- "sort", tsd[n].sort,
- "display", tsd[n].display,
- (char *)0),
- output, u)))
- return rc;
+ if(type) {
+ /* Sort it. NB trackname_transform() does not go to the server. */
+ tsd = tracksort_init(ntracks, tracks, type);
+ /* Expand the subsiduary templates. We chuck in @sort and @display because
+ * it is particularly easy to do so. */
+ for(n = 0; n < ntracks; ++n)
+ if((rc = mx_expand(mx_rewritel(m,
+ "index", make_index(n),
+ "parity", n % 2 ? "odd" : "even",
+ "track", tsd[n].track,
+ "first", n == 0 ? "true" : "false",
+ "last", n + 1 == ntracks ? "false" : "true",
+ "sort", tsd[n].sort,
+ "display", tsd[n].display,
+ (char *)0),
+ output, u)))
+ return rc;
+ } else {
+ for(n = 0; n < ntracks; ++n)
+ if((rc = mx_expand(mx_rewritel(m,
+ "index", make_index(n),
+ "parity", n % 2 ? "odd" : "even",
+ "track", tracks[n],
+ "first", n == 0 ? "true" : "false",
+ "last", n + 1 == ntracks ? "false" : "true",
+ (char *)0),
+ output, u)))
+ return rc;
+ }
return 0;
-
}
/*$ @tracks{DIR}{RE}{TEMPLATE}
const struct mx_node **args,
struct sink *output,
void *u) {
- return exp__files_dirs(nargs, args, output, u, "dir", disorder_directories);
+ return exp__files_dirs(nargs, args, output, u, "dir", disorder_dirs);
}
static int exp__search_shim(disorder_client *c, const char *terms,
* - @parity: "even" or "odd" alternately
* - @first: "true" on the first directory and "false" otherwise
* - @last: "true" on the last directory and "false" otherwise
- * - @sort: the sort key for this track
- * - @display: the UNQUOTED display string for this track
*/
static int exp_search(int nargs,
const struct mx_node **args,
struct sink *output,
void *u) {
- return exp__files_dirs(nargs, args, output, u, "track", exp__search_shim);
+ return exp__files_dirs(nargs, args, output, u, NULL, exp__search_shim);
}
/*$ @label{NAME}
return rc;
/* Reject relative paths */
if(dir[0] != '/') {
- error(0, "breadcrumbs: '%s' is a relative path", dir);
+ disorder_error(0, "breadcrumbs: '%s' is a relative path", dir);
return 0;
}
/* Skip the root */