Interface SaveLocationManager

All Known Subinterfaces:
DefaultSaveLocationManager

public interface SaveLocationManager
Plugins which want to control the logic of where the default save location for downloads (including for on-completion and on-removal behaviour) can implement this class and register it through the DownloadManager.setSaveLocationManager(SaveLocationManager).

Each method here returns a SaveLocationChange object, which contains instructions which allows both the download and the torrent to be moved and renamed.

The methods here take two arguments - for_move and on_event.

  • When events happen to downloads (like the download being completed or removed), both of these values will be true.
  • When something is trying to update the logical location for the download, for_move will be true, while on_event will be false.
  • When something is trying to determine all the places where existing data files might exist, both values will be false.
If for_move is false, any checks normally performed on a download to see if it is applicable or not (to be managed by this object) should not be applied here.

Note: This interface is intended to be implemented by plugins.

Since:
3.1.0.1
  • Method Summary

    Modifier and Type
    Method
    Description
    onCompletion(Download download, boolean for_move, boolean on_event)
    Return the location to move the download to when it is completed (or return null to keep the download and torrent in the same location).
    onInitialization(Download download, boolean for_move, boolean on_event)
    Return the location to move the download to when it first started (or return null to keep the download and torrent in the same location).
    onRemoval(Download download, boolean for_move, boolean on_event)
    Return the location to move the download to when it is removed (or return null to keep the download and torrent in the same location).
  • Method Details

    • onInitialization

      SaveLocationChange onInitialization(Download download, boolean for_move, boolean on_event)
      Return the location to move the download to when it first started (or return null to keep the download and torrent in the same location).
      Parameters:
      download - Download to handle.
      for_move - true if the download is going to be moved, or false if the logical path is just being calculated for other reasons.
      on_event - true if the download really is being initialised, or false if we are just determining the appropriate location for an incomplete download.
      Returns:
      The new save location instructions.
    • onCompletion

      SaveLocationChange onCompletion(Download download, boolean for_move, boolean on_event)
      Return the location to move the download to when it is completed (or return null to keep the download and torrent in the same location).
      Parameters:
      download - Download to handle.
      for_move - true if the download is going to be moved, or false if the logical path is just being calculated for other reasons.
      on_event - true if the download really is being moved for completion, or false if we are just determining the appropriate location for an complete download.
      Returns:
      The new save location instructions.
    • onRemoval

      SaveLocationChange onRemoval(Download download, boolean for_move, boolean on_event)
      Return the location to move the download to when it is removed (or return null to keep the download and torrent in the same location).
      Parameters:
      download - Download to handle.
      for_move - true if the download is going to be moved, or false if the logical path is just being calculated for other reasons.
      on_event - true if the download really is being removed, or false if we are just determining the appropriate location for the download when it is removed.
      Returns:
      The new save location instructions.