~minus/stewdio-api

1ccdaf4cb9b3e64d56521d22fd29ce9d40fdd762 — minus 4 years ago a695f59
Remove /api/request/favorite/<username>

Use /api/request/random with a search string of fav:<username> instead.
1 files changed, 0 insertions(+), 17 deletions(-)

M stewdio/app.py
M stewdio/app.py => stewdio/app.py +0 -17
@@ 84,23 84,6 @@ def request(hash, session):
	song = session.query(types.Song).filter(types.Song.hash.startswith(hash)).one()
	return queue_song(song.json())

@app.route("/api/request/favorite/<username>")
@with_db_session
@json_api
def request_favorite(session, username, num=1):
	username = username.lower()
	if "num" in flask.request.args:
		num = int(flask.request.args["num"])
	user = session.query(types.User).filter_by(name=username).one_or_none()
	if not user:
		return None, 404
	favs = (session.query(types.Song)
			.filter(types.Song.favored_by.contains(user))
			.order_by(sa.func.random())
			.limit(num).all())
	ret = [queue_song(song.json()) for song in favs]
	return ret

@app.route("/api/request/random/<terms>")
@with_pg_cursor
@json_api