1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-23 01:16:18 +00:00

Some clients do POST requests

This commit is contained in:
Alban 2012-11-22 14:51:43 +01:00 committed by Alban
parent b959d720de
commit 810c288d73
5 changed files with 9 additions and 9 deletions

View File

@ -6,7 +6,7 @@ from db import Track
import random import random
import uuid import uuid
@app.route('/rest/getRandomSongs.view') @app.route('/rest/getRandomSongs.view', methods = [ 'GET', 'POST' ])
def rand_songs(): def rand_songs():
size = request.args.get('size', '10') size = request.args.get('size', '10')
genre, fromYear, toYear, musicFolderId = map(request.args.get, [ 'genre', 'fromYear', 'toYear', 'musicFolderId' ]) genre, fromYear, toYear, musicFolderId = map(request.args.get, [ 'genre', 'fromYear', 'toYear', 'musicFolderId' ])

View File

@ -5,7 +5,7 @@ from web import app
from db import Folder, Artist, Album, Track from db import Folder, Artist, Album, Track
import uuid, time, string import uuid, time, string
@app.route('/rest/getMusicFolders.view') @app.route('/rest/getMusicFolders.view', methods = [ 'GET', 'POST' ])
def list_folders(): def list_folders():
return request.formatter({ return request.formatter({
'musicFolders': { 'musicFolders': {
@ -16,7 +16,7 @@ def list_folders():
} }
}) })
@app.route('/rest/getIndexes.view') @app.route('/rest/getIndexes.view', methods = [ 'GET', 'POST' ])
def list_indexes(): def list_indexes():
musicFolderId = request.args.get('musicFolderId') musicFolderId = request.args.get('musicFolderId')
ifModifiedSince = request.args.get('ifModifiedSince') ifModifiedSince = request.args.get('ifModifiedSince')
@ -83,7 +83,7 @@ def list_indexes():
} }
}) })
@app.route('/rest/getMusicDirectory.view') @app.route('/rest/getMusicDirectory.view', methods = [ 'GET', 'POST' ])
def show_directory(): def show_directory():
did = request.args.get('id') did = request.args.get('id')
if not did: if not did:

View File

@ -7,7 +7,7 @@ from db import Track, Folder
import config import config
import os.path, uuid import os.path, uuid
@app.route('/rest/stream.view') @app.route('/rest/stream.view', methods = [ 'GET', 'POST' ])
def stream_media(): def stream_media():
id, maxBitRate, format, timeOffset, size, estimateContentLength = map(request.args.get, [ 'id', 'maxBitRate', 'format', 'timeOffset', 'size', 'estimateContentLength' ]) id, maxBitRate, format, timeOffset, size, estimateContentLength = map(request.args.get, [ 'id', 'maxBitRate', 'format', 'timeOffset', 'size', 'estimateContentLength' ])
if not id: if not id:
@ -41,7 +41,7 @@ def stream_media():
return send_file(track.path) return send_file(track.path)
@app.route('/rest/getCoverArt.view') @app.route('/rest/getCoverArt.view', methods = [ 'GET', 'POST' ])
def cover_art(): def cover_art():
id = request.args.get('id') id = request.args.get('id')
if not id: if not id:

View File

@ -3,11 +3,11 @@
from flask import request from flask import request
from web import app from web import app
@app.route('/rest/ping.view') @app.route('/rest/ping.view', methods = [ 'GET', 'POST' ])
def ping(): def ping():
return request.formatter({}) return request.formatter({})
@app.route('/rest/getLicense.view') @app.route('/rest/getLicense.view', methods = [ 'GET', 'POST' ])
def license(): def license():
return request.formatter({ 'license': { 'valid': False } }) return request.formatter({ 'license': { 'valid': False } })

View File

@ -4,7 +4,7 @@ from flask import request
from web import app from web import app
from db import User from db import User
@app.route('/rest/getUser.view') @app.route('/rest/getUser.view', methods = [ 'GET', 'POST' ])
def user_info(): def user_info():
username = request.args.get('username') username = request.args.get('username')
if username is None: if username is None: