mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-20 16:03:59 +01:00
Fixes for Python 3.10
- deluge: b64encode returns bytes, transform into string before serializing to JSON. - deluge: no more need to try different encodings for the torrent filename or the base64-encoded content, should all be unicode strings with Python 3 - collections.abc: Iterable, Mapping, MutableMapping, MutableSequence moved from collections to collections.abc since Python 3.3 - pygazelle: html.parser.HTMLParser().unescape() moved to html.unescape() in Python 3.4
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from collections import Iterable, Mapping
|
||||
from collections.abc import Iterable, Mapping
|
||||
from uuid import uuid4
|
||||
|
||||
import six
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from collections import MutableMapping
|
||||
from collections.abc import MutableMapping
|
||||
from threading import RLock
|
||||
from datetime import datetime
|
||||
from logging import getLogger
|
||||
|
||||
@@ -32,7 +32,7 @@ __all__ = ["APEv2", "APEv2File", "Open", "delete"]
|
||||
|
||||
import sys
|
||||
import struct
|
||||
from collections import MutableSequence
|
||||
from collections.abc import MutableSequence
|
||||
|
||||
from ._compat import (cBytesIO, PY3, text_type, PY2, reraise, swap_to_string,
|
||||
xrange)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# Loosely based on the API implementation from 'whatbetter', by Zachary Denton
|
||||
# See https://github.com/zacharydenton/whatbetter
|
||||
from html.parser import HTMLParser
|
||||
import html
|
||||
|
||||
import sys
|
||||
import json
|
||||
@@ -219,10 +219,10 @@ class GazelleAPI(object):
|
||||
else:
|
||||
artist = Artist(id, self)
|
||||
if name:
|
||||
artist.name = HTMLParser().unescape(name)
|
||||
artist.name = html.unescape(name)
|
||||
elif name:
|
||||
artist = Artist(-1, self)
|
||||
artist.name = HTMLParser().unescape(name)
|
||||
artist.name = html.unescape(name)
|
||||
else:
|
||||
raise Exception("You must specify either an ID or a Name to get an artist.")
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from html.parser import HTMLParser
|
||||
import html
|
||||
|
||||
class InvalidArtistException(Exception):
|
||||
pass
|
||||
@@ -29,7 +29,7 @@ class Artist(object):
|
||||
if self.id > 0:
|
||||
response = self.parent_api.request(action='artist', id=self.id)
|
||||
elif self.name:
|
||||
self.name = HTMLParser().unescape(self.name)
|
||||
self.name = html.unescape(self.name)
|
||||
try:
|
||||
response = self.parent_api.request(action='artist', artistname=self.name)
|
||||
except Exception:
|
||||
@@ -47,7 +47,7 @@ class Artist(object):
|
||||
self.id = artist_json_response['id']
|
||||
self.parent_api.cached_artists[self.id] = self
|
||||
|
||||
self.name = HTMLParser().unescape(artist_json_response['name'])
|
||||
self.name = html.unescape(artist_json_response['name'])
|
||||
self.notifications_enabled = artist_json_response['notificationsEnabled']
|
||||
self.has_bookmarked = artist_json_response['hasBookmarked']
|
||||
self.image = artist_json_response['image']
|
||||
|
||||
Reference in New Issue
Block a user