seedboxsync
The SeedboxSync main package.
Modules:
-
__version__–All used version in 1 place.
-
app–The Flask app module.
-
cli–CLI package using Click framework.
-
core–Seedbox Core package.
-
taskmanager–Starter for the SeedboxSync taskmanager.
Functions:
-
create_app–Create and configure the SeedboxSync Flask application.
create_app
create_app(test_config: dict[str, str] | None = None) -> Flask
Create and configure the SeedboxSync Flask application.
Parameters:
-
(test_configdict[str, str] | None, default:None) –Optional configuration overrides used by tests.
Returns:
-
Flask(Flask) –Configured application instance.
Source code in seedboxsync/__init__.py
__version__
All used version in 1 place.
app
The Flask app module.
cli
CLI package using Click framework.
Modules:
-
cli–Cli module.
-
commands–Package with all SeedboxSync commands.
-
context–Build a context used by Click.
Classes:
Functions:
-
command–Create a Click command using the SeedboxSync command class.
-
group–Create a Click group using the SeedboxSync group class.
-
pass_context–Decorate a callback to receive the custom SeedboxSync Click context.
Cli
flowchart TD
seedboxsync.cli.Cli[Cli]
click seedboxsync.cli.Cli href "" "seedboxsync.cli.Cli"
SeedboxSync command-line interface.
This class customizes Flask's default CLI by:
- using the SeedboxSync context implementation;
- hiding Flask-specific global options;
- automatically loading commands from the commands package;
- using custom command and group classes by default.
Parameters:
-
(*argsAny, default:()) –Positional arguments forwarded to
FlaskGroup. -
(**kwargsAny, default:{}) –Keyword arguments forwarded to
FlaskGroup.
Methods:
-
command–Create a command using the custom SeedboxSync command class.
-
get_command–Load a command module dynamically.
-
group–Create a group using the custom SeedboxSync group class.
-
invoke–Invoke the selected command and handle user interruptions gracefully.
-
list_commands–Return the list of available SeedboxSync commands.
-
parse_args–Parse command-line arguments without Flask's implicit global options.
Source code in seedboxsync/cli/cli.py
command
Create a command using the custom SeedboxSync command class.
Parameters:
-
(*argsAny, default:()) –Positional arguments forwarded to Click.
-
(**kwargsAny, default:{}) –Keyword arguments forwarded to Click.
Returns:
-
Any–The decorated command.
Source code in seedboxsync/cli/cli.py
get_command
Load a command module dynamically.
Parameters:
-
(ctxContext) –The Click context.
-
(namestr) –The command name.
Returns:
-
Command | None–The loaded Click command, or
Noneif the command cannot be loaded.
Source code in seedboxsync/cli/cli.py
group
Create a group using the custom SeedboxSync group class.
Parameters:
-
(*argsAny, default:()) –Positional arguments forwarded to Click.
-
(**kwargsAny, default:{}) –Keyword arguments forwarded to Click.
Returns:
-
Any–The decorated group.
Source code in seedboxsync/cli/cli.py
invoke
invoke(ctx: Context) -> Any
Invoke the selected command and handle user interruptions gracefully.
Parameters:
-
(ctxContext) –The Click context.
Returns:
-
Any–The command result.
Source code in seedboxsync/cli/cli.py
list_commands
list_commands(ctx: Context) -> list[str]
Return the list of available SeedboxSync commands.
Parameters:
-
(ctxContext) –The Click context.
Returns:
-
list[str]–A sorted list of available command names.
Source code in seedboxsync/cli/cli.py
parse_args
Parse command-line arguments without Flask's implicit global options.
Parameters:
-
(ctx(Context,)) –The Click context.
-
(argslist) –The command-line arguments.
Returns:
-
list[str]–The parsed arguments.
Source code in seedboxsync/cli/cli.py
Context
flowchart TD
seedboxsync.cli.Context[Context]
click seedboxsync.cli.Context href "" "seedboxsync.cli.Context"
SeedboxSync Click context.
Methods:
-
render–Render tabular data using the specified output format.
Attributes:
app
cached
property
app: Flask
render
render(
data: Iterable[Any],
headers: str | dict[str, str] | Sequence[str],
tablefmt: str = "github",
) -> Any
Render tabular data using the specified output format.
Parameters:
-
(dataIterable[Any]) –Tabular data to render.
-
(headersstr | dict[str, str] | Sequence[str]) –Column headers passed to
tabulate. -
(tablefmtstr, default:'github') –Output table format.
Returns:
-
str(Any) –The formatted table.
Source code in seedboxsync/cli/context.py
command
Create a Click command using the SeedboxSync command class.
Parameters:
-
(*argsAny, default:()) –Positional arguments forwarded to Click.
-
(**kwargsAny, default:{}) –Keyword arguments forwarded to Click.
Returns:
-
Any–The decorated command.
Source code in seedboxsync/cli/cli.py
group
Create a Click group using the SeedboxSync group class.
Parameters:
-
(*argsAny, default:()) –Positional arguments forwarded to Click.
-
(**kwargsAny, default:{}) –Keyword arguments forwarded to Click.
Returns:
-
Any–The decorated group.
Source code in seedboxsync/cli/cli.py
pass_context
pass_context(func: Any) -> Any
Decorate a callback to receive the custom SeedboxSync Click context.
Parameters:
-
(funcAny) –The callback to decorate.
Returns:
-
Any–The decorated callback.
cli
Cli module.
Classes:
-
Cli–SeedboxSync command-line interface.
-
Command–SeedboxSync Click command using the custom context implementation.
-
Group–SeedboxSync Click command group using the custom context implementation.
Functions:
-
check_root_warning–Check if the script is being run as root and display a warning message.
-
command–Create a Click command using the SeedboxSync command class.
-
group–Create a Click group using the SeedboxSync group class.
-
pass_context–Decorate a callback to receive the custom SeedboxSync Click context.
Cli
flowchart TD
seedboxsync.cli.cli.Cli[Cli]
click seedboxsync.cli.cli.Cli href "" "seedboxsync.cli.cli.Cli"
SeedboxSync command-line interface.
This class customizes Flask's default CLI by:
- using the SeedboxSync context implementation;
- hiding Flask-specific global options;
- automatically loading commands from the commands package;
- using custom command and group classes by default.
Parameters:
-
(*argsAny, default:()) –Positional arguments forwarded to
FlaskGroup. -
(**kwargsAny, default:{}) –Keyword arguments forwarded to
FlaskGroup.
Methods:
-
command–Create a command using the custom SeedboxSync command class.
-
get_command–Load a command module dynamically.
-
group–Create a group using the custom SeedboxSync group class.
-
invoke–Invoke the selected command and handle user interruptions gracefully.
-
list_commands–Return the list of available SeedboxSync commands.
-
parse_args–Parse command-line arguments without Flask's implicit global options.
Source code in seedboxsync/cli/cli.py
command
Create a command using the custom SeedboxSync command class.
Parameters:
-
(*argsAny, default:()) –Positional arguments forwarded to Click.
-
(**kwargsAny, default:{}) –Keyword arguments forwarded to Click.
Returns:
-
Any–The decorated command.
Source code in seedboxsync/cli/cli.py
get_command
Load a command module dynamically.
Parameters:
-
(ctxContext) –The Click context.
-
(namestr) –The command name.
Returns:
-
Command | None–The loaded Click command, or
Noneif the command cannot be loaded.
Source code in seedboxsync/cli/cli.py
group
Create a group using the custom SeedboxSync group class.
Parameters:
-
(*argsAny, default:()) –Positional arguments forwarded to Click.
-
(**kwargsAny, default:{}) –Keyword arguments forwarded to Click.
Returns:
-
Any–The decorated group.
Source code in seedboxsync/cli/cli.py
invoke
invoke(ctx: Context) -> Any
Invoke the selected command and handle user interruptions gracefully.
Parameters:
-
(ctxContext) –The Click context.
Returns:
-
Any–The command result.
Source code in seedboxsync/cli/cli.py
list_commands
list_commands(ctx: Context) -> list[str]
Return the list of available SeedboxSync commands.
Parameters:
-
(ctxContext) –The Click context.
Returns:
-
list[str]–A sorted list of available command names.
Source code in seedboxsync/cli/cli.py
parse_args
Parse command-line arguments without Flask's implicit global options.
Parameters:
-
(ctx(Context,)) –The Click context.
-
(argslist) –The command-line arguments.
Returns:
-
list[str]–The parsed arguments.
Source code in seedboxsync/cli/cli.py
Command
flowchart TD
seedboxsync.cli.cli.Command[Command]
click seedboxsync.cli.cli.Command href "" "seedboxsync.cli.cli.Command"
SeedboxSync Click command using the custom context implementation.
Group
flowchart TD
seedboxsync.cli.cli.Group[Group]
click seedboxsync.cli.cli.Group href "" "seedboxsync.cli.cli.Group"
SeedboxSync Click command group using the custom context implementation.
Methods:
-
command–Create a command using the SeedboxSync command class by default.
-
group–Create a group using the SeedboxSync group class by default.
command
Create a command using the SeedboxSync command class by default.
Parameters:
-
(*argsAny, default:()) –Positional arguments forwarded to Click.
-
(**kwargsAny, default:{}) –Keyword arguments forwarded to Click.
Returns:
-
Any–The decorated command.
Source code in seedboxsync/cli/cli.py
group
Create a group using the SeedboxSync group class by default.
Parameters:
-
(*argsAny, default:()) –Positional arguments forwarded to Click.
-
(**kwargsAny, default:{}) –Keyword arguments forwarded to Click.
Returns:
-
Any–The decorated group.
Source code in seedboxsync/cli/cli.py
check_root_warning
Check if the script is being run as root and display a warning message.
This function checks the effective user ID (UID) on POSIX systems. If the process is executed with root privileges (UID 0), a warning is printed to stderr advising against running as root and providing guidance for Docker container usage.
Source code in seedboxsync/cli/cli.py
command
Create a Click command using the SeedboxSync command class.
Parameters:
-
(*argsAny, default:()) –Positional arguments forwarded to Click.
-
(**kwargsAny, default:{}) –Keyword arguments forwarded to Click.
Returns:
-
Any–The decorated command.
Source code in seedboxsync/cli/cli.py
group
Create a Click group using the SeedboxSync group class.
Parameters:
-
(*argsAny, default:()) –Positional arguments forwarded to Click.
-
(**kwargsAny, default:{}) –Keyword arguments forwarded to Click.
Returns:
-
Any–The decorated group.
Source code in seedboxsync/cli/cli.py
pass_context
pass_context(func: Any) -> Any
Decorate a callback to receive the custom SeedboxSync Click context.
Parameters:
-
(funcAny) –The callback to decorate.
Returns:
-
Any–The decorated callback.
commands
Package with all SeedboxSync commands.
Modules:
-
cmd_clean–All commands related to cleaning operations in SeedboxSync.
-
cmd_health–All commands related to health checks in SeedboxSync.
-
cmd_search–All commands related to search operations in SeedboxSync.
-
cmd_stats–All commands related to statistics operations in SeedboxSync.
-
cmd_sync–All commands related to synchronization operations in SeedboxSync.
-
cmd_task–All commands related to the task queue manager operations.
cmd_clean
All commands related to cleaning operations in SeedboxSync.
Functions:
-
cli–Empty function for Click sub commands.
-
downloaded–Remove a downloaded files by its ID.
-
progress–Remove all entries of files currently in download.
cli
downloaded
downloaded(id: int) -> None
Remove a downloaded files by its ID.
Allows the user to delete a specific downloaded torrent from the database, enabling it to be re-downloaded.
Prints a message indicating whether the torrent was removed or if no matching ID was found.
Parameters:
-
(idint) –The ID of the downloaded torrent to remove.
Source code in seedboxsync/cli/commands/cmd_clean.py
progress
Remove all entries of files currently in download.
This command deletes all records from the Download table where
the download is not yet finished (finished == 0).
Prints the number of deleted entries.
Source code in seedboxsync/cli/commands/cmd_clean.py
cmd_health
All commands related to health checks in SeedboxSync.
Functions:
-
cli–Show the health status of the SeedboxSync CLI and web service.
cli
Show the health status of the SeedboxSync CLI and web service.
Parameters:
-
(ctxContext) –The SeedboxSync Click context.
Source code in seedboxsync/cli/commands/cmd_health.py
cmd_search
All commands related to search operations in SeedboxSync.
Functions:
-
cli–Empty function for Click sub commands.
-
downloaded–Search for the most recent files downloaded from the seedbox.
-
progress–Search for files currently in download from the seedbox.
-
uploaded–Search for the most recent torrents uploaded from blackhole.
cli
cli(ctx: Context) -> None
downloaded
Search for the most recent files downloaded from the seedbox.
Filters downloads by an optional search term and limits the number of results displayed.
Renders a list of download IDs, paths, finished timestamps, and sizes.
Parameters:
-
(ctxContext) –The Click context object.
-
(numberint) –The maximum number of torrents to display.
-
(searchstr) –An optional search term to filter torrent names.
Source code in seedboxsync/cli/commands/cmd_search.py
progress
Search for files currently in download from the seedbox.
Filters in-progress downloads by an optional search term and limits the number of results displayed.
Calculates local download progress and ETA, and renders a list including ID, path, start time, progress percentage, ETA, and size.
Parameters:
-
(ctxContext) –The Click context object.
-
(numberint) –The maximum number of torrents to display.
-
(searchstr) –An optional search term to filter torrent names.
Source code in seedboxsync/cli/commands/cmd_search.py
uploaded
Search for the most recent torrents uploaded from blackhole.
Filters torrents by an optional search term and limits the number of results displayed.
Renders a list of torrent IDs, names, and sent timestamps.
Parameters:
-
(ctxContext) –The Click context object.
-
(numberint) –The maximum number of torrents to display.
-
(searchstr) –An optional search term to filter torrent names.
Source code in seedboxsync/cli/commands/cmd_search.py
cmd_stats
All commands related to statistics operations in SeedboxSync.
Functions:
-
by_month–Show statistics aggregated by month.
-
by_year–Show statistics aggregated by year.
-
cli–Display statistics about completed downloads.
-
total–Show total statistics for all completed downloads.
by_month
Show statistics aggregated by month.
Parameters:
-
(ctxContext) –The Click context object.
Source code in seedboxsync/cli/commands/cmd_stats.py
by_year
Show statistics aggregated by year.
Parameters:
-
(ctxContext) –The Click context object.
Source code in seedboxsync/cli/commands/cmd_stats.py
cli
Display statistics about completed downloads.
Parameters:
-
(ctxContext) –The Click context object.
Source code in seedboxsync/cli/commands/cmd_stats.py
total
Show total statistics for all completed downloads.
Displays the total number of files and the total size.
Parameters:
-
(ctxContext) –The Click context object.
Source code in seedboxsync/cli/commands/cmd_stats.py
cmd_sync
All commands related to synchronization operations in SeedboxSync.
Functions:
-
blackhole–Perform the blackhole synchronization.
-
cli–Empty function for Click sub commands.
-
seedbox–Perform synchronization from the seedbox.
blackhole
Perform the blackhole synchronization.
Parameters:
-
(ctxContext) –The Click context object.
-
(dry_runbool) –Whether to perform a dry run.
-
(pingbool) –Whether to ping a service during execution.
Source code in seedboxsync/cli/commands/cmd_sync.py
cli
seedbox
seedbox(ctx: Context, dry_run: bool, ping: bool, only_store: bool) -> None
Perform synchronization from the seedbox.
Parameters:
-
(ctxContext) –The Click context object.
-
(dry_runbool) –Whether to list files without downloading or persisting them.
-
(pingbool) –Whether to ping the configured monitoring service.
-
(only_storebool) –Whether to record remote files without downloading them.
Source code in seedboxsync/cli/commands/cmd_sync.py
cmd_task
All commands related to the task queue manager operations.
Functions:
-
cli–Empty function for Click sub commands.
-
tasks_flush–Remove all data from the queue.
-
tasks_flush_lock–Flush any locks that may be held.
-
tasks_list–List registered tasks.
-
tasks_pending–List pending tasks.
-
tasks_result–List all_results() tasks.
-
tasks_sync_blackhole–Launch asynchrone task sync blackhole.
-
tasks_sync_seedbox–Launch asynchrone task sync seedbox.
cli
tasks_flush
tasks_flush(ctx: Context) -> None
Remove all data from the queue.
Source code in seedboxsync/cli/commands/cmd_task.py
tasks_flush_lock
tasks_flush_lock(ctx: Context) -> None
Flush any locks that may be held.
Source code in seedboxsync/cli/commands/cmd_task.py
tasks_list
tasks_list(ctx: Context) -> None
List registered tasks.
Source code in seedboxsync/cli/commands/cmd_task.py
tasks_pending
tasks_pending(ctx: Context) -> None
List pending tasks.
Source code in seedboxsync/cli/commands/cmd_task.py
tasks_result
tasks_result(ctx: Context) -> None
List all_results() tasks.
Source code in seedboxsync/cli/commands/cmd_task.py
tasks_sync_blackhole
tasks_sync_blackhole(ctx: Context) -> None
Launch asynchrone task sync blackhole.
Source code in seedboxsync/cli/commands/cmd_task.py
tasks_sync_seedbox
tasks_sync_seedbox(ctx: Context) -> None
Launch asynchrone task sync seedbox.
Source code in seedboxsync/cli/commands/cmd_task.py
context
Build a context used by Click.
Classes:
-
Context–SeedboxSync Click context.
Context
flowchart TD
seedboxsync.cli.context.Context[Context]
click seedboxsync.cli.context.Context href "" "seedboxsync.cli.context.Context"
SeedboxSync Click context.
Methods:
-
render–Render tabular data using the specified output format.
Attributes:
app
cached
property
app: Flask
render
render(
data: Iterable[Any],
headers: str | dict[str, str] | Sequence[str],
tablefmt: str = "github",
) -> Any
Render tabular data using the specified output format.
Parameters:
-
(dataIterable[Any]) –Tabular data to render.
-
(headersstr | dict[str, str] | Sequence[str]) –Column headers passed to
tabulate. -
(tablefmtstr, default:'github') –Output table format.
Returns:
-
str(Any) –The formatted table.
Source code in seedboxsync/cli/context.py
core
Seedbox Core package.
Modules:
-
config–A module to manage SeedboxSync configuration from Database or environment variables.
-
dao–DAO package with all Peewee models.
-
db–Database module.
-
exception–Custom exception classes for SeedboxSync.
-
flask–Flask core initer mobule.
-
logger–Setup logger for Flask.
-
ping–Ping package with all ping features.
-
sync–SeedboxSync sync package.
-
taskmanager–SeedboxSync taskmanager using Huey package.
-
utils–A collection of utility functions for SeedboxSync.
Classes:
-
Config–Config.
-
Database–Database connector using peewee.
-
Flask–Flask application with SeedboxSync-specific configuration helpers.
Config
Config(app: Flask, test_config: dict[str, str] | None = None)
Config.
Parameters:
-
(appFlask) –The Flask application to configure.
-
(test_configdict[str, str] | None, default:None) –Configuration for testing.
Methods:
-
reload_config–Reload application configuration from the database.
Source code in seedboxsync/core/config.py
reload_config
staticmethod
Database
Database(app: Flask)
Database connector using peewee.
Attributes:
-
app(Flask) –The Flask application that owns the database connection.
Parameters:
-
(appFlask) –The Flask application to bind to the database.
Methods:
-
migrate_to_2–Migration: rebuild SeedboxSync table and add Lock table.
-
migrate_to_3–Migration: allow null values for the 'announce' field in the torrent table.
-
migrate_to_4–Replace 'Lock' table by 'TaskStatus'.
Source code in seedboxsync/core/db.py
migrate_to_2
Migration: rebuild SeedboxSync table and add Lock table.
Fixes compatibility issues between tables created with Peewee v2 and v3.
Source code in seedboxsync/core/db.py
migrate_to_3
Migration: allow null values for the 'announce' field in the torrent table.
Source code in seedboxsync/core/db.py
migrate_to_4
Replace 'Lock' table by 'TaskStatus'.
Source code in seedboxsync/core/db.py
Flask
flowchart TD
seedboxsync.core.Flask[Flask]
click seedboxsync.core.Flask href "" "seedboxsync.core.Flask"
Flask application with SeedboxSync-specific configuration helpers.
Attributes:
-
ping(AbstractPingClient) –Return the configured ping client instance.
-
seedboxsync_config(dict[str, Any]) –Return the SeedboxSync configuration namespace.
-
sync(AbstractSyncClient) –Return the configured sync client instance.
-
task_manager(Manager) –Return the task instance Manager.
ping
cached
property
ping: AbstractPingClient
Return the configured ping client instance.
Returns:
-
AbstractPingClient(AbstractPingClient) –Configured ping client instance.
seedboxsync_config
property
Return the SeedboxSync configuration namespace.
Returns:
-
dict[str, Any]–The SeedboxSync configuration with the namespace prefix removed
-
dict[str, Any]–and keys converted to lowercase.
sync
cached
property
sync: AbstractSyncClient
Return the configured sync client instance.
Returns:
-
AbstractSyncClient(AbstractSyncClient) –Client instance.
config
A module to manage SeedboxSync configuration from Database or environment variables.
Classes:
-
Config–Config.
Config
Config(app: Flask, test_config: dict[str, str] | None = None)
Config.
Parameters:
-
(appFlask) –The Flask application to configure.
-
(test_configdict[str, str] | None, default:None) –Configuration for testing.
Methods:
-
reload_config–Reload application configuration from the database.
Source code in seedboxsync/core/config.py
reload_config
staticmethod
dao
DAO package with all Peewee models.
Modules:
-
download–Peewee DAO model for Download.
-
model–Peewee model.
-
seedboxsync–Peewee DAO model for SeedboxSync.
-
taskstatus–Peewee DAO model for TaskStatus.
-
torrent–Peewee DAO model for Torrent.
Classes:
-
Download–Data Access Object (DAO) representing a file download.
-
SeedboxSync–Data Access Object (DAO) for application metadata and internal configuration.
-
SeedboxSyncModel–Basemodel from which all other peewee models are derived.
-
TaskStatus–Represents a taskstatus record in the system to prevent concurrent processes.
-
Torrent–Data Access Object (DAO) representing a torrent.
Download
flowchart TD
seedboxsync.core.dao.Download[Download]
seedboxsync.core.dao.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.dao.model.SeedboxSyncModel --> seedboxsync.core.dao.Download
click seedboxsync.core.dao.Download href "" "seedboxsync.core.dao.Download"
click seedboxsync.core.dao.model.SeedboxSyncModel href "" "seedboxsync.core.dao.model.SeedboxSyncModel"
Data Access Object (DAO) representing a file download.
This model stores information about a downloaded file, including its path, size on the seedbox and locally, as well as timestamps indicating when the download started and finished.
Methods:
-
is_already_download–Check if a file has already been downloaded.
is_already_download
staticmethod
is_already_download(filepath: str) -> bool
Check if a file has already been downloaded.
Parameters:
-
(filepathstr) –Absolute or relative path to the file.
Returns:
-
bool(bool) –True if the file was already downloaded (i.e. has a nonzero
-
bool–finishedtimestamp), otherwise False.
Source code in seedboxsync/core/dao/download.py
SeedboxSync
flowchart TD
seedboxsync.core.dao.SeedboxSync[SeedboxSync]
seedboxsync.core.dao.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.dao.model.SeedboxSyncModel --> seedboxsync.core.dao.SeedboxSync
click seedboxsync.core.dao.SeedboxSync href "" "seedboxsync.core.dao.SeedboxSync"
click seedboxsync.core.dao.model.SeedboxSyncModel href "" "seedboxsync.core.dao.model.SeedboxSyncModel"
Data Access Object (DAO) for application metadata and internal configuration.
This table stores key-value pairs used for SeedboxSync's internal state management and configuration, such as taskstatus, versioning, or runtime parameters.
Attributes:
-
key(str) –Unique identifier for the configuration entry.
-
value(str) –Stored value associated with the key.
Methods:
-
get_db_version–Return database model version.
-
set_db_version–Upsert database model version.
get_db_version
staticmethod
Return database model version.
Returns:
-
str(str) –The database model version.
Source code in seedboxsync/core/dao/seedboxsync.py
set_db_version
staticmethod
set_db_version(db_version: str) -> None
Upsert database model version.
Parameters:
-
(db_versionstr) –The database model version.
Source code in seedboxsync/core/dao/seedboxsync.py
SeedboxSyncModel
flowchart TD
seedboxsync.core.dao.SeedboxSyncModel[SeedboxSyncModel]
click seedboxsync.core.dao.SeedboxSyncModel href "" "seedboxsync.core.dao.SeedboxSyncModel"
Basemodel from which all other peewee models are derived.
TaskStatus
flowchart TD
seedboxsync.core.dao.TaskStatus[TaskStatus]
seedboxsync.core.dao.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.dao.model.SeedboxSyncModel --> seedboxsync.core.dao.TaskStatus
click seedboxsync.core.dao.TaskStatus href "" "seedboxsync.core.dao.TaskStatus"
click seedboxsync.core.dao.model.SeedboxSyncModel href "" "seedboxsync.core.dao.model.SeedboxSyncModel"
Represents a taskstatus record in the system to prevent concurrent processes.
Attributes:
-
key(str) –Unique identifier for the task, e.g., 'sync_blackhole'.
-
running(bool) –Indicates whether the task is currently running.
-
started(datetime) –Timestamp when the task execution started.
-
finished(datetime) –Timestamp when the task execution finished.
Torrent
flowchart TD
seedboxsync.core.dao.Torrent[Torrent]
seedboxsync.core.dao.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.dao.model.SeedboxSyncModel --> seedboxsync.core.dao.Torrent
click seedboxsync.core.dao.Torrent href "" "seedboxsync.core.dao.Torrent"
click seedboxsync.core.dao.model.SeedboxSyncModel href "" "seedboxsync.core.dao.model.SeedboxSyncModel"
Data Access Object (DAO) representing a torrent.
This model stores basic metadata for a torrent, including its name, announce URL, and the timestamp when it was sent or added to the system.
Attributes:
-
id(int) –Auto-incremented primary key.
-
name(str) –Name of the torrent.
-
announce(str) –Tracker announce URL.
-
sent(datetime) –Timestamp indicating when the torrent was sent or created.
download
Peewee DAO model for Download.
Classes:
-
Download–Data Access Object (DAO) representing a file download.
Download
flowchart TD
seedboxsync.core.dao.download.Download[Download]
seedboxsync.core.dao.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.dao.model.SeedboxSyncModel --> seedboxsync.core.dao.download.Download
click seedboxsync.core.dao.download.Download href "" "seedboxsync.core.dao.download.Download"
click seedboxsync.core.dao.model.SeedboxSyncModel href "" "seedboxsync.core.dao.model.SeedboxSyncModel"
Data Access Object (DAO) representing a file download.
This model stores information about a downloaded file, including its path, size on the seedbox and locally, as well as timestamps indicating when the download started and finished.
Methods:
-
is_already_download–Check if a file has already been downloaded.
is_already_download
staticmethod
is_already_download(filepath: str) -> bool
Check if a file has already been downloaded.
Parameters:
-
(filepathstr) –Absolute or relative path to the file.
Returns:
-
bool(bool) –True if the file was already downloaded (i.e. has a nonzero
-
bool–finishedtimestamp), otherwise False.
Source code in seedboxsync/core/dao/download.py
model
Peewee model.
Classes:
-
SeedboxSyncModel–Basemodel from which all other peewee models are derived.
SeedboxSyncModel
flowchart TD
seedboxsync.core.dao.model.SeedboxSyncModel[SeedboxSyncModel]
click seedboxsync.core.dao.model.SeedboxSyncModel href "" "seedboxsync.core.dao.model.SeedboxSyncModel"
Basemodel from which all other peewee models are derived.
seedboxsync
Peewee DAO model for SeedboxSync.
Classes:
-
SeedboxSync–Data Access Object (DAO) for application metadata and internal configuration.
SeedboxSync
flowchart TD
seedboxsync.core.dao.seedboxsync.SeedboxSync[SeedboxSync]
seedboxsync.core.dao.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.dao.model.SeedboxSyncModel --> seedboxsync.core.dao.seedboxsync.SeedboxSync
click seedboxsync.core.dao.seedboxsync.SeedboxSync href "" "seedboxsync.core.dao.seedboxsync.SeedboxSync"
click seedboxsync.core.dao.model.SeedboxSyncModel href "" "seedboxsync.core.dao.model.SeedboxSyncModel"
Data Access Object (DAO) for application metadata and internal configuration.
This table stores key-value pairs used for SeedboxSync's internal state management and configuration, such as taskstatus, versioning, or runtime parameters.
Attributes:
-
key(str) –Unique identifier for the configuration entry.
-
value(str) –Stored value associated with the key.
Methods:
-
get_db_version–Return database model version.
-
set_db_version–Upsert database model version.
get_db_version
staticmethod
Return database model version.
Returns:
-
str(str) –The database model version.
Source code in seedboxsync/core/dao/seedboxsync.py
set_db_version
staticmethod
set_db_version(db_version: str) -> None
Upsert database model version.
Parameters:
-
(db_versionstr) –The database model version.
Source code in seedboxsync/core/dao/seedboxsync.py
taskstatus
Peewee DAO model for TaskStatus.
Classes:
-
TaskStatus–Represents a taskstatus record in the system to prevent concurrent processes.
TaskStatus
flowchart TD
seedboxsync.core.dao.taskstatus.TaskStatus[TaskStatus]
seedboxsync.core.dao.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.dao.model.SeedboxSyncModel --> seedboxsync.core.dao.taskstatus.TaskStatus
click seedboxsync.core.dao.taskstatus.TaskStatus href "" "seedboxsync.core.dao.taskstatus.TaskStatus"
click seedboxsync.core.dao.model.SeedboxSyncModel href "" "seedboxsync.core.dao.model.SeedboxSyncModel"
Represents a taskstatus record in the system to prevent concurrent processes.
Attributes:
-
key(str) –Unique identifier for the task, e.g., 'sync_blackhole'.
-
running(bool) –Indicates whether the task is currently running.
-
started(datetime) –Timestamp when the task execution started.
-
finished(datetime) –Timestamp when the task execution finished.
torrent
Peewee DAO model for Torrent.
Classes:
-
Torrent–Data Access Object (DAO) representing a torrent.
Torrent
flowchart TD
seedboxsync.core.dao.torrent.Torrent[Torrent]
seedboxsync.core.dao.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.dao.model.SeedboxSyncModel --> seedboxsync.core.dao.torrent.Torrent
click seedboxsync.core.dao.torrent.Torrent href "" "seedboxsync.core.dao.torrent.Torrent"
click seedboxsync.core.dao.model.SeedboxSyncModel href "" "seedboxsync.core.dao.model.SeedboxSyncModel"
Data Access Object (DAO) representing a torrent.
This model stores basic metadata for a torrent, including its name, announce URL, and the timestamp when it was sent or added to the system.
Attributes:
-
id(int) –Auto-incremented primary key.
-
name(str) –Name of the torrent.
-
announce(str) –Tracker announce URL.
-
sent(datetime) –Timestamp indicating when the torrent was sent or created.
db
Database module.
Classes:
-
Database–Database connector using peewee.
Database
Database(app: Flask)
Database connector using peewee.
Attributes:
-
app(Flask) –The Flask application that owns the database connection.
Parameters:
-
(appFlask) –The Flask application to bind to the database.
Methods:
-
migrate_to_2–Migration: rebuild SeedboxSync table and add Lock table.
-
migrate_to_3–Migration: allow null values for the 'announce' field in the torrent table.
-
migrate_to_4–Replace 'Lock' table by 'TaskStatus'.
Source code in seedboxsync/core/db.py
migrate_to_2
Migration: rebuild SeedboxSync table and add Lock table.
Fixes compatibility issues between tables created with Peewee v2 and v3.
Source code in seedboxsync/core/db.py
migrate_to_3
Migration: allow null values for the 'announce' field in the torrent table.
Source code in seedboxsync/core/db.py
migrate_to_4
Replace 'Lock' table by 'TaskStatus'.
Source code in seedboxsync/core/db.py
exception
Custom exception classes for SeedboxSync.
This module defines the base error hierarchy used throughout the SeedboxSync
application. All exceptions inherit from SeedboxSyncError, which handles
logging and process termination in case of fatal errors.
Classes:
-
PingServiceError–Exception raised when an unsupported or misconfigured ping service
-
SeedboxSyncConfigurationError–Exception raised for configuration-related errors.
-
SeedboxSyncError–Base exception class for all SeedboxSync errors.
-
SeedboxsyncConnectionError–Exception raised when the connection to the remote seedbox fails.
-
SyncProtocoleError–Exception raised when an unsupported or misconfigured synchronization protocol
PingServiceError
flowchart TD
seedboxsync.core.exception.PingServiceError[PingServiceError]
seedboxsync.core.exception.SeedboxSyncError[SeedboxSyncError]
seedboxsync.core.exception.SeedboxSyncError --> seedboxsync.core.exception.PingServiceError
click seedboxsync.core.exception.PingServiceError href "" "seedboxsync.core.exception.PingServiceError"
click seedboxsync.core.exception.SeedboxSyncError href "" "seedboxsync.core.exception.SeedboxSyncError"
Exception raised when an unsupported or misconfigured ping service is specified.
Source code in seedboxsync/core/exception.py
SeedboxSyncConfigurationError
flowchart TD
seedboxsync.core.exception.SeedboxSyncConfigurationError[SeedboxSyncConfigurationError]
seedboxsync.core.exception.SeedboxSyncError[SeedboxSyncError]
seedboxsync.core.exception.SeedboxSyncError --> seedboxsync.core.exception.SeedboxSyncConfigurationError
click seedboxsync.core.exception.SeedboxSyncConfigurationError href "" "seedboxsync.core.exception.SeedboxSyncConfigurationError"
click seedboxsync.core.exception.SeedboxSyncError href "" "seedboxsync.core.exception.SeedboxSyncError"
Exception raised for configuration-related errors.
This error typically occurs when the configuration file contains invalid, missing, or inconsistent settings.
Source code in seedboxsync/core/exception.py
SeedboxSyncError
SeedboxSyncError(msg: str)
flowchart TD
seedboxsync.core.exception.SeedboxSyncError[SeedboxSyncError]
click seedboxsync.core.exception.SeedboxSyncError href "" "seedboxsync.core.exception.SeedboxSyncError"
Base exception class for all SeedboxSync errors.
When raised, this exception logs the error message and terminates the program immediately. It is intended for unrecoverable errors that prevent normal operation.
Parameters:
-
(msgstr) –The error message to log and display before exiting.
Source code in seedboxsync/core/exception.py
SeedboxsyncConnectionError
flowchart TD
seedboxsync.core.exception.SeedboxsyncConnectionError[SeedboxsyncConnectionError]
seedboxsync.core.exception.SeedboxSyncError[SeedboxSyncError]
seedboxsync.core.exception.SeedboxSyncError --> seedboxsync.core.exception.SeedboxsyncConnectionError
click seedboxsync.core.exception.SeedboxsyncConnectionError href "" "seedboxsync.core.exception.SeedboxsyncConnectionError"
click seedboxsync.core.exception.SeedboxSyncError href "" "seedboxsync.core.exception.SeedboxSyncError"
Exception raised when the connection to the remote seedbox fails.
Source code in seedboxsync/core/exception.py
SyncProtocoleError
flowchart TD
seedboxsync.core.exception.SyncProtocoleError[SyncProtocoleError]
seedboxsync.core.exception.SeedboxSyncError[SeedboxSyncError]
seedboxsync.core.exception.SeedboxSyncError --> seedboxsync.core.exception.SyncProtocoleError
click seedboxsync.core.exception.SyncProtocoleError href "" "seedboxsync.core.exception.SyncProtocoleError"
click seedboxsync.core.exception.SeedboxSyncError href "" "seedboxsync.core.exception.SeedboxSyncError"
Exception raised when an unsupported or misconfigured synchronization protocol is specified.
Source code in seedboxsync/core/exception.py
flask
Flask core initer mobule.
Classes:
-
SeedboxSyncFlask–Flask application with SeedboxSync-specific configuration helpers.
SeedboxSyncFlask
flowchart TD
seedboxsync.core.flask.SeedboxSyncFlask[SeedboxSyncFlask]
click seedboxsync.core.flask.SeedboxSyncFlask href "" "seedboxsync.core.flask.SeedboxSyncFlask"
Flask application with SeedboxSync-specific configuration helpers.
Attributes:
-
ping(AbstractPingClient) –Return the configured ping client instance.
-
seedboxsync_config(dict[str, Any]) –Return the SeedboxSync configuration namespace.
-
sync(AbstractSyncClient) –Return the configured sync client instance.
-
task_manager(Manager) –Return the task instance Manager.
ping
cached
property
ping: AbstractPingClient
Return the configured ping client instance.
Returns:
-
AbstractPingClient(AbstractPingClient) –Configured ping client instance.
seedboxsync_config
property
Return the SeedboxSync configuration namespace.
Returns:
-
dict[str, Any]–The SeedboxSync configuration with the namespace prefix removed
-
dict[str, Any]–and keys converted to lowercase.
sync
cached
property
sync: AbstractSyncClient
Return the configured sync client instance.
Returns:
-
AbstractSyncClient(AbstractSyncClient) –Client instance.
logger
Setup logger for Flask.
Classes:
-
ColorFormatter–Format log records with colors based on their level.
Functions:
-
configure_logger–Configure the logger by applying the custom formatter to all existing handlers.
ColorFormatter
flowchart TD
seedboxsync.core.logger.ColorFormatter[ColorFormatter]
click seedboxsync.core.logger.ColorFormatter href "" "seedboxsync.core.logger.ColorFormatter"
Format log records with colors based on their level.
Methods:
-
format–Format a log record and apply a color based on its log level.
format
format(record: LogRecord) -> str
Format a log record and apply a color based on its log level.
Parameters:
-
(recordLogRecord) –The log record to format.
Returns:
-
str(str) –The formatted and colorized log message.
Source code in seedboxsync/core/logger.py
configure_logger
configure_logger(logger: Logger) -> None
Configure the logger by applying the custom formatter to all existing handlers.
Parameters:
-
(loggerLogger) –The logger to configure.
Source code in seedboxsync/core/logger.py
ping
Ping package with all ping features.
Modules:
-
abstract_ping_client–Abstract transport client using paramiko-like interface.
-
client–Package with all ping clients.
Classes:
-
AbstractPingClient–Abstract base class for transport clients.
AbstractPingClient
Abstract base class for transport clients.
All concrete clients must implement methods to manage file transfers and remote file operations.
Methods:
-
start–Send a start ping for a given subcommand.
-
success–Send a success ping for a given subcommand.
Source code in seedboxsync/core/ping/abstract_ping_client.py
start
abstractmethod
start(sub_command: str) -> None
Send a start ping for a given subcommand.
Parameters:
-
(sub_commandstr) –The SeedboxSync subcommand to ping.
success
abstractmethod
success(sub_command: str) -> None
Send a success ping for a given subcommand.
Parameters:
-
(sub_commandstr) –The SeedboxSync subcommand to ping.
abstract_ping_client
Abstract transport client using paramiko-like interface.
This class defines the interface that all transport clients must implement, providing methods for file operations and session management on a remote server.
Classes:
-
AbstractPingClient–Abstract base class for transport clients.
AbstractPingClient
Abstract base class for transport clients.
All concrete clients must implement methods to manage file transfers and remote file operations.
Methods:
-
start–Send a start ping for a given subcommand.
-
success–Send a success ping for a given subcommand.
Source code in seedboxsync/core/ping/abstract_ping_client.py
start
abstractmethod
start(sub_command: str) -> None
Send a start ping for a given subcommand.
Parameters:
-
(sub_commandstr) –The SeedboxSync subcommand to ping.
success
abstractmethod
success(sub_command: str) -> None
Send a success ping for a given subcommand.
Parameters:
-
(sub_commandstr) –The SeedboxSync subcommand to ping.
client
Package with all ping clients.
Modules:
-
healthchecks–Healthchecks management for SeedboxSync.
healthchecks
Healthchecks management for SeedboxSync.
Classes:
-
Healthchecks–Class to manage Healthchecks's pings.
Healthchecks
flowchart TD
seedboxsync.core.ping.client.healthchecks.Healthchecks[Healthchecks]
seedboxsync.core.ping.abstract_ping_client.AbstractPingClient[AbstractPingClient]
seedboxsync.core.ping.abstract_ping_client.AbstractPingClient --> seedboxsync.core.ping.client.healthchecks.Healthchecks
click seedboxsync.core.ping.client.healthchecks.Healthchecks href "" "seedboxsync.core.ping.client.healthchecks.Healthchecks"
click seedboxsync.core.ping.abstract_ping_client.AbstractPingClient href "" "seedboxsync.core.ping.abstract_ping_client.AbstractPingClient"
Class to manage Healthchecks's pings.
Methods:
-
start–Send a start ping to Healthchecks for a given subcommand.
-
success–Send a success ping to Healthchecks for a given subcommand.
Source code in seedboxsync/core/ping/client/healthchecks.py
start
start(sub_command: str) -> None
Send a start ping to Healthchecks for a given subcommand.
Parameters:
-
(sub_commandstr) –The SeedboxSync subcommand to ping.
Source code in seedboxsync/core/ping/client/healthchecks.py
success
success(sub_command: str) -> None
Send a success ping to Healthchecks for a given subcommand.
Parameters:
-
(sub_commandstr) –The SeedboxSync subcommand to ping.
Source code in seedboxsync/core/ping/client/healthchecks.py
sync
SeedboxSync sync package.
Modules:
-
abstract_sync_client–Abstract transport client using paramiko-like interface.
-
client–Package with all sync clients.
-
download_progress–Callback for tracking and persisting download progress.
-
services–Package with all sync servces.
Classes:
-
AbstractSyncClient–Abstract base class for transport clients.
AbstractSyncClient
Abstract base class for transport clients.
All concrete clients must implement methods to manage file transfers and remote file operations.
Methods:
-
chdir–Change the current working directory on the remote session.
-
chmod–Change permissions of a remote file.
-
close–Close the transport session and release resources.
-
get–Download a file from the remote server to the local host.
-
put–Upload a local file to the remote server.
-
rename–Rename a file or directory on the remote server.
-
stat–Retrieve metadata about a file on the remote system.
Source code in seedboxsync/core/sync/abstract_sync_client.py
chdir
abstractmethod
chdir(path: PathType) -> None
Change the current working directory on the remote session.
Parameters:
-
(pathPathType) –New working directory path. Defaults to None.
chmod
abstractmethod
Change permissions of a remote file.
Permissions are unix-style, same as Python's os.chmod.
Parameters:
-
(pathPathType) –Path to the file on the remote server.
-
(modeint) –New permissions to set.
Source code in seedboxsync/core/sync/abstract_sync_client.py
close
abstractmethod
get
abstractmethod
get(
remote_path: PathType,
local_path: PathType,
progress_callback: ProgressCallback | None = None,
) -> None
Download a file from the remote server to the local host.
Parameters:
-
(remote_pathPathType) –Path to the remote file to copy.
-
(local_pathPathType) –Destination path on the local host.
-
(progress_callbackProgressCallback | None, default:None) –Optional callback receiving bytes_transferred.
Source code in seedboxsync/core/sync/abstract_sync_client.py
put
abstractmethod
put(local_path: PathType, remote_path: PathType) -> Any
Upload a local file to the remote server.
Parameters:
-
(local_pathPathType) –Path to the local file to copy.
-
(remote_pathPathType) –Destination path on the server including filename. Specifying only a directory must raise an error.
Source code in seedboxsync/core/sync/abstract_sync_client.py
rename
abstractmethod
Rename a file or directory on the remote server.
Parameters:
-
(old_pathstPathTyper) –Existing path of the file or folder.
-
(new_pathPathType) –New path or name for the file or folder.
Source code in seedboxsync/core/sync/abstract_sync_client.py
stat
abstractmethod
stat(filepath: PathType) -> Any
Retrieve metadata about a file on the remote system.
Returns an object similar to Python's os.stat, with fewer fields. Supported fields: st_mode, st_size, st_uid, st_gid, st_atime, st_mtime.
Parameters:
-
(filepathPathType) –Path to the remote file.
Source code in seedboxsync/core/sync/abstract_sync_client.py
abstract_sync_client
Abstract transport client using paramiko-like interface.
This class defines the interface that all transport clients must implement, providing methods for file operations and session management on a remote server.
Classes:
-
AbstractSyncClient–Abstract base class for transport clients.
AbstractSyncClient
Abstract base class for transport clients.
All concrete clients must implement methods to manage file transfers and remote file operations.
Methods:
-
chdir–Change the current working directory on the remote session.
-
chmod–Change permissions of a remote file.
-
close–Close the transport session and release resources.
-
get–Download a file from the remote server to the local host.
-
put–Upload a local file to the remote server.
-
rename–Rename a file or directory on the remote server.
-
stat–Retrieve metadata about a file on the remote system.
Source code in seedboxsync/core/sync/abstract_sync_client.py
chdir
abstractmethod
chdir(path: PathType) -> None
Change the current working directory on the remote session.
Parameters:
-
(pathPathType) –New working directory path. Defaults to None.
chmod
abstractmethod
Change permissions of a remote file.
Permissions are unix-style, same as Python's os.chmod.
Parameters:
-
(pathPathType) –Path to the file on the remote server.
-
(modeint) –New permissions to set.
Source code in seedboxsync/core/sync/abstract_sync_client.py
close
abstractmethod
get
abstractmethod
get(
remote_path: PathType,
local_path: PathType,
progress_callback: ProgressCallback | None = None,
) -> None
Download a file from the remote server to the local host.
Parameters:
-
(remote_pathPathType) –Path to the remote file to copy.
-
(local_pathPathType) –Destination path on the local host.
-
(progress_callbackProgressCallback | None, default:None) –Optional callback receiving bytes_transferred.
Source code in seedboxsync/core/sync/abstract_sync_client.py
put
abstractmethod
put(local_path: PathType, remote_path: PathType) -> Any
Upload a local file to the remote server.
Parameters:
-
(local_pathPathType) –Path to the local file to copy.
-
(remote_pathPathType) –Destination path on the server including filename. Specifying only a directory must raise an error.
Source code in seedboxsync/core/sync/abstract_sync_client.py
rename
abstractmethod
Rename a file or directory on the remote server.
Parameters:
-
(old_pathstPathTyper) –Existing path of the file or folder.
-
(new_pathPathType) –New path or name for the file or folder.
Source code in seedboxsync/core/sync/abstract_sync_client.py
stat
abstractmethod
stat(filepath: PathType) -> Any
Retrieve metadata about a file on the remote system.
Returns an object similar to Python's os.stat, with fewer fields. Supported fields: st_mode, st_size, st_uid, st_gid, st_atime, st_mtime.
Parameters:
-
(filepathPathType) –Path to the remote file.
Source code in seedboxsync/core/sync/abstract_sync_client.py
client
Package with all sync clients.
Modules:
ftp
Transport client using FTP protocol.
Classes:
-
FtpClient–FTP transport client using ftputil.
-
FtpSession–FTP session factory for ftputil with explicit port and timeout support.
FtpClient
flowchart TD
seedboxsync.core.sync.client.ftp.FtpClient[FtpClient]
seedboxsync.core.sync.abstract_sync_client.AbstractSyncClient[AbstractSyncClient]
seedboxsync.core.sync.abstract_sync_client.AbstractSyncClient --> seedboxsync.core.sync.client.ftp.FtpClient
click seedboxsync.core.sync.client.ftp.FtpClient href "" "seedboxsync.core.sync.client.ftp.FtpClient"
click seedboxsync.core.sync.abstract_sync_client.AbstractSyncClient href "" "seedboxsync.core.sync.abstract_sync_client.AbstractSyncClient"
FTP transport client using ftputil.
Handles file transfers between NAS and Seedbox servers. Provides basic operations such as get, put, rename, chmod, and directory traversal.
Methods:
-
chdir–Change the current working directory of the FTP session.
-
chmod–Change the mode (permissions) of a remote file.
-
close–Close the FTP client and underlying connection.
-
get–Download a remote file from the FTP server.
-
put–Upload a local file to the FTP server.
-
rename–Rename a file or directory on the remote server.
-
stat–Retrieve metadata for a remote file.
-
walk–Walk through remote directories, yielding paths, folders, and files.
Source code in seedboxsync/core/sync/client/ftp.py
chdir
chdir(path: PathType | None = None) -> None
Change the current working directory of the FTP session.
Parameters:
-
(pathOptional[PathType], default:None) –Target directory. If None, no change occurs.
Source code in seedboxsync/core/sync/client/ftp.py
chmod
Change the mode (permissions) of a remote file.
Parameters:
-
(pathPathType) –Path of the file.
-
(modeint) –Unix-style permissions (like os.chmod).
Source code in seedboxsync/core/sync/client/ftp.py
close
Close the FTP client and underlying connection.
get
get(
remote_path: PathType,
local_path: PathType,
progress_callback: ProgressCallback | None = None,
) -> None
Download a remote file from the FTP server.
Parameters:
-
(remote_pathPathType) –Path of the remote file.
-
(local_pathPathType) –Destination path on the local host.
-
(progress_callbackProgressCallback | None, default:None) –Optional callback receiving bytes_transferred and total_bytes.
Source code in seedboxsync/core/sync/client/ftp.py
put
put(local_path: PathType, remote_path: PathType) -> None
Upload a local file to the FTP server.
Parameters:
-
(local_pathPathType) –Path to the local file.
-
(remote_pathPathType) –Destination path on the server (including filename).
Source code in seedboxsync/core/sync/client/ftp.py
rename
Rename a file or directory on the remote server.
Parameters:
-
(old_pathPathType) –Existing path.
-
(new_pathPathType) –New path.
Source code in seedboxsync/core/sync/client/ftp.py
stat
stat(filepath: PathType) -> Any
Retrieve metadata for a remote file.
Parameters:
-
(filepathPathType) –Remote file path.
Returns:
-
Any(Any) –Object with attributes similar to Python's os.stat.
Source code in seedboxsync/core/sync/client/ftp.py
walk
walk(remote_path: PathType) -> Generator[tuple[str, list[str], list[str]]]
Walk through remote directories, yielding paths, folders, and files.
Parameters:
-
(remote_pathPathType) –Remote directory to traverse.
Yields:
-
Generator[tuple[str, list[str], list[str]]]–tuple[str, list[str], list[str]]: (current_path, folders, files)
Source code in seedboxsync/core/sync/client/ftp.py
FtpSession
flowchart TD
seedboxsync.core.sync.client.ftp.FtpSession[FtpSession]
click seedboxsync.core.sync.client.ftp.FtpSession href "" "seedboxsync.core.sync.client.ftp.FtpSession"
FTP session factory for ftputil with explicit port and timeout support.
Parameters:
-
(hoststr) –FTP server hostname.
-
(userstr) –FTP account username.
-
(passwordstr) –FTP account password.
-
(portint, default:21) –FTP server port.
-
(timeoutfloat, default:-999) –Connection timeout passed to
ftplib.
Source code in seedboxsync/core/sync/client/ftp.py
sftp
Transport client using the SFTP protocol.
Classes:
-
SftpClient–SFTP transport client using Paramiko.
SftpClient
flowchart TD
seedboxsync.core.sync.client.sftp.SftpClient[SftpClient]
seedboxsync.core.sync.abstract_sync_client.AbstractSyncClient[AbstractSyncClient]
seedboxsync.core.sync.abstract_sync_client.AbstractSyncClient --> seedboxsync.core.sync.client.sftp.SftpClient
click seedboxsync.core.sync.client.sftp.SftpClient href "" "seedboxsync.core.sync.client.sftp.SftpClient"
click seedboxsync.core.sync.abstract_sync_client.AbstractSyncClient href "" "seedboxsync.core.sync.abstract_sync_client.AbstractSyncClient"
SFTP transport client using Paramiko.
Handles file transfers between NAS and Seedbox servers. Provides basic operations such as get, put, rename, chmod, and directory traversal.
Methods:
-
chdir–Change the current working directory of the SFTP session.
-
chmod–Change the mode (permissions) of a remote file.
-
close–Close the SFTP transport client and underlying connection.
-
get–Download a remote file from the SFTP server.
-
put–Upload a local file to the SFTP server.
-
rename–Rename a file or directory on the remote server.
-
stat–Retrieve metadata for a remote file.
-
walk–Walk through remote directories, yielding paths, folders, and files.
Source code in seedboxsync/core/sync/client/sftp.py
chdir
chdir(path: PathType | None = None) -> None
Change the current working directory of the SFTP session.
Parameters:
-
(pathOptional[PathType], default:None) –Target directory. If None, no change occurs.
Source code in seedboxsync/core/sync/client/sftp.py
chmod
Change the mode (permissions) of a remote file.
Parameters:
-
(pathPathType) –Path of the file.
-
(modeint) –Unix-style permissions (like os.chmod).
Source code in seedboxsync/core/sync/client/sftp.py
close
Close the SFTP transport client and underlying connection.
get
get(
remote_path: PathType,
local_path: PathType,
progress_callback: ProgressCallback | None = None,
) -> None
Download a remote file from the SFTP server.
Parameters:
-
(remote_pathPathType) –Path of the remote file.
-
(local_pathPathType) –Destination path on the local host.
-
(progress_callbackProgressCallback | None, default:None) –Optional callback receiving bytes_transferred.
Source code in seedboxsync/core/sync/client/sftp.py
put
put(local_path: PathType, remote_path: PathType) -> SFTPAttributes
Upload a local file to the SFTP server.
Parameters:
-
(local_pathPathType) –Path to the local file.
-
(remote_pathPathType) –Destination path on the server (including filename).
Returns:
-
SFTPAttributes(SFTPAttributes) –Metadata of the uploaded file.
Source code in seedboxsync/core/sync/client/sftp.py
rename
Rename a file or directory on the remote server.
Parameters:
-
(old_pathPathType) –Existing path.
-
(new_pathPathType) –New path.
Source code in seedboxsync/core/sync/client/sftp.py
stat
stat(filepath: PathType) -> SFTPAttributes
Retrieve metadata for a remote file.
Parameters:
-
(filepathPathType) –Remote file path.
Returns:
-
SFTPAttributes(SFTPAttributes) –Object with attributes similar to Python's os.stat: st_mode, st_size, st_uid, st_gid, st_atime, st_mtime.
Source code in seedboxsync/core/sync/client/sftp.py
walk
walk(remote_path: PathType) -> Generator[tuple[str, list[str], list[str]]]
Walk through remote directories, yielding paths, folders, and files.
Parameters:
-
(remote_pathPathType) –Remote directory to traverse.
Yields:
-
Generator[tuple[str, list[str], list[str]]]–tuple[str, list[str], list[str]]: (current_path, folders, files)
Note
Simplified version of os.walk for SFTP. Efficient for large directories.
Source
https://gist.github.com/johnfink8/2190472
Source code in seedboxsync/core/sync/client/sftp.py
download_progress
Callback for tracking and persisting download progress.
Classes:
-
DownloadProgress–Track download progress and update its database record.
DownloadProgress
Track download progress and update its database record.
Parameters:
-
(downloadDownload) –The download record to update.
Methods:
-
__call__–Update the download progress and persist it when appropriate.
Source code in seedboxsync/core/sync/download_progress.py
__call__
__call__(transferred: int, total: int) -> None
Update the download progress and persist it when appropriate.
Parameters:
-
(transferredint) –Number of bytes transferred so far.
-
(totalint) –Total number of bytes to transfer.
Source code in seedboxsync/core/sync/download_progress.py
services
Package with all sync servces.
Modules:
blackhole
SeedboxSync sync service for blackhole.
Functions:
-
blackhole–Perform the blackhole synchronization.
blackhole
Perform the blackhole synchronization.
Uploads torrent files from the local watch folder to the seedbox. Optional dry-run, file permissions, database persistence, and error handling.
Parameters:
-
(dry_runbool) –Whether to perform a dry run.
-
(pingbool) –Whether to ping a service during execution.
Source code in seedboxsync/core/sync/services/blackhole.py
seedbox
SeedboxSync sync service for seedbox.
Functions:
-
seedbox–Perform synchronization from the seedbox.
seedbox
seedbox(dry_run: bool, ping: bool, only_store: bool) -> None
Perform synchronization from the seedbox.
Downloads files from the remote seedbox to the local machine, supports optional dry-run and only-store modes, applies exclusion patterns, and persists download information in the database.
Parameters:
-
(dry_runbool) –Whether to list files without downloading or persisting them.
-
(pingbool) –Whether to ping the configured monitoring service.
-
(only_storebool) –Whether to record remote files without downloading them.
Source code in seedboxsync/core/sync/services/seedbox.py
taskmanager
SeedboxSync taskmanager using Huey package.
Modules:
-
manager–Taskmanager Manager module.
-
task–Package with all tasks.
-
track_taskstatus–Track task status by decorator.
-
utils–Task queue initialization and automatic task module registration.
Classes:
-
Manager–Manage the Huey task queue integration with Flask.
Functions:
-
heartbeat–Task manager heartbeat.
-
heartbeat_shutdown–Task manager heartbeat.
-
heartbeat_startup–Task manager heartbeat.
Manager
Manager(app: Flask | None = None)
Manage the Huey task queue integration with Flask.
The manager creates a Huey instance from the application configuration, stores it in the Flask extensions registry, and proxies Huey attributes through the manager instance.
Parameters:
-
(appFlask | None, default:None) –Optional Flask application to initialize immediately.
Methods:
-
__getattr__–Proxy unknown attributes to the underlying Huey instance.
-
init_app–Initialize the Huey manager for a Flask application.
-
init_huey–Create and configure the Huey task queue instance.
Source code in seedboxsync/core/taskmanager/manager.py
__getattr__
__getattr__(name: str) -> Any
Proxy unknown attributes to the underlying Huey instance.
Parameters:
-
(namestr) –Name of the requested attribute.
Returns:
-
Any–The attribute exposed by the underlying Huey instance.
Raises:
-
RuntimeError–If the manager has not been initialized.
-
AttributeError–If the Huey instance does not expose the requested attribute.
Source code in seedboxsync/core/taskmanager/manager.py
init_app
init_app(app: Flask) -> None
Initialize the Huey manager for a Flask application.
The created Huey instance is stored in the Flask extensions registry
under the huey key.
Parameters:
-
(appFlask) –Flask application to initialize.
Source code in seedboxsync/core/taskmanager/manager.py
init_huey
Create and configure the Huey task queue instance.
Returns:
-
SqliteHuey–The configured SQLite-backed Huey instance.
Source code in seedboxsync/core/taskmanager/manager.py
heartbeat
Task manager heartbeat.
Update the TaskStatus with key "heartbeat".
Source code in seedboxsync/core/taskmanager/track_taskstatus.py
heartbeat_shutdown
Task manager heartbeat.
Update the TaskStatus with key "heartbeat".
Source code in seedboxsync/core/taskmanager/track_taskstatus.py
heartbeat_startup
Task manager heartbeat.
Update the TaskStatus with key "heartbeat".
Source code in seedboxsync/core/taskmanager/track_taskstatus.py
manager
Taskmanager Manager module.
Classes:
-
Manager–Manage the Huey task queue integration with Flask.
Manager
Manager(app: Flask | None = None)
Manage the Huey task queue integration with Flask.
The manager creates a Huey instance from the application configuration, stores it in the Flask extensions registry, and proxies Huey attributes through the manager instance.
Parameters:
-
(appFlask | None, default:None) –Optional Flask application to initialize immediately.
Methods:
-
__getattr__–Proxy unknown attributes to the underlying Huey instance.
-
init_app–Initialize the Huey manager for a Flask application.
-
init_huey–Create and configure the Huey task queue instance.
Source code in seedboxsync/core/taskmanager/manager.py
__getattr__
__getattr__(name: str) -> Any
Proxy unknown attributes to the underlying Huey instance.
Parameters:
-
(namestr) –Name of the requested attribute.
Returns:
-
Any–The attribute exposed by the underlying Huey instance.
Raises:
-
RuntimeError–If the manager has not been initialized.
-
AttributeError–If the Huey instance does not expose the requested attribute.
Source code in seedboxsync/core/taskmanager/manager.py
init_app
init_app(app: Flask) -> None
Initialize the Huey manager for a Flask application.
The created Huey instance is stored in the Flask extensions registry
under the huey key.
Parameters:
-
(appFlask) –Flask application to initialize.
Source code in seedboxsync/core/taskmanager/manager.py
init_huey
Create and configure the Huey task queue instance.
Returns:
-
SqliteHuey–The configured SQLite-backed Huey instance.
Source code in seedboxsync/core/taskmanager/manager.py
task
Package with all tasks.
Modules:
-
task_periodic_sync_blackhole–Define a huey tasks for blackhole synchronization.
-
task_periodic_sync_seedbox–Define a huey tasks for seedbox synchronization.
-
task_sync_blackhole–Define a huey tasks for blackhole synchronization.
-
task_sync_seedbox–Define a huey tasks for seedbox synchronization.
task_periodic_sync_blackhole
Define a huey tasks for blackhole synchronization.
Functions:
-
periodic_sync_blackhole–Define a huey periodic task.
periodic_sync_blackhole
Define a huey periodic task.
Source code in seedboxsync/core/taskmanager/task/task_periodic_sync_blackhole.py
task_periodic_sync_seedbox
Define a huey tasks for seedbox synchronization.
Functions:
-
periodic_sync_seedbox–Define a huey periodic task.
periodic_sync_seedbox
Define a huey periodic task.
Source code in seedboxsync/core/taskmanager/task/task_periodic_sync_seedbox.py
task_sync_blackhole
Define a huey tasks for blackhole synchronization.
Functions:
-
sync_blackhole–Define a huey task.
sync_blackhole
Define a huey task.
Source code in seedboxsync/core/taskmanager/task/task_sync_blackhole.py
task_sync_seedbox
Define a huey tasks for seedbox synchronization.
Functions:
-
sync_seedbox–Define a huey task.
sync_seedbox
Define a huey task.
Source code in seedboxsync/core/taskmanager/task/task_sync_seedbox.py
track_taskstatus
Track task status by decorator.
Functions:
-
heartbeat–Task manager heartbeat.
-
heartbeat_shutdown–Task manager heartbeat.
-
heartbeat_startup–Task manager heartbeat.
-
track_taskstatus–Track the execution status of a task in the database.
heartbeat
Task manager heartbeat.
Update the TaskStatus with key "heartbeat".
Source code in seedboxsync/core/taskmanager/track_taskstatus.py
heartbeat_shutdown
Task manager heartbeat.
Update the TaskStatus with key "heartbeat".
Source code in seedboxsync/core/taskmanager/track_taskstatus.py
heartbeat_startup
Task manager heartbeat.
Update the TaskStatus with key "heartbeat".
Source code in seedboxsync/core/taskmanager/track_taskstatus.py
track_taskstatus
track_taskstatus(key: str) -> Callable[[Callable[P, R]], Callable[P, R]]
Track the execution status of a task in the database.
Parameters:
-
(keystr) –Unique identifier used to store the task status.
Returns:
-
Callable[[Callable[P, R]], Callable[P, R]]–A decorator that updates the task status before and after execution.
Source code in seedboxsync/core/taskmanager/track_taskstatus.py
utils
Task queue initialization and automatic task module registration.
Functions:
-
load_task_modules–Import all task modules from this package.
load_task_modules
Import all task modules from this package.
Modules are loaded when their name starts with task_. Importing them
registers their decorated Huey tasks in the task queue registry.
Returns:
-
list[ModuleType]–The list of imported task modules.
Source code in seedboxsync/core/taskmanager/utils.py
utils
A collection of utility functions for SeedboxSync.
Functions:
-
byte_to_gi–Convert in human readable units.
-
ensure_dir_exists–Ensure the directory
pathexists, and if not create it. -
get_torrent_infos–Extracts information from a torrent file.
-
get_web_healthcheck_url–Return the URL used to check the local Flask application.
-
is_running_in_docker–Return whether the current process appears to run inside Docker.
byte_to_gi
byte_to_gi(bytes_value: float, suffix: str = 'B') -> str
Convert in human readable units.
Parameters:
-
(bytes_valueinteger) –Value not human readable.
-
(suffixstr, default:'B') –Suffix for value given to (default: B).
Returns:
-
str(str) –human readable value in Gi.
Source code in seedboxsync/core/utils.py
ensure_dir_exists
ensure_dir_exists(path: str | PathLike[str]) -> None
Ensure the directory path exists, and if not create it.
Parameters:
-
(pathstr) –The filesystem path of a directory.
Raises:
-
AssertionError–If the directory
pathexists, but is not a directory.
Source code in seedboxsync/core/utils.py
get_torrent_infos
get_torrent_infos(torrent_path: str | PathLike[str]) -> Any | None
Extracts information from a torrent file.
Parameters:
-
(torrent_pathstr | PathLike[str]) –Path to the torrent file.
Returns:
-
str(Any | None) –Decoded torrent information.
Raises:
-
Exception–If the file is not a valid torrent.
Source code in seedboxsync/core/utils.py
get_web_healthcheck_url
Return the URL used to check the local Flask application.
Returns:
-
str(str) –The healthcheck URL.
Source code in seedboxsync/core/utils.py
is_running_in_docker
Return whether the current process appears to run inside Docker.
Returns:
-
bool(bool) –True if in docker envoronment.
Source code in seedboxsync/core/utils.py
taskmanager
Starter for the SeedboxSync taskmanager.
Functions:
-
on_shutdown–Call function on huey shutdown.
-
on_startup–Call function on huey startup.
-
reload_config–Reload Flask DB config.
-
setup_worker_logging–Configure the Huey logger from Flask.
on_shutdown
on_startup
reload_config
setup_worker_logging
Configure the Huey logger from Flask.