diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/management/commands/importprogramslots.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/program/management/commands/importprogramslots.py b/program/management/commands/importprogramslots.py index 4d71afa..8739bbb 100644 --- a/program/management/commands/importprogramslots.py +++ b/program/management/commands/importprogramslots.py @@ -44,15 +44,18 @@ WHERE letzter_termin > current_date AND titel NOT LIKE 'Musikprogramm' AND titel try: rrule = RRULES[rhytmus] - try: show = Show.objects.get(name=titel) - - programslot = ProgramSlot(rrule=rrule, byweekday=termin, show=show, dstart=erster_termin, tstart=tstart, tend=tend, until=letzter_termin) - programslot.save() - counter += 1 except ObjectDoesNotExist: print 'show with name "%s" not found' % titel + else: + programslot = ProgramSlot(rrule=rrule, byweekday=termin, show=show, dstart=erster_termin, tstart=tstart, + tend=tend, until=letzter_termin) + try: + programslot.save() + counter += 1 + except: + pass except KeyError: print 'rhythmus "%i" is not supported for sendung "%s"' % (rhytmus, titel) @@ -73,15 +76,17 @@ WHERE letzter_termin > current_date AND titel LIKE '%%(Wiederholung)'""") try: rrule = RRULES[rhytmus] - try: show = Show.objects.get(name=titel) - - programslot = ProgramSlot(rrule=rrule, byweekday=termin, show=show, dstart=erster_termin, tstart=tstart, tend=tend, until=letzter_termin, is_repetition=True) - programslot.save() - counter += 1 except ObjectDoesNotExist: print 'show with name "%s" not found' % titel + else: + programslot = ProgramSlot(rrule=rrule, byweekday=termin, show=show, dstart=erster_termin, tstart=tstart, tend=tend, until=letzter_termin, is_repetition=True) + try: + programslot.save() + counter += 1 + except: + pass except KeyError: print 'rhythmus "%i" is not supported for sendung "%s"' % (rhytmus, titel) |