Skip to content
  • Nicholas Little's avatar
    Dap: not purge at disconnect & virtualize load (bgo#732634) · ba87f8c8
    Nicholas Little authored and Andrés G. Aragoneses's avatar Andrés G. Aragoneses committed
    
    
    For DAP sources where metadata is difficult or costly to extract
    (i.e. Bluetooth, as it's a much slower medium), it is useful to
    keep the old metadata around to allow for speedy track enumeration
    in the cases where files are still present.
    
    To allow for those cases this patch:
    
    - Adds two new virtual methods, PreLoad() and PostLoad(), which
    allow subclasses to customise behaviour at those times
    (Bluetooth extension will override PreLoad() avoiding the purge
    of tracks; and will probably add caching strategies to both
    methods).
    - Removes calls to PurgeTracks() and PurgeTemporaryPlaylists()
    from the Dispose() method, which is called when the device is
    disconnected/ejected.
    
    For sources that don't take advantage of this new functionality,
    this shouldn't actually result in a change of behaviour (it is
    true that the track records will not be deleted from the DB when
    the device is disconnected; but this deletion will occur when
    the device is connected again anyway, at PreLoad() via
    PurgeTracks() and at Initialize() via PurgeTemporaryPlaylists(),
    like it used to happen.)
    
    Signed-off-by: default avatarAndrés G. Aragoneses <knocte@gmail.com>
    ba87f8c8