rtmp-services: Remove Twtich "Auto" if API down and not cached

Prevents new users from having a poor user experience if the Twitch API
for getting the closest servers is currently down.
This commit is contained in:
jp9000
2017-08-02 13:31:23 -07:00
parent 02b4ea028e
commit 9add73f656
2 changed files with 3 additions and 15 deletions

View File

@@ -247,12 +247,12 @@ static bool fill_twitch_servers_locked(obs_property_t *servers_prop)
{
size_t count = twitch_ingest_count();
obs_property_list_add_string(servers_prop,
obs_module_text("Server.Auto"), "auto");
if (count <= 1)
return false;
obs_property_list_add_string(servers_prop,
obs_module_text("Server.Auto"), "auto");
for (size_t i = 0; i < count; i++) {
struct twitch_ingest ing = twitch_ingest(i);
obs_property_list_add_string(servers_prop, ing.name, ing.url);

View File

@@ -28,14 +28,6 @@ static void free_ingests(void)
da_free(cur_ingests);
}
static inline void init_defaults(void)
{
struct ingest ingest = {0};
ingest.name = bstrdup("Default");
ingest.url = bstrdup("rtmp://live.twitch.tv/app");
da_push_back(cur_ingests, &ingest);
}
static void load_ingests(const char *json, bool write_file)
{
json_t *root;
@@ -100,8 +92,6 @@ static void load_ingests(const char *json, bool write_file)
bfree(cache_new);
finish:
if (!cur_ingests.num)
init_defaults();
if (root)
json_decref(root);
}
@@ -157,8 +147,6 @@ void load_twitch_data(const char *module_str)
pthread_mutex_unlock(&mutex);
bfree(data);
} else {
init_defaults();
}
twitch_update_info = update_info_create_single(