summaryrefslogtreecommitdiff
path: root/program/management
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2017-04-06 23:19:05 (GMT)
committerChristian Pointner <equinox@helsinki.at>2017-04-06 23:19:05 (GMT)
commit9f9c557d6c2f741025b44d12669772a9194c25ca (patch)
tree0ef38f5bab327ea1673c2979b3e57e4e9d9469cb /program/management
parent25b6bfba7d9b658b545673760445730dd915c461 (diff)
parentf1c2a3986cc1f5ddc360f5f28299a9e8eb4c89ca (diff)
Merge branch 'master' into stable
Diffstat (limited to 'program/management')
-rw-r--r--program/management/commands/check_automation_ids.py39
1 files changed, 24 insertions, 15 deletions
diff --git a/program/management/commands/check_automation_ids.py b/program/management/commands/check_automation_ids.py
index be57ae2..95c35cb 100644
--- a/program/management/commands/check_automation_ids.py
+++ b/program/management/commands/check_automation_ids.py
@@ -14,22 +14,31 @@ class Command(NoArgsCommand):
cache_dir = getattr(settings, 'AUTOMATION_CACHE_DIR', 'cache')
cached_shows = join(cache_dir, 'shows.json')
with open(cached_shows) as shows_json:
- shows = json.loads(shows_json.read())['shows']
+ shows = json.loads(shows_json.read())
- automation_ids = []
- for show in shows:
- automation_ids.append(show['id'])
- automation_ids.sort()
+ rd_ids = {}
+ for show in shows['shows']:
+ rd_ids[show['id']] = show
+ for show in shows['multi-shows']:
+ rd_ids[show['id']] = show
- automation_ids2 = []
+ pv_ids = []
for programslot in ProgramSlot.objects.filter(automation_id__isnull=False):
- automation_ids2.append(int(programslot.automation_id))
- automation_ids2.sort()
-
- for automation_id in automation_ids:
- if automation_id not in automation_ids2:
- print '+', automation_id
-
- for automation_id in automation_ids2:
- if automation_id not in automation_ids:
+ pv_ids.append(int(programslot.automation_id))
+
+ for automation_id in sorted(rd_ids.iterkeys()):
+ if rd_ids[automation_id]['type'] == 's':
+ continue
+
+ multi_id = -1
+ if 'multi' in rd_ids[automation_id]:
+ multi_id = rd_ids[automation_id]['multi']['id']
+ if automation_id not in pv_ids and multi_id not in pv_ids:
+ if multi_id < 0:
+ print '+ %d' % (automation_id)
+ else:
+ print '+ %d (%d)' % (automation_id, multi_id)
+
+ for automation_id in sorted(pv_ids):
+ if automation_id not in rd_ids:
print '-', automation_id