mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-23 01:16:18 +00:00
Dropped 'future' dependency
This commit is contained in:
parent
fd67eb9cd4
commit
bfe6da12d7
@ -50,7 +50,6 @@ To install it, run:
|
|||||||
You'll need these to run Supysonic:
|
You'll need these to run Supysonic:
|
||||||
|
|
||||||
* Python 2.7
|
* Python 2.7
|
||||||
* [future](http://python-future.org/)
|
|
||||||
* [Flask](http://flask.pocoo.org/) >= 0.9
|
* [Flask](http://flask.pocoo.org/) >= 0.9
|
||||||
* [PonyORM](https://ponyorm.com/)
|
* [PonyORM](https://ponyorm.com/)
|
||||||
* [Python Imaging Library](https://github.com/python-pillow/Pillow)
|
* [Python Imaging Library](https://github.com/python-pillow/Pillow)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
flask>=0.9
|
flask>=0.9
|
||||||
future
|
|
||||||
pony
|
pony
|
||||||
Pillow
|
Pillow
|
||||||
simplejson
|
simplejson
|
||||||
|
@ -28,9 +28,7 @@ from xml.dom import minidom
|
|||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
|
|
||||||
from ..managers.user import UserManager
|
from ..managers.user import UserManager
|
||||||
from ..py23 import strtype
|
from ..py23 import dict, strtype
|
||||||
|
|
||||||
from builtins import dict
|
|
||||||
|
|
||||||
@app.before_request
|
@app.before_request
|
||||||
def set_formatter():
|
def set_formatter():
|
||||||
@ -139,7 +137,7 @@ class ResponseHelper:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def remove_empty_lists(d):
|
def remove_empty_lists(d):
|
||||||
if not isinstance(d, dict):
|
if not isinstance(d, dict):
|
||||||
raise TypeError('Expecting a dict')
|
raise TypeError('Expecting a dict got ' + type(d).__name__)
|
||||||
|
|
||||||
keys_to_remove = []
|
keys_to_remove = []
|
||||||
for key, value in d.items():
|
for key, value in d.items():
|
||||||
|
@ -27,8 +27,7 @@ from pony.orm import db_session, select, desc, avg, max, min, count
|
|||||||
|
|
||||||
from ..db import Folder, Artist, Album, Track, RatingFolder, StarredFolder, StarredArtist, StarredAlbum, StarredTrack, User
|
from ..db import Folder, Artist, Album, Track, RatingFolder, StarredFolder, StarredArtist, StarredAlbum, StarredTrack, User
|
||||||
from ..db import now
|
from ..db import now
|
||||||
|
from ..py23 import dict
|
||||||
from builtins import dict
|
|
||||||
|
|
||||||
@app.route('/rest/getRandomSongs.view', methods = [ 'GET', 'POST' ])
|
@app.route('/rest/getRandomSongs.view', methods = [ 'GET', 'POST' ])
|
||||||
def rand_songs():
|
def rand_songs():
|
||||||
|
@ -29,11 +29,10 @@ from ..db import Track, Album, Artist, Folder, User
|
|||||||
from ..db import StarredTrack, StarredAlbum, StarredArtist, StarredFolder
|
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 ..py23 import dict
|
||||||
|
|
||||||
from . import get_entity
|
from . import get_entity
|
||||||
|
|
||||||
from builtins import dict
|
|
||||||
|
|
||||||
@db_session
|
@db_session
|
||||||
def try_star(cls, starred_cls, eid):
|
def try_star(cls, starred_cls, eid):
|
||||||
""" Stars an entity
|
""" Stars an entity
|
||||||
|
@ -26,11 +26,10 @@ from pony.orm import db_session
|
|||||||
from pony.orm import ObjectNotFound
|
from pony.orm import ObjectNotFound
|
||||||
|
|
||||||
from ..db import Folder, Artist, Album, Track
|
from ..db import Folder, Artist, Album, Track
|
||||||
|
from ..py23 import dict
|
||||||
|
|
||||||
from . import get_entity
|
from . import get_entity
|
||||||
|
|
||||||
from builtins import dict
|
|
||||||
|
|
||||||
@app.route('/rest/getMusicFolders.view', methods = [ 'GET', 'POST' ])
|
@app.route('/rest/getMusicFolders.view', methods = [ 'GET', 'POST' ])
|
||||||
@db_session
|
@db_session
|
||||||
def list_folders():
|
def list_folders():
|
||||||
|
@ -22,8 +22,7 @@ from flask import request, current_app as app
|
|||||||
from pony.orm import db_session
|
from pony.orm import db_session
|
||||||
|
|
||||||
from ..db import ChatMessage, User
|
from ..db import ChatMessage, User
|
||||||
|
from ..py23 import dict
|
||||||
from builtins import dict
|
|
||||||
|
|
||||||
@app.route('/rest/getChatMessages.view', methods = [ 'GET', 'POST' ])
|
@app.route('/rest/getChatMessages.view', methods = [ 'GET', 'POST' ])
|
||||||
def get_chat():
|
def get_chat():
|
||||||
|
@ -31,11 +31,10 @@ from xml.etree import ElementTree
|
|||||||
|
|
||||||
from .. import scanner
|
from .. import scanner
|
||||||
from ..db import Track, Album, Artist, Folder, User, ClientPrefs, now
|
from ..db import Track, Album, Artist, Folder, User, ClientPrefs, now
|
||||||
|
from ..py23 import dict
|
||||||
|
|
||||||
from . import get_entity
|
from . import get_entity
|
||||||
|
|
||||||
from builtins import dict
|
|
||||||
|
|
||||||
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):
|
||||||
if not base_cmdline:
|
if not base_cmdline:
|
||||||
return None
|
return None
|
||||||
|
@ -25,11 +25,10 @@ from pony.orm import db_session, rollback
|
|||||||
from pony.orm import ObjectNotFound
|
from pony.orm import ObjectNotFound
|
||||||
|
|
||||||
from ..db import Playlist, User, Track
|
from ..db import Playlist, User, Track
|
||||||
|
from ..py23 import dict
|
||||||
|
|
||||||
from . import get_entity
|
from . import get_entity
|
||||||
|
|
||||||
from builtins import dict
|
|
||||||
|
|
||||||
@app.route('/rest/getPlaylists.view', methods = [ 'GET', 'POST' ])
|
@app.route('/rest/getPlaylists.view', methods = [ 'GET', 'POST' ])
|
||||||
def list_playlists():
|
def list_playlists():
|
||||||
query = Playlist.select(lambda p: p.user.id == request.user.id or p.public).order_by(Playlist.name)
|
query = Playlist.select(lambda p: p.user.id == request.user.id or p.public).order_by(Playlist.name)
|
||||||
|
@ -24,8 +24,7 @@ from flask import request, current_app as app
|
|||||||
from pony.orm import db_session, select
|
from pony.orm import db_session, select
|
||||||
|
|
||||||
from ..db import Folder, Track, Artist, Album
|
from ..db import Folder, Track, Artist, Album
|
||||||
|
from ..py23 import dict
|
||||||
from builtins import dict
|
|
||||||
|
|
||||||
@app.route('/rest/search.view', methods = [ 'GET', 'POST' ])
|
@app.route('/rest/search.view', methods = [ 'GET', 'POST' ])
|
||||||
def old_search():
|
def old_search():
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
from flask import request, current_app as app
|
from flask import request, current_app as app
|
||||||
|
|
||||||
from builtins import dict
|
from ..py23 import dict
|
||||||
|
|
||||||
@app.route('/rest/ping.view', methods = [ 'GET', 'POST' ])
|
@app.route('/rest/ping.view', methods = [ 'GET', 'POST' ])
|
||||||
def ping():
|
def ping():
|
||||||
|
@ -23,11 +23,10 @@ from pony.orm import db_session
|
|||||||
|
|
||||||
from ..db import User
|
from ..db import User
|
||||||
from ..managers.user import UserManager
|
from ..managers.user import UserManager
|
||||||
|
from ..py23 import dict
|
||||||
|
|
||||||
from . import decode_password
|
from . import decode_password
|
||||||
|
|
||||||
from builtins import dict
|
|
||||||
|
|
||||||
@app.route('/rest/getUser.view', methods = [ 'GET', 'POST' ])
|
@app.route('/rest/getUser.view', methods = [ 'GET', 'POST' ])
|
||||||
def user_info():
|
def user_info():
|
||||||
username = request.values.get('username')
|
username = request.values.get('username')
|
||||||
|
@ -28,9 +28,8 @@ from pony.orm import ObjectNotFound
|
|||||||
from pony.orm import min, max, avg, sum
|
from pony.orm import min, max, avg, sum
|
||||||
from uuid import UUID, uuid4
|
from uuid import UUID, uuid4
|
||||||
|
|
||||||
from .py23 import strtype
|
from .py23 import dict, strtype
|
||||||
|
|
||||||
from builtins import dict
|
|
||||||
try:
|
try:
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
# 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 builtins import dict
|
|
||||||
|
|
||||||
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 pony.orm import db_session
|
from pony.orm import db_session
|
||||||
@ -27,6 +25,7 @@ from pony.orm import db_session
|
|||||||
from ..db import User, ClientPrefs
|
from ..db import User, ClientPrefs
|
||||||
from ..lastfm import LastFm
|
from ..lastfm import LastFm
|
||||||
from ..managers.user import UserManager
|
from ..managers.user import UserManager
|
||||||
|
from ..py23 import dict
|
||||||
|
|
||||||
from . import admin_only
|
from . import admin_only
|
||||||
|
|
||||||
|
@ -10,7 +10,26 @@
|
|||||||
try:
|
try:
|
||||||
# Python 2
|
# Python 2
|
||||||
strtype = basestring
|
strtype = basestring
|
||||||
|
|
||||||
|
_builtin_dict = dict
|
||||||
|
|
||||||
|
class DictMeta(type):
|
||||||
|
def __instancecheck__(cls, instance):
|
||||||
|
return isinstance(instance, _builtin_dict)
|
||||||
|
|
||||||
|
class dict(dict):
|
||||||
|
__metaclass__ = DictMeta
|
||||||
|
|
||||||
|
def keys(self):
|
||||||
|
return self.viewkeys()
|
||||||
|
|
||||||
|
def values(self):
|
||||||
|
return self.viewvalues()
|
||||||
|
|
||||||
|
def items(self):
|
||||||
|
return self.viewitems()
|
||||||
|
|
||||||
except NameError:
|
except NameError:
|
||||||
# Python 3
|
# Python 3
|
||||||
strtype = str
|
strtype = str
|
||||||
|
dict = dict
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from builtins import dict
|
|
||||||
|
|
||||||
from logging.handlers import TimedRotatingFileHandler
|
from logging.handlers import TimedRotatingFileHandler
|
||||||
from pony.orm import db_session
|
from pony.orm import db_session
|
||||||
from signal import signal, SIGTERM, SIGINT
|
from signal import signal, SIGTERM, SIGINT
|
||||||
@ -31,6 +29,7 @@ from watchdog.observers import Observer
|
|||||||
from watchdog.events import PatternMatchingEventHandler
|
from watchdog.events import PatternMatchingEventHandler
|
||||||
|
|
||||||
from .db import init_database, release_database, Folder
|
from .db import init_database, release_database, Folder
|
||||||
|
from .py23 import dict
|
||||||
from .scanner import Scanner
|
from .scanner import Scanner
|
||||||
|
|
||||||
OP_SCAN = 1
|
OP_SCAN = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user