mirror of
https://github.com/spl0k/supysonic.git
synced 2024-11-09 19:52:16 +00:00
Move all code into a package.
This commit is contained in:
parent
62e0ca69f4
commit
2eb65c33f3
10
cli.py
10
cli.py
@ -20,7 +20,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys, cmd, argparse, getpass, time
|
||||
import config
|
||||
from supysonic import config
|
||||
|
||||
class CLIParser(argparse.ArgumentParser):
|
||||
def error(self, message):
|
||||
@ -219,12 +219,12 @@ if __name__ == "__main__":
|
||||
if not config.check():
|
||||
sys.exit(1)
|
||||
|
||||
import db
|
||||
from supysonic import db
|
||||
db.init_db()
|
||||
|
||||
from managers.folder import FolderManager
|
||||
from managers.user import UserManager
|
||||
from scanner import Scanner
|
||||
from supysonic.managers.folder import FolderManager
|
||||
from supysonic.managers.user import UserManager
|
||||
from supysonic.scanner import Scanner
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
CLI().onecmd(' '.join(sys.argv[1:]))
|
||||
|
@ -22,7 +22,7 @@
|
||||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
from web import create_application
|
||||
from supysonic.web import create_application
|
||||
|
||||
app = create_application()
|
||||
if app:
|
||||
|
@ -20,7 +20,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from wsgiref.handlers import CGIHandler
|
||||
from web import create_application
|
||||
from supysonic.web import create_application
|
||||
|
||||
app = create_application()
|
||||
if app:
|
||||
|
@ -20,7 +20,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from flup.server.fcgi import WSGIServer
|
||||
from web import create_application
|
||||
from supysonic.web import create_application
|
||||
|
||||
app = create_application()
|
||||
if app:
|
||||
|
@ -21,6 +21,6 @@
|
||||
import sys
|
||||
sys.path.insert(0, '/path/to/the/supysonic/app')
|
||||
|
||||
from web import create_application
|
||||
from supysonic.web import create_application
|
||||
application = create_application()
|
||||
|
||||
|
0
supysonic/__init__.py
Normal file
0
supysonic/__init__.py
Normal file
@ -23,8 +23,8 @@ from xml.etree import ElementTree
|
||||
import simplejson
|
||||
import uuid
|
||||
|
||||
from web import app
|
||||
from managers.user import UserManager
|
||||
from supysonic.web import app
|
||||
from supysonic.managers.user import UserManager
|
||||
|
||||
@app.before_request
|
||||
def set_formatter():
|
@ -24,8 +24,8 @@ from sqlalchemy.orm import aliased
|
||||
import random
|
||||
import uuid
|
||||
|
||||
from web import app
|
||||
from db import *
|
||||
from supysonic.web import app
|
||||
from supysonic.db import *
|
||||
|
||||
@app.route('/rest/getRandomSongs.view', methods = [ 'GET', 'POST' ])
|
||||
def rand_songs():
|
@ -21,10 +21,10 @@
|
||||
import time
|
||||
import uuid
|
||||
from flask import request
|
||||
from web import app
|
||||
from supysonic.web import app
|
||||
from . import get_entity
|
||||
from lastfm import LastFm
|
||||
from db import *
|
||||
from supysonic.lastfm import LastFm
|
||||
from supysonic.db import *
|
||||
|
||||
@app.route('/rest/star.view', methods = [ 'GET', 'POST' ])
|
||||
def star():
|
@ -19,10 +19,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from flask import request
|
||||
from web import app
|
||||
from db import Folder, Artist, Album, Track
|
||||
from supysonic.web import app
|
||||
from supysonic.db import Folder, Artist, Album, Track
|
||||
from . import get_entity
|
||||
import uuid, time, string
|
||||
import uuid, string
|
||||
|
||||
@app.route('/rest/getMusicFolders.view', methods = [ 'GET', 'POST' ])
|
||||
def list_folders():
|
@ -19,8 +19,8 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from flask import request
|
||||
from web import app
|
||||
from db import ChatMessage, session
|
||||
from supysonic.web import app
|
||||
from supysonic.db import ChatMessage, session
|
||||
|
||||
@app.route('/rest/getChatMessages.view', methods = [ 'GET', 'POST' ])
|
||||
def get_chat():
|
@ -26,9 +26,9 @@ import subprocess
|
||||
import codecs
|
||||
from xml.etree import ElementTree
|
||||
|
||||
import config, scanner
|
||||
from web import app
|
||||
from db import Track, Album, Artist, Folder, User, ClientPrefs, now, session
|
||||
from supysonic import config, scanner
|
||||
from supysonic.web import app
|
||||
from supysonic.db import Track, Album, Artist, Folder, ClientPrefs, now, session
|
||||
from . import get_entity
|
||||
|
||||
from sqlalchemy import func
|
@ -21,8 +21,8 @@
|
||||
from flask import request
|
||||
from sqlalchemy import or_, func
|
||||
import uuid
|
||||
from web import app
|
||||
from db import Playlist, User, Track, session
|
||||
from supysonic.web import app
|
||||
from supysonic.db import Playlist, User, Track, session
|
||||
from . import get_entity
|
||||
|
||||
@app.route('/rest/getPlaylists.view', methods = [ 'GET', 'POST' ])
|
@ -19,8 +19,8 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from flask import request
|
||||
from web import app
|
||||
from db import Folder, Track, Artist, Album
|
||||
from supysonic.web import app
|
||||
from supysonic.db import Folder, Track, Artist, Album
|
||||
|
||||
@app.route('/rest/search.view', methods = [ 'GET', 'POST' ])
|
||||
def old_search():
|
@ -19,7 +19,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from flask import request
|
||||
from web import app
|
||||
from supysonic.web import app
|
||||
|
||||
@app.route('/rest/ping.view', methods = [ 'GET', 'POST' ])
|
||||
def ping():
|
@ -19,9 +19,9 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from flask import request
|
||||
from web import app
|
||||
from db import User
|
||||
from managers.user import UserManager
|
||||
from supysonic.web import app
|
||||
from supysonic.db import User
|
||||
from supysonic.managers.user import UserManager
|
||||
|
||||
@app.route('/rest/getUser.view', methods = [ 'GET', 'POST' ])
|
||||
def user_info():
|
@ -18,7 +18,7 @@
|
||||
# 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 config
|
||||
from supysonic import config
|
||||
|
||||
from sqlalchemy import create_engine, Table, Column, ForeignKey, func
|
||||
from sqlalchemy import Integer, String, Boolean, DateTime
|
||||
@ -75,6 +75,7 @@ class UUID(TypeDecorator):
|
||||
def now():
|
||||
return datetime.datetime.now().replace(microsecond = 0)
|
||||
|
||||
config.check()
|
||||
engine = create_engine(config.get('base', 'database_uri'), convert_unicode = True)
|
||||
session = scoped_session(sessionmaker(autocommit = False, autoflush = False, bind = engine))
|
||||
|
@ -18,8 +18,8 @@
|
||||
# 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 web import app
|
||||
from managers.user import UserManager
|
||||
from supysonic.web import app
|
||||
from supysonic.managers.user import UserManager
|
||||
|
||||
app.add_template_filter(str)
|
||||
|
@ -19,14 +19,13 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from flask import request, flash, render_template, redirect, url_for, session as fl_sess
|
||||
import os.path
|
||||
import uuid
|
||||
|
||||
from web import app
|
||||
from db import session, Folder
|
||||
from scanner import Scanner
|
||||
from managers.user import UserManager
|
||||
from managers.folder import FolderManager
|
||||
from supysonic.web import app
|
||||
from supysonic.db import session, Folder
|
||||
from supysonic.scanner import Scanner
|
||||
from supysonic.managers.user import UserManager
|
||||
from supysonic.managers.folder import FolderManager
|
||||
|
||||
@app.before_request
|
||||
def check_admin():
|
@ -20,8 +20,8 @@
|
||||
|
||||
from flask import request, session, flash, render_template, redirect, url_for
|
||||
import uuid
|
||||
from web import app
|
||||
import db
|
||||
from supysonic.web import app
|
||||
from supysonic import db
|
||||
|
||||
@app.route('/playlist')
|
||||
def playlist_index():
|
@ -20,12 +20,12 @@
|
||||
|
||||
from flask import request, session, flash, render_template, redirect, url_for, make_response
|
||||
|
||||
from web import app
|
||||
from managers.user import UserManager
|
||||
from db import User, ClientPrefs, session as db_sess
|
||||
from supysonic.web import app
|
||||
from supysonic.managers.user import UserManager
|
||||
from supysonic.db import User, ClientPrefs, session as db_sess
|
||||
import uuid, csv
|
||||
import config
|
||||
from lastfm import LastFm
|
||||
from supysonic import config
|
||||
from supysonic.lastfm import LastFm
|
||||
|
||||
@app.before_request
|
||||
def check_admin():
|
@ -19,8 +19,8 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import requests, hashlib
|
||||
import config
|
||||
from db import session
|
||||
from supysonic import config
|
||||
from supysonic.db import session
|
||||
|
||||
class LastFm:
|
||||
def __init__(self, user, logger):
|
@ -19,7 +19,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os.path, uuid
|
||||
from db import Folder, Artist, session
|
||||
from supysonic.db import Folder, Artist, session
|
||||
|
||||
class FolderManager:
|
||||
SUCCESS = 0
|
@ -21,7 +21,7 @@
|
||||
import string, random, hashlib
|
||||
import uuid
|
||||
|
||||
from db import User, session
|
||||
from supysonic.db import User, session
|
||||
|
||||
class UserManager:
|
||||
SUCCESS = 0
|
@ -21,7 +21,7 @@
|
||||
import os, os.path
|
||||
import time, mimetypes
|
||||
import mutagen
|
||||
import config, db
|
||||
from supysonic import config, db
|
||||
|
||||
def get_mime(ext):
|
||||
return mimetypes.guess_type('dummy.' + ext, False)[0] or config.get('mimetypes', ext) or 'application/octet-stream'
|
@ -19,9 +19,9 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os.path
|
||||
from flask import Flask, request, session, flash, render_template, redirect, url_for
|
||||
from flask import Flask
|
||||
|
||||
import config
|
||||
from supysonic import config, db
|
||||
|
||||
def teardown(exception):
|
||||
db.session.remove()
|
||||
@ -35,7 +35,6 @@ def create_application():
|
||||
if not os.path.exists(config.get('base', 'cache_dir')):
|
||||
os.makedirs(config.get('base', 'cache_dir'))
|
||||
|
||||
import db
|
||||
db.init_db()
|
||||
|
||||
app = Flask(__name__)
|
||||
@ -50,8 +49,8 @@ def create_application():
|
||||
|
||||
app.teardown_request(teardown)
|
||||
|
||||
import frontend
|
||||
import api
|
||||
from supysonic import frontend
|
||||
from supysonic import api
|
||||
|
||||
return app
|
||||
|
Loading…
Reference in New Issue
Block a user