1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-11-10 04:02:17 +00:00

Relative imports

This commit is contained in:
spl0k 2017-12-11 19:46:51 +01:00
parent 52d82de145
commit 9862e6c573
20 changed files with 101 additions and 78 deletions

View File

@ -18,15 +18,16 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from flask import request, current_app as app
from xml.etree import ElementTree
from xml.dom import minidom
import simplejson import simplejson
import uuid import uuid
import binascii import binascii
from supysonic.web import store from flask import request, current_app as app
from supysonic.managers.user import UserManager from xml.dom import minidom
from xml.etree import ElementTree
from ..web import store
from ..managers.user import UserManager
@app.before_request @app.before_request
def set_formatter(): def set_formatter():

View File

@ -18,16 +18,17 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from flask import request, current_app as app
from storm.expr import Desc, Avg, Min, Max
from storm.info import ClassAlias
from datetime import timedelta
import random import random
import uuid import uuid
from supysonic.web import store from datetime import timedelta
from supysonic.db import Folder, Artist, Album, Track, RatingFolder, StarredFolder, StarredArtist, StarredAlbum, StarredTrack, User from flask import request, current_app as app
from supysonic.db import now from storm.expr import Desc, Avg, Min, Max
from storm.info import ClassAlias
from ..db import Folder, Artist, Album, Track, RatingFolder, StarredFolder, StarredArtist, StarredAlbum, StarredTrack, User
from ..db import now
from ..web import store
@app.route('/rest/getRandomSongs.view', methods = [ 'GET', 'POST' ]) @app.route('/rest/getRandomSongs.view', methods = [ 'GET', 'POST' ])
def rand_songs(): def rand_songs():

View File

@ -20,14 +20,16 @@
import time import time
import uuid import uuid
from flask import request, current_app as app from flask import request, current_app as app
from supysonic.web import store from ..db import Track, Album, Artist, Folder
from ..db import StarredTrack, StarredAlbum, StarredArtist, StarredFolder
from ..db import RatingTrack, RatingFolder
from ..lastfm import LastFm
from ..web import store
from . import get_entity from . import get_entity
from supysonic.lastfm import LastFm
from supysonic.db import Track, Album, Artist, Folder
from supysonic.db import StarredTrack, StarredAlbum, StarredArtist, StarredFolder
from supysonic.db import RatingTrack, RatingFolder
def try_star(ent, starred_ent, eid): def try_star(ent, starred_ent, eid):
""" Stars an entity """ Stars an entity

View File

@ -3,7 +3,7 @@
# This file is part of Supysonic. # This file is part of Supysonic.
# #
# Supysonic is a Python implementation of the Subsonic server API. # Supysonic is a Python implementation of the Subsonic server API.
# Copyright (C) 2013 Alban 'spl0k' Féron # Copyright (C) 2013-2017 Alban 'spl0k' Féron
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@ -18,11 +18,15 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import string
import uuid
from flask import request, current_app as app from flask import request, current_app as app
from supysonic.web import store
from supysonic.db import Folder, Artist, Album, Track from ..db import Folder, Artist, Album, Track
from ..web import store
from . import get_entity from . import get_entity
import uuid, string
@app.route('/rest/getMusicFolders.view', methods = [ 'GET', 'POST' ]) @app.route('/rest/getMusicFolders.view', methods = [ 'GET', 'POST' ])
def list_folders(): def list_folders():

View File

@ -3,7 +3,7 @@
# This file is part of Supysonic. # This file is part of Supysonic.
# #
# Supysonic is a Python implementation of the Subsonic server API. # Supysonic is a Python implementation of the Subsonic server API.
# Copyright (C) 2013 Alban 'spl0k' Féron # Copyright (C) 2013-2017 Alban 'spl0k' Féron
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@ -19,8 +19,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from flask import request, current_app as app from flask import request, current_app as app
from supysonic.web import store
from supysonic.db import ChatMessage from ..db import ChatMessage
from ..web import store
@app.route('/rest/getChatMessages.view', methods = [ 'GET', 'POST' ]) @app.route('/rest/getChatMessages.view', methods = [ 'GET', 'POST' ])
def get_chat(): def get_chat():

View File

@ -28,9 +28,10 @@ from flask import request, send_file, Response, current_app as app
from PIL import Image from PIL import Image
from xml.etree import ElementTree from xml.etree import ElementTree
from supysonic import scanner from .. import scanner
from supysonic.web import store from ..web import store
from supysonic.db import Track, Album, Artist, Folder, User, ClientPrefs, now from ..db import Track, Album, Artist, Folder, User, ClientPrefs, now
from . import get_entity from . import get_entity
def prepare_transcoding_cmdline(base_cmdline, input_file, input_format, output_format, output_bitrate): def prepare_transcoding_cmdline(base_cmdline, input_file, input_format, output_format, output_bitrate):

View File

@ -18,11 +18,14 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import uuid
from flask import request, current_app as app from flask import request, current_app as app
from storm.expr import Or from storm.expr import Or
import uuid
from supysonic.web import store from ..db import Playlist, User, Track
from supysonic.db import Playlist, User, Track from ..web import store
from . import get_entity from . import get_entity
@app.route('/rest/getPlaylists.view', methods = [ 'GET', 'POST' ]) @app.route('/rest/getPlaylists.view', methods = [ 'GET', 'POST' ])

View File

@ -21,8 +21,9 @@
from datetime import datetime from datetime import datetime
from flask import request, current_app as app from flask import request, current_app as app
from storm.info import ClassAlias from storm.info import ClassAlias
from supysonic.web import store
from supysonic.db import Folder, Track, Artist, Album from ..db import Folder, Track, Artist, Album
from ..web import store
@app.route('/rest/search.view', methods = [ 'GET', 'POST' ]) @app.route('/rest/search.view', methods = [ 'GET', 'POST' ])
def old_search(): def old_search():

View File

@ -19,9 +19,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from flask import request, current_app as app from flask import request, current_app as app
from supysonic.web import store
from supysonic.db import User from ..db import User
from supysonic.managers.user import UserManager from ..managers.user import UserManager
from ..web import store
from . import decode_password from . import decode_password
@app.route('/rest/getUser.view', methods = [ 'GET', 'POST' ]) @app.route('/rest/getUser.view', methods = [ 'GET', 'POST' ])

View File

@ -25,10 +25,10 @@ import getpass
import sys import sys
import time import time
from supysonic.db import get_store, Folder, User from .db import get_store, Folder, User
from supysonic.managers.folder import FolderManager from .managers.folder import FolderManager
from supysonic.managers.user import UserManager from .managers.user import UserManager
from supysonic.scanner import Scanner from .scanner import Scanner
class TimedProgressDisplay: class TimedProgressDisplay:
def __init__(self, name, stdout, interval = 5): def __init__(self, name, stdout, interval = 5):

View File

@ -10,11 +10,12 @@
# Distributed under terms of the GNU AGPLv3 license. # Distributed under terms of the GNU AGPLv3 license.
from flask import session, request, redirect, url_for, current_app as app from flask import session, request, redirect, url_for, current_app as app
from supysonic.web import store
from supysonic.db import Artist, Album, Track
from supysonic.managers.user import UserManager
from functools import wraps from functools import wraps
from ..web import store
from ..db import Artist, Album, Track
from ..managers.user import UserManager
@app.before_request @app.before_request
def login_check(): def login_check():
if request.path.startswith('/rest/'): if request.path.startswith('/rest/'):

View File

@ -18,15 +18,16 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from flask import request, flash, render_template, redirect, url_for, current_app as app
import os.path import os.path
import uuid import uuid
from supysonic.web import store from flask import request, flash, render_template, redirect, url_for, current_app as app
from supysonic.db import Folder
from supysonic.scanner import Scanner from ..db import Folder
from supysonic.managers.user import UserManager from ..managers.user import UserManager
from supysonic.managers.folder import FolderManager from ..managers.folder import FolderManager
from ..scanner import Scanner
from ..web import store
from . import admin_only from . import admin_only

View File

@ -18,11 +18,13 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from flask import request, flash, render_template, redirect, url_for, current_app as app
import uuid import uuid
from supysonic.web import store
from supysonic.db import Playlist from flask import request, flash, render_template, redirect, url_for, current_app as app
from supysonic.managers.user import UserManager
from ..web import store
from ..db import Playlist
from ..managers.user import UserManager
@app.route('/playlist') @app.route('/playlist')
def playlist_index(): def playlist_index():

View File

@ -21,10 +21,10 @@
from flask import request, session, flash, render_template, redirect, url_for, current_app as app from flask import request, session, flash, render_template, redirect, url_for, current_app as app
from functools import wraps from functools import wraps
from supysonic.web import store from ..db import User, ClientPrefs
from supysonic.managers.user import UserManager from ..lastfm import LastFm
from supysonic.db import User, ClientPrefs from ..managers.user import UserManager
from supysonic.lastfm import LastFm from ..web import store
from . import admin_only from . import admin_only

View File

@ -3,7 +3,7 @@
# This file is part of Supysonic. # This file is part of Supysonic.
# #
# Supysonic is a Python implementation of the Subsonic server API. # Supysonic is a Python implementation of the Subsonic server API.
# Copyright (C) 2013, 2014 Alban 'spl0k' Féron # Copyright (C) 2013-2017 Alban 'spl0k' Féron
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@ -18,9 +18,11 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os.path, uuid import os.path
from supysonic.db import Folder, Artist, Album, Track, StarredFolder, RatingFolder import uuid
from supysonic.scanner import Scanner
from ..db import Folder, Artist, Album, Track, StarredFolder, RatingFolder
from ..scanner import Scanner
class FolderManager: class FolderManager:
SUCCESS = 0 SUCCESS = 0

View File

@ -9,14 +9,14 @@
# #
# Distributed under terms of the GNU AGPLv3 license. # Distributed under terms of the GNU AGPLv3 license.
import string
import random
import hashlib import hashlib
import random
import string
import uuid import uuid
from supysonic.db import User, ChatMessage, Playlist from ..db import User, ChatMessage, Playlist
from supysonic.db import StarredFolder, StarredArtist, StarredAlbum, StarredTrack from ..db import StarredFolder, StarredArtist, StarredAlbum, StarredTrack
from supysonic.db import RatingFolder, RatingTrack from ..db import RatingFolder, RatingTrack
class UserManager: class UserManager:
SUCCESS = 0 SUCCESS = 0

View File

@ -3,7 +3,7 @@
# This file is part of Supysonic. # This file is part of Supysonic.
# #
# Supysonic is a Python implementation of the Subsonic server API. # Supysonic is a Python implementation of the Subsonic server API.
# Copyright (C) 2013, 2014 Alban 'spl0k' Féron # Copyright (C) 2013-2017 Alban 'spl0k' Féron
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@ -26,9 +26,9 @@ import time
from storm.expr import ComparableExpr, compile, Like from storm.expr import ComparableExpr, compile, Like
from storm.exceptions import NotSupportedError from storm.exceptions import NotSupportedError
from supysonic.db import Folder, Artist, Album, Track, User from .db import Folder, Artist, Album, Track, User
from supysonic.db import StarredFolder, StarredArtist, StarredAlbum, StarredTrack from .db import StarredFolder, StarredArtist, StarredAlbum, StarredTrack
from supysonic.db import RatingFolder, RatingTrack from .db import RatingFolder, RatingTrack
# Hacking in support for a concatenation expression # Hacking in support for a concatenation expression
class Concat(ComparableExpr): class Concat(ComparableExpr):

View File

@ -18,16 +18,17 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import time
import logging import logging
import time
from logging.handlers import TimedRotatingFileHandler
from signal import signal, SIGTERM, SIGINT from signal import signal, SIGTERM, SIGINT
from threading import Thread, Condition, Timer from threading import Thread, Condition, Timer
from logging.handlers import TimedRotatingFileHandler
from watchdog.observers import Observer from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler from watchdog.events import PatternMatchingEventHandler
from supysonic import db from . import db
from supysonic.scanner import Scanner from .scanner import Scanner
OP_SCAN = 1 OP_SCAN = 1
OP_REMOVE = 2 OP_REMOVE = 2

View File

@ -15,8 +15,8 @@ from flask import Flask, g, current_app
from os import makedirs, path from os import makedirs, path
from werkzeug.local import LocalProxy from werkzeug.local import LocalProxy
from supysonic.config import IniConfig from .config import IniConfig
from supysonic.db import get_store from .db import get_store
# Supysonic database open # Supysonic database open
def get_db(): def get_db():
@ -77,9 +77,9 @@ def create_application(config = None):
# Import app sections # Import app sections
with app.app_context(): with app.app_context():
if app.config['WEBAPP']['mount_webui']: if app.config['WEBAPP']['mount_webui']:
from supysonic import frontend from . import frontend
if app.config['WEBAPP']['mount_api']: if app.config['WEBAPP']['mount_api']:
from supysonic import api from . import api
return app return app

View File

@ -11,7 +11,7 @@
import unittest import unittest
import base, managers, api, frontend from . import base, managers, api, frontend
def suite(): def suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()