mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 12:33:03 +00:00
ec5889515b
.ie. will still show recent items even if they are 3 months old (is this good or bad?)
25 lines
621 B
Python
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)}
|