mirror of
https://github.com/spl0k/supysonic.git
synced 2024-11-09 19:52:16 +00:00
Import cleanup
This commit is contained in:
parent
e22620b147
commit
bba254f339
@ -9,7 +9,6 @@ API_VERSION = "1.10.2"
|
|||||||
|
|
||||||
import binascii
|
import binascii
|
||||||
import uuid
|
import uuid
|
||||||
import functools
|
|
||||||
from flask import request
|
from flask import request
|
||||||
from flask import Blueprint
|
from flask import Blueprint
|
||||||
from pony.orm import ObjectNotFound
|
from pony.orm import ObjectNotFound
|
||||||
@ -26,10 +25,11 @@ api = Blueprint("api", __name__)
|
|||||||
|
|
||||||
def api_routing(endpoint):
|
def api_routing(endpoint):
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
viewendpoint="{}.view".format(endpoint)
|
viewendpoint = "{}.view".format(endpoint)
|
||||||
api.add_url_rule(endpoint,view_func=func, methods=["GET", "POST"])
|
api.add_url_rule(endpoint, view_func=func, methods=["GET", "POST"])
|
||||||
api.add_url_rule(viewendpoint,view_func=func, methods=["GET", "POST"])
|
api.add_url_rule(viewendpoint, view_func=func, methods=["GET", "POST"])
|
||||||
return func
|
return func
|
||||||
|
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ from ..db import (
|
|||||||
)
|
)
|
||||||
from ..db import now
|
from ..db import now
|
||||||
|
|
||||||
from . import api, api_routing
|
from . import api_routing
|
||||||
from .exceptions import GenericError, NotFound
|
from .exceptions import GenericError, NotFound
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ from ..db import StarredTrack, StarredAlbum, StarredArtist, StarredFolder
|
|||||||
from ..db import RatingTrack, RatingFolder
|
from ..db import RatingTrack, RatingFolder
|
||||||
from ..lastfm import LastFm
|
from ..lastfm import LastFm
|
||||||
|
|
||||||
from . import api, get_entity, get_entity_id, api_routing
|
from . import get_entity, get_entity_id, api_routing
|
||||||
from .exceptions import AggregateException, GenericError, MissingParameter, NotFound
|
from .exceptions import AggregateException, GenericError, MissingParameter, NotFound
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ from pony.orm import ObjectNotFound, select, count
|
|||||||
|
|
||||||
from ..db import Folder, Artist, Album, Track
|
from ..db import Folder, Artist, Album, Track
|
||||||
|
|
||||||
from . import api, get_entity, get_entity_id, api_routing
|
from . import get_entity, get_entity_id, api_routing
|
||||||
|
|
||||||
|
|
||||||
@api_routing("/getMusicFolders")
|
@api_routing("/getMusicFolders")
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from ..db import ChatMessage
|
from ..db import ChatMessage
|
||||||
from . import api, api_routing
|
from . import api_routing
|
||||||
|
|
||||||
|
|
||||||
@api_routing("/getChatMessages")
|
@api_routing("/getChatMessages")
|
||||||
|
@ -14,7 +14,7 @@ from ..daemon import DaemonClient
|
|||||||
from ..daemon.exceptions import DaemonUnavailableError
|
from ..daemon.exceptions import DaemonUnavailableError
|
||||||
from ..db import Track
|
from ..db import Track
|
||||||
|
|
||||||
from . import api, api_routing
|
from . import api_routing
|
||||||
from .exceptions import GenericError, MissingParameter, Forbidden
|
from .exceptions import GenericError, MissingParameter, Forbidden
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ from zipstream import ZipFile
|
|||||||
from ..cache import CacheMiss
|
from ..cache import CacheMiss
|
||||||
from ..db import Track, Album, Folder, now
|
from ..db import Track, Album, Folder, now
|
||||||
|
|
||||||
from . import api, get_entity, get_entity_id, api_routing
|
from . import get_entity, get_entity_id, api_routing
|
||||||
from .exceptions import (
|
from .exceptions import (
|
||||||
GenericError,
|
GenericError,
|
||||||
NotFound,
|
NotFound,
|
||||||
|
@ -11,7 +11,7 @@ from flask import request
|
|||||||
|
|
||||||
from ..db import Playlist, User, Track
|
from ..db import Playlist, User, Track
|
||||||
|
|
||||||
from . import api, get_entity, api_routing
|
from . import get_entity, api_routing
|
||||||
from .exceptions import Forbidden, MissingParameter, NotFound
|
from .exceptions import Forbidden, MissingParameter, NotFound
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from flask import request
|
|||||||
|
|
||||||
from ..db import RadioStation
|
from ..db import RadioStation
|
||||||
|
|
||||||
from . import api, get_entity, api_routing
|
from . import get_entity, api_routing
|
||||||
from .exceptions import Forbidden, MissingParameter
|
from .exceptions import Forbidden, MissingParameter
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ from flask import current_app
|
|||||||
from ..daemon.client import DaemonClient
|
from ..daemon.client import DaemonClient
|
||||||
from ..daemon.exceptions import DaemonUnavailableError
|
from ..daemon.exceptions import DaemonUnavailableError
|
||||||
|
|
||||||
from . import api, api_routing
|
from . import api_routing
|
||||||
from .user import admin_only
|
from .user import admin_only
|
||||||
from .exceptions import ServerError
|
from .exceptions import ServerError
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ from pony.orm import select
|
|||||||
|
|
||||||
from ..db import Folder, Track, Artist, Album
|
from ..db import Folder, Track, Artist, Album
|
||||||
|
|
||||||
from . import api, api_routing
|
from . import api_routing
|
||||||
from .exceptions import MissingParameter
|
from .exceptions import MissingParameter
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from . import api, api_routing
|
from . import api_routing
|
||||||
|
|
||||||
|
|
||||||
@api_routing("/ping")
|
@api_routing("/ping")
|
||||||
|
@ -23,6 +23,9 @@ def unsupported():
|
|||||||
|
|
||||||
|
|
||||||
for m in methods:
|
for m in methods:
|
||||||
|
api.add_url_rule(
|
||||||
|
"/{}".format(m), "unsupported", unsupported, methods=["GET", "POST"]
|
||||||
|
)
|
||||||
api.add_url_rule(
|
api.add_url_rule(
|
||||||
"/{}.view".format(m), "unsupported", unsupported, methods=["GET", "POST"]
|
"/{}.view".format(m), "unsupported", unsupported, methods=["GET", "POST"]
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,7 @@ from functools import wraps
|
|||||||
from ..db import User
|
from ..db import User
|
||||||
from ..managers.user import UserManager
|
from ..managers.user import UserManager
|
||||||
|
|
||||||
from . import api, decode_password, api_routing
|
from . import decode_password, api_routing
|
||||||
from .exceptions import Forbidden, NotFound
|
from .exceptions import Forbidden, NotFound
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user