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

Dropped 'future' dependency

This commit is contained in:
spl0k 2018-01-18 21:00:31 +01:00
parent fd67eb9cd4
commit bfe6da12d7
16 changed files with 34 additions and 30 deletions

View File

@ -50,7 +50,6 @@ To install it, run:
You'll need these to run Supysonic:
* Python 2.7
* [future](http://python-future.org/)
* [Flask](http://flask.pocoo.org/) >= 0.9
* [PonyORM](https://ponyorm.com/)
* [Python Imaging Library](https://github.com/python-pillow/Pillow)

View File

@ -1,5 +1,4 @@
flask>=0.9
future
pony
Pillow
simplejson

View File

@ -28,9 +28,7 @@ from xml.dom import minidom
from xml.etree import ElementTree
from ..managers.user import UserManager
from ..py23 import strtype
from builtins import dict
from ..py23 import dict, strtype
@app.before_request
def set_formatter():
@ -139,7 +137,7 @@ class ResponseHelper:
@staticmethod
def remove_empty_lists(d):
if not isinstance(d, dict):
raise TypeError('Expecting a dict')
raise TypeError('Expecting a dict got ' + type(d).__name__)
keys_to_remove = []
for key, value in d.items():

View File

@ -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 now
from builtins import dict
from ..py23 import dict
@app.route('/rest/getRandomSongs.view', methods = [ 'GET', 'POST' ])
def rand_songs():

View File

@ -29,11 +29,10 @@ from ..db import Track, Album, Artist, Folder, User
from ..db import StarredTrack, StarredAlbum, StarredArtist, StarredFolder
from ..db import RatingTrack, RatingFolder
from ..lastfm import LastFm
from ..py23 import dict
from . import get_entity
from builtins import dict
@db_session
def try_star(cls, starred_cls, eid):
""" Stars an entity

View File

@ -26,11 +26,10 @@ from pony.orm import db_session
from pony.orm import ObjectNotFound
from ..db import Folder, Artist, Album, Track
from ..py23 import dict
from . import get_entity
from builtins import dict
@app.route('/rest/getMusicFolders.view', methods = [ 'GET', 'POST' ])
@db_session
def list_folders():

View File

@ -22,8 +22,7 @@ from flask import request, current_app as app
from pony.orm import db_session
from ..db import ChatMessage, User
from builtins import dict
from ..py23 import dict
@app.route('/rest/getChatMessages.view', methods = [ 'GET', 'POST' ])
def get_chat():

View File

@ -31,11 +31,10 @@ from xml.etree import ElementTree
from .. import scanner
from ..db import Track, Album, Artist, Folder, User, ClientPrefs, now
from ..py23 import dict
from . import get_entity
from builtins import dict
def prepare_transcoding_cmdline(base_cmdline, input_file, input_format, output_format, output_bitrate):
if not base_cmdline:
return None

View File

@ -25,11 +25,10 @@ from pony.orm import db_session, rollback
from pony.orm import ObjectNotFound
from ..db import Playlist, User, Track
from ..py23 import dict
from . import get_entity
from builtins import dict
@app.route('/rest/getPlaylists.view', methods = [ 'GET', 'POST' ])
def list_playlists():
query = Playlist.select(lambda p: p.user.id == request.user.id or p.public).order_by(Playlist.name)

View File

@ -24,8 +24,7 @@ from flask import request, current_app as app
from pony.orm import db_session, select
from ..db import Folder, Track, Artist, Album
from builtins import dict
from ..py23 import dict
@app.route('/rest/search.view', methods = [ 'GET', 'POST' ])
def old_search():

View File

@ -20,7 +20,7 @@
from flask import request, current_app as app
from builtins import dict
from ..py23 import dict
@app.route('/rest/ping.view', methods = [ 'GET', 'POST' ])
def ping():

View File

@ -23,11 +23,10 @@ from pony.orm import db_session
from ..db import User
from ..managers.user import UserManager
from ..py23 import dict
from . import decode_password
from builtins import dict
@app.route('/rest/getUser.view', methods = [ 'GET', 'POST' ])
def user_info():
username = request.values.get('username')

View File

@ -28,9 +28,8 @@ from pony.orm import ObjectNotFound
from pony.orm import min, max, avg, sum
from uuid import UUID, uuid4
from .py23 import strtype
from .py23 import dict, strtype
from builtins import dict
try:
from urllib.parse import urlparse
except ImportError:

View File

@ -18,8 +18,6 @@
# 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 builtins import dict
from flask import request, session, flash, render_template, redirect, url_for, current_app as app
from functools import wraps
from pony.orm import db_session
@ -27,6 +25,7 @@ from pony.orm import db_session
from ..db import User, ClientPrefs
from ..lastfm import LastFm
from ..managers.user import UserManager
from ..py23 import dict
from . import admin_only

View File

@ -10,7 +10,26 @@
try:
# Python 2
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:
# Python 3
strtype = str
dict = dict

View File

@ -21,8 +21,6 @@
import logging
import time
from builtins import dict
from logging.handlers import TimedRotatingFileHandler
from pony.orm import db_session
from signal import signal, SIGTERM, SIGINT
@ -31,6 +29,7 @@ from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
from .db import init_database, release_database, Folder
from .py23 import dict
from .scanner import Scanner
OP_SCAN = 1