teltek / Galicaster

The Galicaster Project is an open initiative to provide flexible, state-of-the-art solutions for recording educational multimedia contents like lectures and conferences
galicaster.teltek.es
Other
35 stars 31 forks source link

Galicaster does not update scheduled events when their date/time changes #443

Closed smarquard closed 7 years ago

smarquard commented 7 years ago
  1. Schedule an event on an Opencast server
  2. CA updates the iCal, mediapackage is created for new event in the Galicaster repo
  3. Adjust the date/time of the event on the Opencast server (e.g. move it a day earlier or later)
  4. Galicaster updates the local iCal file (opencast/client iCal modified), but does not update the date/time of the existing scheduled event
  5. Event records at the wrong date/time.

Adding new events works ok, and deleting events works ok.

smarquard commented 7 years ago

At least 2 code errors:

In "galicaster/utils/ical.py"

def get_updated_events(old_events, new_events):
    out = list()
    for old_event in old_events:
        for new_event in new_events:
            if (old_event['UID'] == new_event['UID'] and
                old_event['DTSTART'].dt.replace(tzinfo=None) != new_event['DTSTART'].dt.replace(tzinfo=None)):
                out.append(old_event)
    return out

This check is not sufficient, because the start date/time might be the same, but the end date/time may have changed. Also other attributes (like title / presenter) could have changed.

Then later in handle_ical in the same file, the indentation is wrong for this code block:

         for event in update_events:
                logger and logger.info('Updating MP with UID {0} from ical'.format(event['UID']))
                mp = repo.get(event['UID'])
                scheduler.update_timer(mp)

so it's only executed if there are deleted events.

And then there is another bug in that the mediapackage in the repo is not updated with the new details.

smarquard commented 7 years ago

I think the final fix for this is to change in get_updated_events:

                out.append(old_event)

to

                out.append(new_event)

and then in handle_ical, add create_mp(repo, event) like this:

            for event in update_events:
                logger and logger.info('Updating MP with UID {0} from ical'.format(event['UID']))
                create_mp(repo, event)
                mp = repo.get(event['UID'])
                scheduler.update_timer(mp)
smarquard commented 7 years ago

@dpeite will there be a fix for this soon?

dpeite commented 7 years ago

I'm working on this, tomorrow will be finished.

dpeite commented 7 years ago

Not finished yet, I have a little problem when I update a series in opencast.

silviabf commented 7 years ago

This bug is fixed, you can edit a scheduled recording in opencast and galicaster changes the event to the new values. I close this issue. thank you @smarquard for the report.