paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Functions
playlist.c File Reference

Functions for loading and saving playlists. More...

#include <regex.h>
#include <osl.h>
#include <lopsub.h>
#include "para.h"
#include "error.h"
#include "string.h"
#include "afh.h"
#include "afs.h"
#include "ipc.h"
#include "sideband.h"

Functions

int playlist_check_callback (struct afs_callback_arg *aca)
 Check the playlist table for inconsistencies. More...
 
void playlist_unload (struct playlist_instance *pi)
 Free all resources of the given/current playlist. More...
 
int playlist_load (const char *name, struct playlist_instance **result, char **msg)
 Populate the score table from the paths of a playlist database object. More...
 
int playlist_loop (struct playlist_instance *pi, osl_rbtree_loop_func *func, void *data)
 Iterate over all admissible audio files of a playlist instance. More...
 
int playlists_event_handler (enum afs_events event, __a_unused struct para_buffer *pb, void *data)
 Handle afs events relevant to playlists. More...
 

Detailed Description

Functions for loading and saving playlists.

Function Documentation

◆ playlist_check_callback()

int playlist_check_callback ( struct afs_callback_arg aca)

Check the playlist table for inconsistencies.

Parameters
acaThis callback ignores ->query.
Returns
Standard. Invalid paths are reported, but are not considered an error.

References BLOBCOL_ID, osl(), para_printf(), and afs_callback_arg::pbout.

◆ playlist_unload()

void playlist_unload ( struct playlist_instance *  pi)

Free all resources of the given/current playlist.

Parameters
piNULL means to unload the current playlist.

References score_close().

◆ playlist_load()

int playlist_load ( const char *  name,
struct playlist_instance **  result,
char **  msg 
)

Populate the score table from the paths of a playlist database object.

This loads the blob object which corresponds to the given name from the playlist table. Each line of the blob is regarded as a path which is looked up in the audio file table. If the path lookup succeeds, a reference to the corresponding row of the audio file table is added to the score table.

Parameters
nameThe name of the playlist to load.
resultOpaque, refers to the underlying score table.
msgError message or playlist info is returned here.
Returns
The length of the loaded playlist on success, negative error code else. Files which are listed in the playlist, but are not contained in the database are ignored. This is not considered an error.

References ERRNO_TO_PARA_ERROR, FELF_READ_ONLY, for_each_line(), make_message(), score_open(), and zalloc().

◆ playlist_loop()

int playlist_loop ( struct playlist_instance *  pi,
osl_rbtree_loop_func *  func,
void *  data 
)

Iterate over all admissible audio files of a playlist instance.

This wrapper around score_loop() is the playlist counterpart of mood_loop().

Parameters
piDetermines the score table to iterate. Must not be NULL.
funcSee score_loop().
dataSee score_loop().
Returns
See score_loop(), mood_loop().

References score_loop().

◆ playlists_event_handler()

int playlists_event_handler ( enum afs_events  event,
__a_unused struct para_buffer pb,
void *  data 
)

Handle afs events relevant to playlists.

Parameters
eventThe event type.
pbUnused.
dataDepends on the event type.
Returns
Standard.