myMPD
Internal API documentation
Loading...
Searching...
No Matches
cache_rax_album.c File Reference

Album cache. More...

#include "compile_time.h"
#include "src/lib/cache/cache_rax_album.h"
#include "dist/mpack/mpack.h"
#include "dist/rax/rax.h"
#include "src/lib/album.h"
#include "src/lib/filehandler.h"
#include "src/lib/log.h"
#include "src/lib/mem.h"
#include "src/lib/mpack.h"
#include "src/lib/sds_extras.h"
#include "src/lib/utility.h"
#include "src/mympd_client/tags.h"
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for cache_rax_album.c:

Enumerations

enum  { ALBUM_CACHE_VERSION = 1 }
 

Functions

static struct t_albumalbum_from_mpack_node (mpack_node_t album_node, const struct t_mympd_mpd_tags *tags, sds *key, const struct t_albums_config *album_config)
 
enum album_modes parse_album_mode (const char *mode_str)
 
const char * lookup_album_mode (enum album_modes mode)
 
bool album_cache_remove (sds workdir)
 
bool album_cache_read (struct t_cache *album_cache, sds workdir, const struct t_albums_config *album_config)
 
bool album_cache_write (struct t_cache *album_cache, sds workdir, const struct t_mympd_mpd_tags *album_tags, const struct t_albums_config *album_config, bool free_data)
 
sds album_cache_get_key_from_song (sds albumkey, const struct mpd_song *song, const struct t_albums_config *album_config)
 
sds album_cache_get_key_from_album (sds albumkey, const struct t_album *album, const struct t_albums_config *album_config)
 
struct t_albumalbum_cache_get_album (struct t_cache *album_cache, sds key)
 
void album_cache_free (struct t_cache *album_cache)
 
void album_cache_free_rt (rax *album_cache_rt)
 
void album_cache_free_rt_void (void *album_cache_rt)
 

Detailed Description

Album cache.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Private definitions

Function Documentation

◆ album_cache_free()

void album_cache_free ( struct t_cache album_cache)

Frees the album cache

Parameters
album_cachepointer to t_cache struct

◆ album_cache_free_rt()

void album_cache_free_rt ( rax *  album_cache_rt)

Frees the album cache radix tree

Parameters
album_cache_rtPointer to album cache radix tree

◆ album_cache_free_rt_void()

void album_cache_free_rt_void ( void *  album_cache_rt)

Frees the album cache radix tree

Parameters
album_cache_rtPointer to album cache radix tree

◆ album_cache_get_album()

struct t_album * album_cache_get_album ( struct t_cache album_cache,
sds  key 
)

Gets the album from the album cache

Parameters
album_cachepointer to t_cache struct
keythe album
Returns
mpd_song struct representing the album or NULL on error

◆ album_cache_get_key_from_album()

sds album_cache_get_key_from_album ( sds  albumkey,
const struct t_album album,
const struct t_albums_config album_config 
)

Constructs the albumkey from album struct

Parameters
albumkeyalready allocated sds string to set the key
albumt_album struct
album_configalbum configuration
Returns
pointer to changed albumkey

◆ album_cache_get_key_from_song()

sds album_cache_get_key_from_song ( sds  albumkey,
const struct mpd_song *  song,
const struct t_albums_config album_config 
)

Constructs the albumkey from song info

Parameters
albumkeyalready allocated sds string to set the key
songmpd song struct
album_configalbum configuration
Returns
pointer to changed albumkey

◆ album_cache_read()

bool album_cache_read ( struct t_cache album_cache,
sds  workdir,
const struct t_albums_config album_config 
)

Reads the album cache from disc

Parameters
album_cachepointer to t_cache struct
workdirmyMPD working directory
album_configalbum configuration
Returns
bool true on success, else false

◆ album_cache_remove()

bool album_cache_remove ( sds  workdir)

Removes the album cache file

Parameters
workdirmyMPD working directory
Returns
bool true on success, else false

◆ album_cache_write()

bool album_cache_write ( struct t_cache album_cache,
sds  workdir,
const struct t_mympd_mpd_tags album_tags,
const struct t_albums_config album_config,
bool  free_data 
)

Saves the album cache to disc in mpack format

Parameters
album_cachepointer to t_cache struct
workdirmyMPD working directory
album_tagsalbum tags to write
album_configalbum configuration
free_datatrue=free the album cache, else not
Returns
bool true on success, else false

◆ album_from_mpack_node()

static struct t_album * album_from_mpack_node ( mpack_node_t  album_node,
const struct t_mympd_mpd_tags tags,
sds *  key,
const struct t_albums_config album_config 
)
static

Private functions Creates a mpd_song struct from cache

Parameters
album_nodempack node to parse
tagstags to read
keyalready allocated sds string to set the album key
album_configalbum configuration
Returns
struct mpd_song* allocated mpd_song struct

◆ lookup_album_mode()

const char * lookup_album_mode ( enum album_modes  mode)

Lookups the album mode

Parameters
modethe album mode
Returns
album mode as string

◆ parse_album_mode()

enum album_modes parse_album_mode ( const char *  mode_str)

Public functions Parses the string to the album mode enum

Parameters
mode_strstring to parse
Returns
the album mode as enum