コード例 #1
0
##################################
# Main of the Random Screensaver
##################################
if __name__ == '__main__':
    log("RandomScreensaver Starting %s" % ADDON.getAddonInfo('version'))

    screensavers = []

    # Check if the selection is the default Random method
    if Settings.isRandomMode():
        # Make the call to find out all the screensaver addons that are installed
        screensavers = Collector.getInstalledScreensavers()

        # Get the list of excluded screensavers
        if len(screensavers) > 0:
            excludedScreensavers = Settings.getExcludedScreensavers()

            # Reduce the screensaver list to the ones not in the exclude list
            if len(excludedScreensavers) > 0:
                log("RandomScreensaver: Screensavers to exclude are %s" % excludedScreensavers)
                screensavers = [item for item in screensavers if item not in excludedScreensavers]

        # Check to see if all the screensavers that have been collected are also
        # able to run as scripts - if they are not, then we can not launch them from
        # a sub-script
        if len(screensavers) > 0:
            # Get all the screensavers that can not be launched as a script, because we
            # can not allow those to be chosen
            unsupportedScreensavers = Collector.getUnsupportedScreensavers(screensavers)

            # Remove the unsupported screensaver addons