Improve resume point setting performance in media player

Issue #537 resolved
prl created an issue

The speed of resume point setting in the media player is adversely affected if there are a large number of active entries in the cache (saved in /etc/enigma2/resumepoints.pkl) because the cache validates the existence of all files in the cache on each resume point save, and removes any invalid entries that are more than a day old. This can take several seconds and delays the return to the media player selection screen after playback stops.

The current cache has an unbounded size.

It is suggested that the cache should be limited to a user-configurable size. If the cache is larger than this size after adding a new entry, the two oldest entries (from their LRU timestamp) should be removed from the cache.

The suggested configurable sizes are: Disabled, 100, 200, 500, 1000, 2000, 5000.

If the cache is disabled, it will be cleared when InfobarGenerics.setResumePoint() is next called. If the cache is otherwise reduced in size, the "reduce by two" size limitation algorithm will gradually deduce the cache size to the new limit.

If the cache is disabled, no new entries will be set.

Suggested improvements to accompany these changes;

  • The cache is reloaded from disk each time MovieSelection is created. This happens both when the MovieSelection screen is opened from live TV, and also when playback stops. The cache only needs to be reloaded if an external agent changes it.
  • Currently, cache entries are only explicitly removed by a call to InfobarGenerics.delResumePoint() when individual recordings or files are moved to trash or deleted, but if a directory is moved to trash or deleted, the files within it (or its subdirectories) are not removed from the cache. If a directory is directory is moved to trash or deleted, the cache entries or the files within it (or its subdirectories) should be removed. Deletion of such files was previously handled by the code that tested for the validity of the entries in the cache.
  • Allow InfobarGenerics.getResumePoint() to return a resume point when he serviceref type field indicates a DVB file (type = 1).
  • Use Tools.Directories.resolveFilename() to set the path of the resumepoints.pkl file instead of using a fixed pathname.

Comments (3)

  1. Peter Urbanec

    Fix issue #537: Remove resume point cache entries when directories are deleted

    This commit completes the enhancement implementation.

    [InfoBarGenerics]

    Add code to InfoBarGenerics.delResumePoint() delete all the resume point cache entry entries contained in the serviceref argument if the serviceref has the eServiceReference.mustDescent flag set.

    [MovieSelection]

    Use the new functionality of InfoBarGenerics.delResumePoint() to delete cache entries for media and recordings when a folder is deleted or moved to trash, and when either a recording/media file or a directory is moved or renamed in the media player.

    → <<cset 819a9c22e993>>

  2. Log in to comment