Make use of Spotify playlist folder configurable

This commit is contained in:
ejurgensen 2015-03-30 00:59:55 +02:00
parent 892fd9c402
commit 33bc7227ea
3 changed files with 22 additions and 9 deletions

View File

@ -164,6 +164,11 @@ spotify {
# 0: No preference (default), 1: 96kbps, 2: 160kbps, 3: 320kbps
# bitrate = 0
# Your Spotify playlists will by default be put in a "Spotify" playlist
# folder. If you would rather have them together with your other
# playlists you can set this option to true.
# base_playlist_disable = false
# Spotify playlists usually have many artist, and if you don't want every
# artist to be listed when artist browsing in Remote, you can set the
# artist_override flag to true. This will use the compilation_artist as

View File

@ -113,6 +113,7 @@ static cfg_opt_t sec_spotify[] =
CFG_STR("settings_dir", STATEDIR "/cache/" PACKAGE "/libspotify", CFGF_NONE),
CFG_STR("cache_dir", "/tmp", CFGF_NONE),
CFG_INT("bitrate", 0, CFGF_NONE),
CFG_BOOL("base_playlist_disable", cfg_false, CFGF_NONE),
CFG_BOOL("artist_override", cfg_false, CFGF_NONE),
CFG_BOOL("starred_artist_override", cfg_false, CFGF_NONE),
CFG_BOOL("album_override", cfg_false, CFGF_NONE),

View File

@ -1245,6 +1245,7 @@ artwork_get(struct spotify_command *cmd)
static void
logged_in(sp_session *sess, sp_error error)
{
cfg_t *spotify_cfg;
sp_playlist *pl;
sp_playlistcontainer *pc;
struct playlist_info pli;
@ -1264,17 +1265,23 @@ logged_in(sp_session *sess, sp_error error)
pl = fptr_sp_session_starred_create(sess);
fptr_sp_playlist_add_callbacks(pl, &pl_callbacks, NULL);
memset(&pli, 0, sizeof(struct playlist_info));
pli.title = "Spotify";
pli.type = PL_PLAIN;
pli.path = "spotify:playlistfolder";
ret = db_pl_add(&pli, &g_base_plid);
if (ret < 0)
spotify_cfg = cfg_getsec(cfg, "spotify");
if (! cfg_getbool(spotify_cfg, "base_playlist_disable"))
{
DPRINTF(E_LOG, L_SPOTIFY, "Error adding base playlist\n");
return;
memset(&pli, 0, sizeof(struct playlist_info));
pli.title = "Spotify";
pli.type = PL_FOLDER;
pli.path = "spotify:playlistfolder";
ret = db_pl_add(&pli, &g_base_plid);
if (ret < 0)
{
DPRINTF(E_LOG, L_SPOTIFY, "Error adding base playlist\n");
return;
}
}
else
g_base_plid = 0;
pc = fptr_sp_session_playlistcontainer(sess);