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–SeedboxSync Core package.
-
taskmanager–Starter for the SeedboxSync taskmanager.
Functions:
-
create_app–Create and configure the SeedboxSync Flask application.
create_app
create_app(injected_config: dict[str, str | bool] | None = None) -> Flask
Create and configure the SeedboxSync Flask application.
Parameters:
-
(injected_configdict[str, str] | None, default:None) –Optional configuration overrides used by tests.
Returns:
-
Flask(Flask) –Configured application instance.
Source code in seedboxsync/__init__.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
__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 as a Rich table.
Attributes:
app
cached
property
app: Flask
render
Render tabular data as a Rich table.
Parameters:
-
(dataIterable[Any]) –Tabular data to render.
-
(headersHeaders) –Column headers.
-
(titlestr | None, default:None) –Table title.
Returns:
-
str(str) –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_user–All commands related to the users operations & management.
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
cmd_user
All commands related to the users operations & management.
Functions:
-
add–Create a new user account in the database.
-
cli–Empty function for Click sub commands.
-
delete–Delete a user by their unique database identifier.
-
edit–Update details for an existing user account.
-
list_user–List registered users from the database.
add
Create a new user account in the database.
Accepts account details via command-line options or interactive prompts, hashes the password, and stores the user record.
Parameters:
-
(ctxContext) –The CLI application context.
-
(usernamestr) –Unique username for the account.
-
(emailstr) –Unique email address.
-
(passwordstr) –Plain-text password to hash and store.
Source code in seedboxsync/cli/commands/cmd_user.py
delete
Delete a user by their unique database identifier.
Parameters:
-
(ctxContext) –The CLI application context.
-
(idint) –Database identifier of the user to remove.
-
(yesbool) –Skip confirmation prompt if set to True.
Source code in seedboxsync/cli/commands/cmd_user.py
edit
edit(
ctx: Context,
id: int,
username: str | None,
email: str | None,
password: str | None,
) -> None
Update details for an existing user account.
Fetches the user by ID and updates only the provided fields. Password updates are automatically hashed before saving.
Parameters:
-
(ctxContext) –The CLI application context.
-
(idint) –Database identifier of the user to edit.
-
(usernamestr | None) –New username to set.
-
(emailstr | None) –New email address to set.
-
(passwordstr | None) –New plain-text password to hash and update.
Source code in seedboxsync/cli/commands/cmd_user.py
list_user
List registered users from the database.
Queries user accounts with optional text filtering on usernames and renders a formatted table containing user metadata.
Parameters:
-
(ctxContext) –The CLI application context.
-
(numberint) –Maximum number of users to display. Defaults to 10.
-
(searchstr) –Optional search term to filter users by username.
Source code in seedboxsync/cli/commands/cmd_user.py
context
Build a context used by Click.
Classes:
-
Context–SeedboxSync Click context.
-
HeaderOptions–Rich table column options.
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 as a Rich table.
Attributes:
app
cached
property
app: Flask
render
Render tabular data as a Rich table.
Parameters:
-
(dataIterable[Any]) –Tabular data to render.
-
(headersHeaders) –Column headers.
-
(titlestr | None, default:None) –Table title.
Returns:
-
str(str) –The formatted table..
Source code in seedboxsync/cli/context.py
HeaderOptions
flowchart TD
seedboxsync.cli.context.HeaderOptions[HeaderOptions]
click seedboxsync.cli.context.HeaderOptions href "" "seedboxsync.cli.context.HeaderOptions"
Rich table column options.
core
SeedboxSync Core package.
Modules:
-
config–A module to manage SeedboxSync configuration from Database or environment variables.
-
database–SeedboxSync database package.
-
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 manager for SeedboxSync using Peewee ORM.
-
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 manager for SeedboxSync using Peewee ORM.
Handles database path resolution, connection binding, SQLite optimization pragmas, schema migrations, and custom SQLite functions.
Attributes:
-
DB_PATHS(ClassVar[list[Path]]) –Candidate database paths checked in order of preference.
-
app(Flask) –The Flask application instance bound to this database.
-
db(SqliteDatabase) –The initialized Peewee SQLite database instance.
Parameters:
-
(appFlask) –The Flask application to bind to the database.
Source code in seedboxsync/core/database/database.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
database
SeedboxSync database package.
Modules:
-
database–Database module.
-
migration–Database schema migration management.
-
models–DAO package with all Peewee models.
Classes:
-
Database–Database manager for SeedboxSync using Peewee ORM.
-
DatabaseMigration–Manage database schema migrations.
Database
Database(app: Flask)
Database manager for SeedboxSync using Peewee ORM.
Handles database path resolution, connection binding, SQLite optimization pragmas, schema migrations, and custom SQLite functions.
Attributes:
-
DB_PATHS(ClassVar[list[Path]]) –Candidate database paths checked in order of preference.
-
app(Flask) –The Flask application instance bound to this database.
-
db(SqliteDatabase) –The initialized Peewee SQLite database instance.
Parameters:
-
(appFlask) –The Flask application to bind to the database.
Source code in seedboxsync/core/database/database.py
DatabaseMigration
Manage database schema migrations.
Parameters:
-
(appFlask) –Flask application instance.
-
(dbSqliteDatabase) –Peewee SQLite database instance.
Methods:
-
upgrade–Upgrade the database schema to the latest available migration.
Source code in seedboxsync/core/database/migration.py
upgrade
Upgrade the database schema to the latest available migration.
Existing databases using the legacy integer-based migration system are first converted to the Peewee migration history format.
Source code in seedboxsync/core/database/migration.py
database
Database module.
Classes:
-
Database–Database manager for SeedboxSync using Peewee ORM.
Database
Database(app: Flask)
Database manager for SeedboxSync using Peewee ORM.
Handles database path resolution, connection binding, SQLite optimization pragmas, schema migrations, and custom SQLite functions.
Attributes:
-
DB_PATHS(ClassVar[list[Path]]) –Candidate database paths checked in order of preference.
-
app(Flask) –The Flask application instance bound to this database.
-
db(SqliteDatabase) –The initialized Peewee SQLite database instance.
Parameters:
-
(appFlask) –The Flask application to bind to the database.
Source code in seedboxsync/core/database/database.py
migration
Database schema migration management.
Classes:
-
DatabaseMigration–Manage database schema migrations.
DatabaseMigration
Manage database schema migrations.
Parameters:
-
(appFlask) –Flask application instance.
-
(dbSqliteDatabase) –Peewee SQLite database instance.
Methods:
-
upgrade–Upgrade the database schema to the latest available migration.
Source code in seedboxsync/core/database/migration.py
upgrade
Upgrade the database schema to the latest available migration.
Existing databases using the legacy integer-based migration system are first converted to the Peewee migration history format.
Source code in seedboxsync/core/database/migration.py
models
DAO package with all Peewee models.
Modules:
-
apikey–Peewee DAO model for ApiKey.
-
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.
-
user–Peewee DAO model for User.
Classes:
-
ApiKey–Data Access Object (DAO) representing an API Key.
-
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.
-
User–Data Access Object (DAO) representing a user.
ApiKey
flowchart TD
seedboxsync.core.database.models.ApiKey[ApiKey]
seedboxsync.core.database.models.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.database.models.model.SeedboxSyncModel --> seedboxsync.core.database.models.ApiKey
click seedboxsync.core.database.models.ApiKey href "" "seedboxsync.core.database.models.ApiKey"
click seedboxsync.core.database.models.model.SeedboxSyncModel href "" "seedboxsync.core.database.models.model.SeedboxSyncModel"
Data Access Object (DAO) representing an API Key.
Stores API key metadata and hashed secret values associated with a user account for programmatic access.
Attributes:
-
id(int) –Auto-incremented primary key.
-
user(User) –Foreign key reference to the associated user account.
-
name(str) –Human-readable label describing the purpose of the key.
-
key_hash(str) –SHA-256 hash of the generated raw API key.
-
created(datetime) –Timestamp when the API key was created.
-
last_used(datetime | None) –Timestamp when the API key was last used.
Methods:
-
authenticate–Authenticate an incoming API key string.
-
generate–Generate a new API key for a user.
authenticate
classmethod
Authenticate an incoming API key string.
Hashes the incoming raw key and verifies if a matching active key exists
in the database. Updates last_used on success.
Parameters:
-
(raw_keystr) –Plain-text API key provided in the HTTP header/request.
Returns:
-
User | None–User | None: The matching User instance, or None if authentication fails.
Source code in seedboxsync/core/database/models/apikey.py
generate
classmethod
Generate a new API key for a user.
Computes a cryptographically secure random token, hashes it for storage, and returns both the database model instance and the raw token.
Parameters:
-
(userUser) –User model instance owning the new key.
-
(namestr) –Descriptive label for the key.
Returns:
-
tuple[Self, str]–tuple[Self, str]: A tuple containing (ApiKey instance, raw_api_key_str). The raw key string must be displayed to the user immediately, as it cannot be recovered later.
Source code in seedboxsync/core/database/models/apikey.py
Download
flowchart TD
seedboxsync.core.database.models.Download[Download]
seedboxsync.core.database.models.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.database.models.model.SeedboxSyncModel --> seedboxsync.core.database.models.Download
click seedboxsync.core.database.models.Download href "" "seedboxsync.core.database.models.Download"
click seedboxsync.core.database.models.model.SeedboxSyncModel href "" "seedboxsync.core.database.models.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:
-
get_stats_by_mime_type–Get the total count and total size of downloaded files grouped by MIME type.
-
is_already_download–Check if a file has already been downloaded.
-
set_mime–Detect and update the MIME attributes of the downloaded file.
get_stats_by_mime_type
classmethod
get_stats_by_mime_type(
start_date: date | None = None, end_date: date | None = None
) -> list[dict[str, Any]]
Get the total count and total size of downloaded files grouped by MIME type.
Parameters:
-
(start_datedate | None, default:None) –Optional start date filter.
-
(end_datedate | None, default:None) –Optional end date filter.
Returns:
-
list[dict[str, Any]]–list[dict[str, Any]]: A list of dicts containing mime_type, total count, and total_size.
Source code in seedboxsync/core/database/models/download.py
is_already_download
classmethod
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/database/models/download.py
set_mime
set_mime(save: bool = False) -> None
Detect and update the MIME attributes of the downloaded file.
Calls utils.get_mime_type_from_file to inspect the file path and header bytes,
updating the mime_extension, mime_type, and mime_confidence attributes.
Parameters:
-
(savebool, default:False) –If True, saves the model instance to the database immediately after updating attributes. Defaults to False.
Source code in seedboxsync/core/database/models/download.py
SeedboxSync
flowchart TD
seedboxsync.core.database.models.SeedboxSync[SeedboxSync]
seedboxsync.core.database.models.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.database.models.model.SeedboxSyncModel --> seedboxsync.core.database.models.SeedboxSync
click seedboxsync.core.database.models.SeedboxSync href "" "seedboxsync.core.database.models.SeedboxSync"
click seedboxsync.core.database.models.model.SeedboxSyncModel href "" "seedboxsync.core.database.models.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.
SeedboxSyncModel
flowchart TD
seedboxsync.core.database.models.SeedboxSyncModel[SeedboxSyncModel]
click seedboxsync.core.database.models.SeedboxSyncModel href "" "seedboxsync.core.database.models.SeedboxSyncModel"
Basemodel from which all other peewee models are derived.
TaskStatus
flowchart TD
seedboxsync.core.database.models.TaskStatus[TaskStatus]
seedboxsync.core.database.models.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.database.models.model.SeedboxSyncModel --> seedboxsync.core.database.models.TaskStatus
click seedboxsync.core.database.models.TaskStatus href "" "seedboxsync.core.database.models.TaskStatus"
click seedboxsync.core.database.models.model.SeedboxSyncModel href "" "seedboxsync.core.database.models.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.database.models.Torrent[Torrent]
seedboxsync.core.database.models.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.database.models.model.SeedboxSyncModel --> seedboxsync.core.database.models.Torrent
click seedboxsync.core.database.models.Torrent href "" "seedboxsync.core.database.models.Torrent"
click seedboxsync.core.database.models.model.SeedboxSyncModel href "" "seedboxsync.core.database.models.model.SeedboxSyncModel"
Data Access Object (DAO) representing a torrent.
This model stores metadata for a torrent file, including tracker info, source provenance, file counts, payload size, privacy status, and processing timestamp.
Attributes:
-
id(int) –Auto-incremented primary key.
-
name(str) –Name of the torrent.
-
announce(str) –Tracker announce URL.
-
announcer(str) –Tracker announce domain name.
-
source(str) –Source or provenance tag of the torrent file.
-
total_files(int) –Total number of files contained in the torrent.
-
total_size(int) –Total size of all files in the torrent in bytes.
-
private(bool) –Flag indicating if the torrent is marked as private.
-
sent(datetime) –Timestamp indicating when the torrent was sent or created.
Methods:
-
get_stats_by_source–Get the total count and total size of torrents grouped by source.
-
save–Save the model instance, automatically updating the announcer domain.
-
set_from_file–Populate the model from a torrent file.
-
update_announcer–Extract and populate the announcer domain from the announce URL.
get_stats_by_source
classmethod
get_stats_by_source(
start_date: date | None = None, end_date: date | None = None
) -> list[dict[str, Any]]
Get the total count and total size of torrents grouped by source.
Parameters:
-
(start_datedate | None, default:None) –Optional start date filter.
-
(end_datedate | None, default:None) –Optional end date filter.
Returns:
-
list[dict[str, Any]]–list[dict[str, Any]]: A list of dicts containing mime_type, total count, and total_size.
Source code in seedboxsync/core/database/models/torrent.py
save
Save the model instance, automatically updating the announcer domain.
Source code in seedboxsync/core/database/models/torrent.py
set_from_file
set_from_file(torrent_file: str | PathLike[str]) -> bool
Populate the model from a torrent file.
Parameters:
-
(torrent_filestr | PathLike[str]) –Path to the torrent file.
Returns:
-
bool–True if the torrent is valid and minimal informations was successfully extracted,
-
bool–otherwise False.
Source code in seedboxsync/core/database/models/torrent.py
update_announcer
Extract and populate the announcer domain from the announce URL.
Parses announce URL and extracts the registrable domain (without subdomains).
Source code in seedboxsync/core/database/models/torrent.py
User
flowchart TD
seedboxsync.core.database.models.User[User]
seedboxsync.core.database.models.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.database.models.model.SeedboxSyncModel --> seedboxsync.core.database.models.User
click seedboxsync.core.database.models.User href "" "seedboxsync.core.database.models.User"
click seedboxsync.core.database.models.model.SeedboxSyncModel href "" "seedboxsync.core.database.models.model.SeedboxSyncModel"
Data Access Object (DAO) representing a user.
This model stores user account information, including authentication credentials, email address, account creation date, and last login timestamp.
Attributes:
-
id(int) –Auto-incremented primary key.
-
username(str) –Unique username of the user.
-
password(str) –Hashed password of the user.
-
email(str) –Unique email address of the user.
-
created(datetime) –Timestamp when the user account was created.
-
last_login(datetime) –Timestamp when the user last logged in.
Methods:
-
authenticate–Authenticate a user using their username or email address.
-
update_last_login–Update the last login timestamp for the user.
authenticate
classmethod
Authenticate a user using their username or email address.
Parameters:
-
(loginstr) –Username or email address.
-
(passwordstr) –Plain-text password to verify.
Returns:
-
Self | None–Self | None: The authenticated user, or None if authentication fails.
Source code in seedboxsync/core/database/models/user.py
update_last_login
Update the last login timestamp for the user.
This method sets the last_login field to the current datetime and
saves the change to the database.
Source code in seedboxsync/core/database/models/user.py
apikey
Peewee DAO model for ApiKey.
Classes:
-
ApiKey–Data Access Object (DAO) representing an API Key.
ApiKey
flowchart TD
seedboxsync.core.database.models.apikey.ApiKey[ApiKey]
seedboxsync.core.database.models.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.database.models.model.SeedboxSyncModel --> seedboxsync.core.database.models.apikey.ApiKey
click seedboxsync.core.database.models.apikey.ApiKey href "" "seedboxsync.core.database.models.apikey.ApiKey"
click seedboxsync.core.database.models.model.SeedboxSyncModel href "" "seedboxsync.core.database.models.model.SeedboxSyncModel"
Data Access Object (DAO) representing an API Key.
Stores API key metadata and hashed secret values associated with a user account for programmatic access.
Attributes:
-
id(int) –Auto-incremented primary key.
-
user(User) –Foreign key reference to the associated user account.
-
name(str) –Human-readable label describing the purpose of the key.
-
key_hash(str) –SHA-256 hash of the generated raw API key.
-
created(datetime) –Timestamp when the API key was created.
-
last_used(datetime | None) –Timestamp when the API key was last used.
Methods:
-
authenticate–Authenticate an incoming API key string.
-
generate–Generate a new API key for a user.
authenticate
classmethod
Authenticate an incoming API key string.
Hashes the incoming raw key and verifies if a matching active key exists
in the database. Updates last_used on success.
Parameters:
-
(raw_keystr) –Plain-text API key provided in the HTTP header/request.
Returns:
-
User | None–User | None: The matching User instance, or None if authentication fails.
Source code in seedboxsync/core/database/models/apikey.py
generate
classmethod
Generate a new API key for a user.
Computes a cryptographically secure random token, hashes it for storage, and returns both the database model instance and the raw token.
Parameters:
-
(userUser) –User model instance owning the new key.
-
(namestr) –Descriptive label for the key.
Returns:
-
tuple[Self, str]–tuple[Self, str]: A tuple containing (ApiKey instance, raw_api_key_str). The raw key string must be displayed to the user immediately, as it cannot be recovered later.
Source code in seedboxsync/core/database/models/apikey.py
download
Peewee DAO model for Download.
Classes:
-
Download–Data Access Object (DAO) representing a file download.
Download
flowchart TD
seedboxsync.core.database.models.download.Download[Download]
seedboxsync.core.database.models.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.database.models.model.SeedboxSyncModel --> seedboxsync.core.database.models.download.Download
click seedboxsync.core.database.models.download.Download href "" "seedboxsync.core.database.models.download.Download"
click seedboxsync.core.database.models.model.SeedboxSyncModel href "" "seedboxsync.core.database.models.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:
-
get_stats_by_mime_type–Get the total count and total size of downloaded files grouped by MIME type.
-
is_already_download–Check if a file has already been downloaded.
-
set_mime–Detect and update the MIME attributes of the downloaded file.
get_stats_by_mime_type
classmethod
get_stats_by_mime_type(
start_date: date | None = None, end_date: date | None = None
) -> list[dict[str, Any]]
Get the total count and total size of downloaded files grouped by MIME type.
Parameters:
-
(start_datedate | None, default:None) –Optional start date filter.
-
(end_datedate | None, default:None) –Optional end date filter.
Returns:
-
list[dict[str, Any]]–list[dict[str, Any]]: A list of dicts containing mime_type, total count, and total_size.
Source code in seedboxsync/core/database/models/download.py
is_already_download
classmethod
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/database/models/download.py
set_mime
set_mime(save: bool = False) -> None
Detect and update the MIME attributes of the downloaded file.
Calls utils.get_mime_type_from_file to inspect the file path and header bytes,
updating the mime_extension, mime_type, and mime_confidence attributes.
Parameters:
-
(savebool, default:False) –If True, saves the model instance to the database immediately after updating attributes. Defaults to False.
Source code in seedboxsync/core/database/models/download.py
model
Peewee model.
Classes:
-
SeedboxSyncModel–Basemodel from which all other peewee models are derived.
SeedboxSyncModel
flowchart TD
seedboxsync.core.database.models.model.SeedboxSyncModel[SeedboxSyncModel]
click seedboxsync.core.database.models.model.SeedboxSyncModel href "" "seedboxsync.core.database.models.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.database.models.seedboxsync.SeedboxSync[SeedboxSync]
seedboxsync.core.database.models.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.database.models.model.SeedboxSyncModel --> seedboxsync.core.database.models.seedboxsync.SeedboxSync
click seedboxsync.core.database.models.seedboxsync.SeedboxSync href "" "seedboxsync.core.database.models.seedboxsync.SeedboxSync"
click seedboxsync.core.database.models.model.SeedboxSyncModel href "" "seedboxsync.core.database.models.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.
taskstatus
Peewee DAO model for TaskStatus.
Classes:
-
TaskStatus–Represents a taskstatus record in the system to prevent concurrent processes.
TaskStatus
flowchart TD
seedboxsync.core.database.models.taskstatus.TaskStatus[TaskStatus]
seedboxsync.core.database.models.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.database.models.model.SeedboxSyncModel --> seedboxsync.core.database.models.taskstatus.TaskStatus
click seedboxsync.core.database.models.taskstatus.TaskStatus href "" "seedboxsync.core.database.models.taskstatus.TaskStatus"
click seedboxsync.core.database.models.model.SeedboxSyncModel href "" "seedboxsync.core.database.models.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.database.models.torrent.Torrent[Torrent]
seedboxsync.core.database.models.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.database.models.model.SeedboxSyncModel --> seedboxsync.core.database.models.torrent.Torrent
click seedboxsync.core.database.models.torrent.Torrent href "" "seedboxsync.core.database.models.torrent.Torrent"
click seedboxsync.core.database.models.model.SeedboxSyncModel href "" "seedboxsync.core.database.models.model.SeedboxSyncModel"
Data Access Object (DAO) representing a torrent.
This model stores metadata for a torrent file, including tracker info, source provenance, file counts, payload size, privacy status, and processing timestamp.
Attributes:
-
id(int) –Auto-incremented primary key.
-
name(str) –Name of the torrent.
-
announce(str) –Tracker announce URL.
-
announcer(str) –Tracker announce domain name.
-
source(str) –Source or provenance tag of the torrent file.
-
total_files(int) –Total number of files contained in the torrent.
-
total_size(int) –Total size of all files in the torrent in bytes.
-
private(bool) –Flag indicating if the torrent is marked as private.
-
sent(datetime) –Timestamp indicating when the torrent was sent or created.
Methods:
-
get_stats_by_source–Get the total count and total size of torrents grouped by source.
-
save–Save the model instance, automatically updating the announcer domain.
-
set_from_file–Populate the model from a torrent file.
-
update_announcer–Extract and populate the announcer domain from the announce URL.
get_stats_by_source
classmethod
get_stats_by_source(
start_date: date | None = None, end_date: date | None = None
) -> list[dict[str, Any]]
Get the total count and total size of torrents grouped by source.
Parameters:
-
(start_datedate | None, default:None) –Optional start date filter.
-
(end_datedate | None, default:None) –Optional end date filter.
Returns:
-
list[dict[str, Any]]–list[dict[str, Any]]: A list of dicts containing mime_type, total count, and total_size.
Source code in seedboxsync/core/database/models/torrent.py
save
Save the model instance, automatically updating the announcer domain.
Source code in seedboxsync/core/database/models/torrent.py
set_from_file
set_from_file(torrent_file: str | PathLike[str]) -> bool
Populate the model from a torrent file.
Parameters:
-
(torrent_filestr | PathLike[str]) –Path to the torrent file.
Returns:
-
bool–True if the torrent is valid and minimal informations was successfully extracted,
-
bool–otherwise False.
Source code in seedboxsync/core/database/models/torrent.py
update_announcer
Extract and populate the announcer domain from the announce URL.
Parses announce URL and extracts the registrable domain (without subdomains).
Source code in seedboxsync/core/database/models/torrent.py
user
Peewee DAO model for User.
Classes:
-
User–Data Access Object (DAO) representing a user.
User
flowchart TD
seedboxsync.core.database.models.user.User[User]
seedboxsync.core.database.models.model.SeedboxSyncModel[SeedboxSyncModel]
seedboxsync.core.database.models.model.SeedboxSyncModel --> seedboxsync.core.database.models.user.User
click seedboxsync.core.database.models.user.User href "" "seedboxsync.core.database.models.user.User"
click seedboxsync.core.database.models.model.SeedboxSyncModel href "" "seedboxsync.core.database.models.model.SeedboxSyncModel"
Data Access Object (DAO) representing a user.
This model stores user account information, including authentication credentials, email address, account creation date, and last login timestamp.
Attributes:
-
id(int) –Auto-incremented primary key.
-
username(str) –Unique username of the user.
-
password(str) –Hashed password of the user.
-
email(str) –Unique email address of the user.
-
created(datetime) –Timestamp when the user account was created.
-
last_login(datetime) –Timestamp when the user last logged in.
Methods:
-
authenticate–Authenticate a user using their username or email address.
-
update_last_login–Update the last login timestamp for the user.
authenticate
classmethod
Authenticate a user using their username or email address.
Parameters:
-
(loginstr) –Username or email address.
-
(passwordstr) –Plain-text password to verify.
Returns:
-
Self | None–Self | None: The authenticated user, or None if authentication fails.
Source code in seedboxsync/core/database/models/user.py
update_last_login
Update the last login timestamp for the user.
This method sets the last_login field to the current datetime and
saves the change to the database.
Source code in seedboxsync/core/database/models/user.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_database_path_from_paths–Find and return an existing writable database file path.
-
get_mime_type_from_file–Detect the MIME type and extension of a file.
-
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_database_path_from_paths
Find and return an existing writable database file path.
Iterates through a predefined list of standard locations to locate a valid database file. Returns the first path that exists, is a regular file, and has write permissions. If no match is found, falls back to the default user configuration path.
Returns:
-
Path(Path) –The resolved writable database path if found; otherwise, the default path (~/.config/seedboxsync/seedboxsync.db).
Source code in seedboxsync/core/utils.py
get_mime_type_from_file
get_mime_type_from_file(filename: str) -> tuple[str, str, str]
Detect the MIME type and extension of a file.
Parameters:
-
(filenamestr) –Name to the local file to analyze
Returns: tuple[str, str, str]: (mime_type, mime_extension, confidence)
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.