From f4a66c8defdb99663ab9f2e14e5d273e137e0d5c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 29 Apr 2018 03:13:08 +0200 Subject: [PATCH] setting_helpers.h: add generic function for api keys Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f2d3b96160094f1cca3c59a1143aba44d747450a Author: Thilo Graf Date: 2018-04-29 (Sun, 29 Apr 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/system/setting_helpers.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/system/setting_helpers.h b/src/system/setting_helpers.h index 392738bda..c0127353d 100644 --- a/src/system/setting_helpers.h +++ b/src/system/setting_helpers.h @@ -159,9 +159,13 @@ class CAutoModeNotifier : public CChangeObserver }; //do we need a class? -inline int check_shoutcast_dev_id() { return ((g_settings.shoutcast_dev_id != "XXXXXXXXXXXXXXXX") && !g_settings.shoutcast_dev_id.empty()); } -inline int check_youtube_dev_id() { return ((g_settings.youtube_dev_id != "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") && !g_settings.youtube_dev_id.empty()); } -inline int check_tmdb_api_key() { return ((g_settings.tmdb_api_key != "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") && !g_settings.tmdb_api_key.empty()); } -inline int check_omdb_api_key() { return ((g_settings.omdb_api_key != "XXXXXXXX") && !g_settings.omdb_api_key.empty()); } +int check_api_key(const std::string& api_key_setting, const std::string& api_key_pattern) +{ + return ((api_key_setting != api_key_pattern) && !api_key_setting.empty()); +} +inline int check_shoutcast_dev_id() { return check_api_key(g_settings.shoutcast_dev_id, "XXXXXXXXXXXXXXXX"); } +inline int check_youtube_dev_id() { return check_api_key(g_settings.youtube_dev_id, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } +inline int check_tmdb_api_key() { return check_api_key(g_settings.tmdb_api_key, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } +inline int check_omdb_api_key() { return check_api_key(g_settings.omdb_api_key, "XXXXXXXX"); } #endif