Example #1
0

def start_scheduler(interval):
    if interval != -1:
        add_job_to_scheduler(interval)
        scheduler.start()


def restart_scheduler(interval):
    scheduler.remove_job('download_playlists')
    if interval != -1:
        add_job_to_scheduler(interval)


scheduler = BackgroundScheduler()
start_scheduler(Controller.get_download_interval())
# Shut down the scheduler when exiting the app
atexit.register(lambda: scheduler.shutdown())

# Create an instance of Flask
app = Flask(__name__)
# Create the API
api = Api(app)


# Route shows the user guide file.
@app.route('/')
def index():
    # Open file
    with open(os.path.dirname(app.root_path) + "/../docs/Api User Guide.md", 'r') as markdown_file:
        # Read the content of the file