unidown.core

unidown.core.manager

Manager of the whole program, contains the most important functions as well as the download routine.

unidown.core.manager.check_update()[source]

Check for app updates and print/log them.

unidown.core.manager.download_from_plugin(plugin)[source]

Download routine.

  1. Get plugin from the given name

  2. Get the last overall update time

  3. Load the savestate

  4. Compare last update time with the one from the savestate

  5. Get the download links

  6. Compare received links and their times with the savestate

  7. Clean up names, to eliminate duplicated

  8. Download new and newer links

  9. Check downloaded data

  10. Update savestate

  11. Save new savestate to file

Parameters

plugin (APlugin) – plugin

unidown.core.manager.get_options(options)[source]

Convert the option list to a dictionary where the key is the option and the value is the related option. Is called in the init.

Parameters

options (List[List[str]]) – options given to the plugin.

Return type

Dict[str, Any]

Returns

dictionary which contains the option key and values

unidown.core.manager.init_logging(settings)[source]

Initialize the _downloader.

Parameters

settings (Settings) – settings

unidown.core.manager.run(settings, plugin_name, raw_options)[source]

Run a plugin so use the download routine and clean up after.

Parameters
  • settings (Settings) – settings to use

  • plugin_name (str) – name of plugin

  • raw_options (List[List[str]]) – parameters which will be send to the plugin initialization

Return type

PluginState

Returns

ending state

unidown.core.manager.shutdown()[source]

Close and exit important things.

unidown.core.plugin_state

class unidown.core.plugin_state.PluginState(value)[source]

State of a plugin, after it ended or was not found.

EndSuccess = 0

successfully end

LoadCrash = 3

raised an exception while loading/ initializing

NotFound = 4

plugin was not found

RunCrash = 2

raised an exception but ~unidown.plugin.exceptions.PluginException

RunFail = 1

raised an ~unidown.plugin.exceptions.PluginException

unidown.core.settings

class unidown.core.settings.Settings(root_dir=None, log_file=None, log_level='INFO')[source]
Variables
  • _root_dir – root path

  • temp_dir – temporary main path, here are the sub folders for every plugin

  • download_dir – download main path, here are the sub folders for every plugin

  • savestate_dir – savestates main path, here are the sub folders for every plugin

  • log_file – log file of the program

  • available_plugins – available plugins which are found at starting the program, name -> EntryPoint

  • using_cores – how many _cores should be used

  • _log_level – log level

  • _disable_tqdm – if the console progress bar is disabled

Parameters
check_dirs()[source]

Check the directories if they exist.

Raises

FileExistsError – if a file exists but is not a directory

property cores

Plain getter.

Return type

int

property disable_tqdm

Plain getter.

Return type

bool

property download_dir

Plain getter.

Return type

Path

property log_file

Plain getter.

Return type

Path

property log_level

Plain getter.

Return type

str

mkdir()[source]

Create all base directories.

property root_dir

Plain getter.

Return type

Path

property savestate_dir

Plain getter.

Return type

Path

property temp_dir

Plain getter.

Return type

Path

unidown.core.updater

Things needed for checking for updates.

unidown.core.updater.check_for_app_updates()[source]

Check for updates.

Return type

bool

Returns

is update available

unidown.core.updater.get_newest_app_version()[source]

Download the version tag from remote.

Return type

Version

Returns

version from remote