mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 08:05:56 -05:00
[spotify] Move "has_podcast_support" to spotify_status and expose this
flag in the web API
This commit is contained in:
parent
c58e792ff4
commit
ce3e79d804
@ -1232,6 +1232,7 @@ jsonapi_reply_spotify(struct httpd_request *hreq)
|
||||
spotify_status_get(&sp_status);
|
||||
json_object_object_add(jreply, "spotify_installed", json_object_new_boolean(sp_status.installed));
|
||||
json_object_object_add(jreply, "spotify_logged_in", json_object_new_boolean(sp_status.logged_in));
|
||||
json_object_object_add(jreply, "has_podcast_support", json_object_new_boolean(sp_status.has_podcast_support));
|
||||
safe_json_add_string(jreply, "libspotify_user", sp_status.username);
|
||||
|
||||
spotifywebapi_status_info_get(&webapi_info);
|
||||
|
@ -144,14 +144,3 @@ spotify_status_get(struct spotify_status *status)
|
||||
|
||||
backend->status_get(status);
|
||||
}
|
||||
|
||||
bool
|
||||
spotify_podcast_support()
|
||||
{
|
||||
struct spotify_backend *backend = backend_set();
|
||||
|
||||
if (!backend)
|
||||
return false;
|
||||
|
||||
return backend->has_podcast_support;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ struct spotify_status
|
||||
bool installed;
|
||||
bool logged_in;
|
||||
char username[128];
|
||||
bool has_podcast_support;
|
||||
};
|
||||
|
||||
struct spotify_backend
|
||||
@ -21,8 +22,6 @@ struct spotify_backend
|
||||
int (*relogin)(void);
|
||||
void (*uri_register)(const char *uri);
|
||||
void (*status_get)(struct spotify_status *status);
|
||||
|
||||
bool has_podcast_support;
|
||||
};
|
||||
|
||||
int
|
||||
@ -49,7 +48,4 @@ spotify_uri_register(const char *uri);
|
||||
void
|
||||
spotify_status_get(struct spotify_status *status);
|
||||
|
||||
bool
|
||||
spotify_podcast_support();
|
||||
|
||||
#endif /* !__SPOTIFY_H__ */
|
||||
|
@ -738,6 +738,7 @@ status_get(struct spotify_status *status)
|
||||
memcpy(status->username, ctx->status.username, sizeof(status->username));
|
||||
status->logged_in = ctx->status.logged_in;
|
||||
status->installed = true;
|
||||
status->has_podcast_support = true;
|
||||
|
||||
pthread_mutex_unlock(&ctx->lock);
|
||||
}
|
||||
@ -749,7 +750,5 @@ struct spotify_backend spotify_librespotc =
|
||||
.logout = logout,
|
||||
.relogin = relogin,
|
||||
.status_get = status_get,
|
||||
|
||||
.has_podcast_support = true,
|
||||
};
|
||||
|
||||
|
@ -116,6 +116,7 @@ status_get(struct spotify_status *status)
|
||||
|
||||
status->installed = info.libspotify_installed;
|
||||
status->logged_in = info.libspotify_logged_in;
|
||||
status->has_podcast_support = false;
|
||||
snprintf(status->username, sizeof(status->username), "%s", info.libspotify_user);
|
||||
}
|
||||
|
||||
@ -129,7 +130,5 @@ struct spotify_backend spotify_libspotify =
|
||||
.relogin = libspotify_relogin,
|
||||
.uri_register = libspotify_uri_register,
|
||||
.status_get = status_get,
|
||||
|
||||
.has_podcast_support = false,
|
||||
};
|
||||
|
||||
|
@ -1989,6 +1989,7 @@ create_base_playlist(void)
|
||||
static void
|
||||
scan(enum spotify_request_type request_type)
|
||||
{
|
||||
struct spotify_status sp_status;
|
||||
time_t start;
|
||||
time_t end;
|
||||
|
||||
@ -2006,7 +2007,8 @@ scan(enum spotify_request_type request_type)
|
||||
create_saved_tracks_playlist();
|
||||
scan_saved_albums(request_type);
|
||||
scan_playlists(request_type);
|
||||
if (spotify_podcast_support())
|
||||
spotify_status_get(&sp_status);
|
||||
if (sp_status.has_podcast_support)
|
||||
scan_saved_shows(request_type);
|
||||
|
||||
scanning = false;
|
||||
|
Loading…
Reference in New Issue
Block a user