Documentation
¶
Overview ¶
Package recyclebin moves episode files Pilot deletes (replaced by an upgrade, or deleted from the UI) into a recycle bin folder instead of deleting them, as in Sonarr. Files keep their series/season folders inside the bin, and are deleted for good after the cleanup period.
With no recycle bin folder set, files are deleted permanently, which is the behavior before the recycle bin existed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service recycles files.
func (*Service) Cleanup ¶
Cleanup deletes files that have been in the recycle bin longer than the cleanup period, then removes folders left empty. It returns how many files were deleted. Nothing happens with no bin or a period of 0.
func (*Service) Delete ¶
Delete removes the file at path: into the recycle bin when one is set, otherwise permanently. libraryRoot (may be "") is the library the file belongs to; the file keeps its folders below it inside the bin. It returns where the file went ("" when deleted permanently). A file that is already gone is not an error.
If the settings can't be loaded the file is left alone and an error returned: never delete permanently when the user may have a bin set.
func (*Service) Empty ¶
Empty deletes everything in the recycle bin. It returns how many files were deleted.
func (*Service) Preserve ¶
Preserve moves the file at path into the recycle bin when one is set, and otherwise leaves it alone. Use it just before overwriting a file: with no bin, the overwrite itself replaces it (atomically), and nothing is lost if the overwrite fails. Returns where the file went ("" when it was left in place).
type SettingsGetter ¶
type SettingsGetter interface {
Get(ctx context.Context) (mediamanagement.Settings, error)
}
SettingsGetter loads the media management settings, which hold the recycle bin folder and cleanup period.