mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
move recently added to routines
This commit is contained in:
+14
-1
@@ -2,6 +2,8 @@ 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
|
||||
|
||||
|
||||
@@ -10,9 +12,20 @@ def start_cron_jobs():
|
||||
"""
|
||||
This is the function that triggers the cron jobs.
|
||||
"""
|
||||
Mixes()
|
||||
# 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
|
||||
# Mixes()
|
||||
TopArtists()
|
||||
TopArtists(duration="week")
|
||||
|
||||
# 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)
|
||||
|
||||
+3
-3
@@ -9,10 +9,10 @@ class CronJob(ABC):
|
||||
A cron job that will be run on a regular interval.
|
||||
"""
|
||||
|
||||
def __init__(self, name: str, hours: int):
|
||||
self.name = name
|
||||
self.hours = hours
|
||||
name: str
|
||||
hours: int = 1
|
||||
|
||||
def __init__(self):
|
||||
schedule.every(self.hours).hours.do(self.run)
|
||||
|
||||
@abstractmethod
|
||||
|
||||
+6
-15
@@ -1,7 +1,5 @@
|
||||
from app.crons.cron import CronJob
|
||||
from app.lib.recipes import ArtistMixes
|
||||
from app.plugins.mixes import MixesPlugin
|
||||
from app.store.homepage import HomepageStore
|
||||
from app.lib.recipes.artistmixes import ArtistMixes
|
||||
|
||||
|
||||
class Mixes(CronJob):
|
||||
@@ -9,22 +7,15 @@ class Mixes(CronJob):
|
||||
This cron job creates mixes displayed on the homepage.
|
||||
"""
|
||||
|
||||
name: str = "mixes"
|
||||
hours: int = 1
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("mixes", 1)
|
||||
super().__init__()
|
||||
|
||||
def run(self):
|
||||
"""
|
||||
Creates the artist mixes
|
||||
"""
|
||||
print("⭐⭐⭐⭐ Mixes cron job running")
|
||||
ArtistMixes().run()
|
||||
# mixes = MixesPlugin()
|
||||
|
||||
# if not mixes.enabled:
|
||||
# return
|
||||
|
||||
|
||||
# artist_mixes = mixes.create_artist_mixes()
|
||||
|
||||
# if artist_mixes:
|
||||
# HomepageStore.set_artist_mixes(artist_mixes)
|
||||
ArtistMixes()
|
||||
|
||||
Reference in New Issue
Block a user