Core¶
Boot structure¶
XDM.py
main() -+
|
App() --+
|
+- __init__() -+
| |
| +-- command line options handling / parsing
| +-- xdm.init.preDB(): path and folder setup
| +-- xdm.init.db(): database initialisation and migration
| +-- xdm.init.postDB(): plugin loading
| +-- xdm.init.schedule(): recuring shedular setup and starting
| +-- xdm.init.runTasks(): initial (cleanup) tasks
|
+- startWebServer(): (optional)
|
|
+- starting of the API: (optional)
|
|
+- main while loop with KeyboardInterrupt handler
The common object¶
There is a xdm.common object based on xdm.Common it holds following object references.
Example for PM
from xdm import common
for mediaTypeManager in common.PM.getMediaTypeManager():
print mediaTypeManager.indentifier
instantiated during import
MM– xdm.message.MessageManager - instanceSM– xdm.message.SystemMessageManager - instanceNM– xdm.news.NewsManager - instanceSCHEDULER– xdm.scheduler.Scheduler - instance
instantiated during boot
PM– xdm.plugin.pluginManager.PluginManager - instanceSYSTEM– plugins.system.System.System - instanceUPDATER– xdm.updater.Updater - instanceREPOMANAGER– xdm.plugins.repository.RepoManager - instanceAPIKEY– str
Statuses available for Elements set during xdm.init_checkDefaults() (done in xdm.init.db() in App.__init__())
UNKNOWN– xdm.classes.Status - instance # no statusWANTED– xdm.classes.Status - instance # default statusSNATCHED– xdm.classes.Status - instance # well snatched and the downloader is getting it ... so we hopeDOWNLOADING– xdm.classes.Status - instance # its currently downloading woohhoooDOWNLOADED– xdm.classes.Status - instance # no status thingyCOMPLETED– xdm.classes.Status - instance # downloaded and pp_successFAILED– xdm.classes.Status - instance # download failedPP_FAIL– xdm.classes.Status - instance # post processing failedDELETED– xdm.classes.Status - instance # marked as deletedIGNORE– xdm.classes.Status - instance # ignore this itemTEMP– xdm.classes.Status - instance # temporary item like from a search
Note
Any plugin is prohibited from setting any of these attributes. At time of writing there is no measurement in place to prevent this.
-
class
xdm.Common¶ A class that conveniently holds references to common objects and variables @DynamicAttrs
-
getAllStatus()¶ get all available status instances
-
getCompletedStatuses()¶ get statuses that are shown on the completed page
-
getDownloadTypeExtension(downloadTypeIdentifier)¶ get the (file) of the DownloadType defined by downloadTypeIdentifier if none is found will return txt
-
getEveryStatusBut(notWantedStatuses)¶ get all available status instances except statuses in the list notWantedStatuses
-
getHomeStatuses()¶ get statuses that are shown on the home/index page
-
getLocale()¶ get the current local string e.g. en_US e.g. de
this is either the system language / locale or the user set language or the fallback to en_US
-
getStatusByID(id)¶ get a status be the database id
-
getVersionTuple(noBuild=False)¶ return a tuple of the current version
-
isThisVersionNewer(major, minor, revision, build)¶ return bool weather the running version is OLDER then the one build by the params
-