diff options
author | Christian Pointner <equinox@helsinki.at> | 2017-04-07 00:40:57 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2017-04-07 00:40:57 (GMT) |
commit | 8ee4333919acd638d2f1a011c287fc4bad88f166 (patch) | |
tree | f72619bedd7d4cf553a0bd2a2cd0db6ea8cfd04a /program/utils.py | |
parent | 9f9c557d6c2f741025b44d12669772a9194c25ca (diff) | |
parent | 6eabfdd69ecf3b7615e9522ae3839554afc72864 (diff) |
Merge branch 'master' into stable
Diffstat (limited to 'program/utils.py')
-rw-r--r-- | program/utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/program/utils.py b/program/utils.py index 3befeaf..1a81766 100644 --- a/program/utils.py +++ b/program/utils.py @@ -40,6 +40,16 @@ def get_automation_id_choices(): 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()) + + return shows + + def tofirstdayinisoweek(year, week): # http://stackoverflow.com/questions/5882405/get-date-from-iso-week-number-in-python ret = datetime.strptime('%04d-%02d-1' % (year, week), '%Y-%W-%w') |