From 8350d68158ee136c6b37effee9cfae89143630f5 Mon Sep 17 00:00:00 2001
From: Ernesto Rico Schmidt <ernesto@helsinki.at>
Date: Mon, 24 Jan 2022 17:36:36 -0400
Subject: [PATCH] Remove get_automation_id_choices from utils

---
 program/utils.py | 36 ------------------------------------
 1 file changed, 36 deletions(-)

diff --git a/program/utils.py b/program/utils.py
index 94298e28..0cc3eeec 100644
--- a/program/utils.py
+++ b/program/utils.py
@@ -18,52 +18,16 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-import bisect
 import json
-import urllib
 from datetime import datetime, date, timedelta
 from os.path import join
 
 from django.conf import settings
 
 
-def get_automation_id_choices():
-    base_url = getattr(settings, 'AUTOMATION_BASE_URL', None)
-    cache_dir = getattr(settings, 'AUTOMATION_CACHE_DIR', 'cache')
-    cached_shows = join(cache_dir, 'shows.json')
-    shows = []
-    if base_url:
-        try:
-            shows_json = urllib.request.urlopen(base_url).read()
-            shows_list = json.loads(shows_json)['shows']
-            multi_shows_list = json.loads(shows_json)['multi-shows']
-        except IOError:
-            try:
-                with open(cached_shows) as cache:
-                    shows_list = json.loads(cache.read())['shows']
-                    multi_shows_list = json.loads(cache.read())['multi-shows']
-            except IOError:
-                shows_list = []
-                multi_shows_list = []
-        else:
-            with open(cached_shows, 'w') as cache:
-                cache.write(shows_json)
-
-        shows = [(s['id'], '%d | %s' % (s['id'], s['title']), s['title']) for s in shows_list if not s.get('multi')]
-
-        [bisect.insort(shows, (s['id'], '%05d | %s' % (s['id'], s['title']), s['title'])) for s in multi_shows_list]
-
-        shows.sort(key=lambda show: show[2].lower())
-
-        shows = [(s[0], s[1]) for s in shows]
-
-    return shows
-
-
 def get_cached_shows():
     cache_dir = getattr(settings, 'AUTOMATION_CACHE_DIR', 'cache')
     cached_shows = join(cache_dir, 'shows.json')
-    shows = {}
     with open(cached_shows) as shows_json:
         shows = json.loads(shows_json.read())
 
-- 
GitLab