1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 08:56:17 +00:00

Relative imports

This commit is contained in:
spl0k 2017-12-11 19:46:51 +01:00
parent acb8d159f7
commit 8046457661
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
# 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 uuid
import binascii
from supysonic.web import store
from supysonic.managers.user import UserManager
from flask import request, current_app as app
from xml.dom import minidom
from xml.etree import ElementTree
from ..web import store
from ..managers.user import UserManager
@app.before_request
def set_formatter():

View File

@ -18,16 +18,17 @@
# 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/>.
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 uuid
from supysonic.web import store
from supysonic.db import Folder, Artist, Album, Track, RatingFolder, StarredFolder, StarredArtist, StarredAlbum, StarredTrack, User
from supysonic.db import now
from datetime import timedelta
from flask import request, current_app as app
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' ])
def rand_songs():

View File

@ -20,14 +20,16 @@
import time
import uuid
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 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):
""" Stars an entity

View File

@ -3,7 +3,7 @@
# This file is part of Supysonic.
#
# 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
# 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
# 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 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
import uuid, string
@app.route('/rest/getMusicFolders.view', methods = [ 'GET', 'POST' ])
def list_folders():

View File

@ -3,7 +3,7 @@
# This file is part of Supysonic.
#
# 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
# 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/>.
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' ])
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 xml.etree import ElementTree
from supysonic import scanner
from supysonic.web import store
from supysonic.db import Track, Album, Artist, Folder, User, ClientPrefs, now
from .. import scanner
from ..web import store
from ..db import Track, Album, Artist, Folder, User, ClientPrefs, now
from . import get_entity
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
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import uuid
from flask import request, current_app as app
from storm.expr import Or
import uuid
from supysonic.web import store
from supysonic.db import Playlist, User, Track
from ..db import Playlist, User, Track
from ..web import store
from . import get_entity
@app.route('/rest/getPlaylists.view', methods = [ 'GET', 'POST' ])

View File

@ -21,8 +21,9 @@
from datetime import datetime
from flask import request, current_app as app
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' ])
def old_search():

View File

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

View File

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

View File

@ -10,11 +10,12 @@
# Distributed under terms of the GNU AGPLv3 license.
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 ..web import store
from ..db import Artist, Album, Track
from ..managers.user import UserManager
@app.before_request
def login_check():
if request.path.startswith('/rest/'):

View File

@ -18,15 +18,16 @@
# 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/>.
from flask import request, flash, render_template, redirect, url_for, current_app as app
import os.path
import uuid
from supysonic.web import store
from supysonic.db import Folder
from supysonic.scanner import Scanner
from supysonic.managers.user import UserManager
from supysonic.managers.folder import FolderManager
from flask import request, flash, render_template, redirect, url_for, current_app as app
from ..db import Folder
from ..managers.user import UserManager
from ..managers.folder import FolderManager
from ..scanner import Scanner
from ..web import store
from . import admin_only

View File

@ -18,11 +18,13 @@
# 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/>.
from flask import request, flash, render_template, redirect, url_for, current_app as app
import uuid
from supysonic.web import store
from supysonic.db import Playlist
from supysonic.managers.user import UserManager
from flask import request, flash, render_template, redirect, url_for, current_app as app
from ..web import store
from ..db import Playlist
from ..managers.user import UserManager
@app.route('/playlist')
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 functools import wraps
from supysonic.web import store
from supysonic.managers.user import UserManager
from supysonic.db import User, ClientPrefs
from supysonic.lastfm import LastFm
from ..db import User, ClientPrefs
from ..lastfm import LastFm
from ..managers.user import UserManager
from ..web import store
from . import admin_only

View File

@ -3,7 +3,7 @@
# This file is part of Supysonic.
#
# 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
# 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
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os.path, uuid
from supysonic.db import Folder, Artist, Album, Track, StarredFolder, RatingFolder
from supysonic.scanner import Scanner
import os.path
import uuid
from ..db import Folder, Artist, Album, Track, StarredFolder, RatingFolder
from ..scanner import Scanner
class FolderManager:
SUCCESS = 0

View File

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

View File

@ -3,7 +3,7 @@
# This file is part of Supysonic.
#
# 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
# 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.exceptions import NotSupportedError
from supysonic.db import Folder, Artist, Album, Track, User
from supysonic.db import StarredFolder, StarredArtist, StarredAlbum, StarredTrack
from supysonic.db import RatingFolder, RatingTrack
from .db import Folder, Artist, Album, Track, User
from .db import StarredFolder, StarredArtist, StarredAlbum, StarredTrack
from .db import RatingFolder, RatingTrack
# Hacking in support for a concatenation expression
class Concat(ComparableExpr):

View File

@ -18,16 +18,17 @@
# 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/>.
import time
import logging
import time
from logging.handlers import TimedRotatingFileHandler
from signal import signal, SIGTERM, SIGINT
from threading import Thread, Condition, Timer
from logging.handlers import TimedRotatingFileHandler
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
from supysonic import db
from supysonic.scanner import Scanner
from . import db
from .scanner import Scanner
OP_SCAN = 1
OP_REMOVE = 2

View File

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

View File

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