Files
swingmusic-extended/app/api/home/recents.py
T
mungai-njoroge ec5889515b show recently added items based on by sorting all tracks
.ie. will still show recent items even if they are 3 months old (is this good or bad?)
2024-02-14 23:09:05 +03:00

25 lines
621 B
Python

from flask_restful import Resource, reqparse
from app.lib.home.recentlyadded import get_recent_items
from app.lib.home.recentlyplayed import get_recently_played
parser = reqparse.RequestParser()
parser.add_argument("limit", type=int, required=False, default=7, location="args")
class RecentlyAdded(Resource):
def get(self):
args = parser.parse_args()
limit = args["limit"]
return {"items": get_recent_items(limit)}
class RecentlyPlayed(Resource):
def get(self):
args = parser.parse_args()
limit = args["limit"]
return {"items": get_recently_played(limit)}