IceTV-managed timers deleted twice

Issue #515 resolved
prl created an issue

When IceTV-managed timers are deleted, either from the Beyonwiz or from the IceTV Web page, the Beyonwiz notifies the IceTV server twice that the timer has been deleted. This can be seen in the IceTV log on the Beyonwiz as two "Timer deleted OK" messages. Sometimes, instead, there is one "Timer deleted OK" message and one "Can not delete timer: 404 Client Error: Not Found" message.

The timer is deleted correctly on the IceTV server.

Details

When IceTV-managed timers are deleted, either from the Beyonwiz or from the IceTV Web page, the IceTV server is notified about the deletion on the Beyonwiz through callbacks from RecordTimer.onTimerRemoved and RecordTimer.onTimerChanged.

The RecordTimer.onTimerChanged callbacks are called from RecordTimer.removeEntry() via RecordTimer.timeChanged() whenever a timer is removed when its state is not StateEnded.

Before the RecordTimer.onTimerChanged callbacks are called, RecordTimer.removeEntry() calls Timer.abort() on the timer being deleted. If the timer has not yet started abort() sets the timer start and end times to be equal to the current time. If the timer start is less than the timer end time in EPGFetcher.onTimerChanged(), then EPGFetcher.onTimerChanged() calls EPGFetcher.onTimerRemoved(). EPGFetcher.onTimerRemoved() is called again later in RecordTimer.removeEntry() via RecordTimer.onTimerRemoved, and that results in two "delete timer" messages being sent to the IceTV server for each timer deleted.

Replication Steps

Create a "single" recording for a program on the IceTV Web pages.

Use MENU>IceTV>Fetch EPG and update timers now to sync the Beyonwiz with IceTV.

Delete the recording on the IceTV server.

Use MENU>IceTV>Fetch EPG and update timers now to sync the Beyonwiz with IceTV.

Examine the IceTV log on the Beyonwiz with MENU>IceTV>Show log. It will show two entries for the deletion, either both "Timer deleted OK", or one "OK" message and one "Can not delete timer ..." message.

Comments (1)

  1. Peter Urbanec

    Fix Bug #515: IceTV-managed timers deleted twice

    [EPGFetcher]

    In onTimerChanged(), use entry.cancelled to determine wthether the method has been called because the timer has only been changed (entry.cancelled is False), or whether the method has been called in a step in removing the timer (entry.cancelled is True), in which case onTimerRemoved() will be called later and the timer can be processed once there.

    So if entry.cancelled is True, onTimerChanged() returns immediately.

    → <<cset 550ace2870a7>>

  2. Log in to comment