Files
swingmusic-extended/app/crons/__init__.py
T
cwilvx 809415ddb4 add because you listened to artist artists
+ add artists you might like
2024-11-27 10:55:11 +03:00

32 lines
763 B
Python

import time
import schedule
from app.crons.mixes import Mixes
from app.lib.recipes.recents import RecentlyAdded, RecentlyPlayed
from app.lib.recipes.topstreamed import TopArtists
from app.utils.threading import background
@background
def start_cron_jobs():
"""
This is the function that triggers the cron jobs.
"""
# NOTE: RecentlyPlayed is not a CRON job, it's triggered here to
# populate the values for the very first time.
RecentlyPlayed()
RecentlyAdded()
# Initialized CRON jobs
TopArtists()
TopArtists(duration="week")
Mixes()
# Trigger all CRON jobs when the app is started.
schedule.run_all()
# Run all CRON jobs on a loop.
while True:
schedule.run_pending()
time.sleep(1)