Example #1
0
 | '_ \| |/ _ \ \/ /  / _` | | | | __/ _ \/ __|/ __/ _` | '_ \ 
 | |_) | |  __/>  <  | (_| | |_| | || (_) \__ \ (_| (_| | | | |
 | .__/|_|\___/_/\_\  \__,_|\__,_|\__\___/|___/\___\__,_|_| |_|
 |_|                                                           
 
#########################################################################
# Author:   l3uddz                                                      #
# URL:      https://github.com/l3uddz/plex_autoscan                     #
# --                                                                    #
# Part of the Cloudbox project: https://cloudbox.works                  #
#########################################################################
# GNU General Public License v3.0                                       #
#########################################################################
""")
    if conf.args['cmd'] == 'sections':
        plex.show_sections(conf.configs)

        exit(0)
    elif conf.args['cmd'] == 'update_sections':
        plex.updateSectionMappings(conf)
    elif conf.args['cmd'] == 'authorize':
        if not conf.configs['GOOGLE']['ENABLED']:
            logger.error(
                "You must enable the ENABLED setting in the GDRIVE config section..."
            )
            exit(1)
        else:
            logger.debug("client_id: %r", conf.configs['GOOGLE']['CLIENT_ID'])
            logger.debug("client_secret: %r",
                         conf.configs['GOOGLE']['CLIENT_SECRET'])
Example #2
0
    else:
        logger.error("Unknown scan request from: %r", request.remote_addr)
        abort(400)

    return "OK"


############################################################
# MAIN
############################################################

if __name__ == "__main__":
    if len(sys.argv) <= 1:
        logger.error("You must pass an argument, sections or server...")
        sys.exit(0)
    else:
        if sys.argv[1].lower() == 'sections':
            plex.show_sections(config)
        elif sys.argv[1].lower() == 'server':
            logger.info("Starting server: http://%s:%d/%s",
                        config['SERVER_IP'], config['SERVER_PORT'],
                        config['SERVER_PASS'])
            app.run(host=config['SERVER_IP'],
                    port=config['SERVER_PORT'],
                    debug=False,
                    use_reloader=False)
            logger.info("Server stopped")
        else:
            logger.error(
                "You must pass an argument of either sections or server...")