mirror of
https://github.com/rembo10/headphones.git
synced 2026-09-09 16:22:52 +01:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1edc9cde0 | ||
|
|
ce98d0d6ca | ||
|
|
1bd7cc2ffd | ||
|
|
ad858576aa | ||
|
|
455b7d4940 | ||
|
|
cd14c3f4e2 | ||
|
|
2bacd5a0fc | ||
|
|
5a559c526d | ||
|
|
095cee9368 | ||
|
|
79cb133d1d | ||
|
|
0182be2f27 | ||
|
|
b6388f7daa |
@@ -0,0 +1,29 @@
|
|||||||
|
name: check
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [3.8, 3.9, 3.10]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -r requirements-dev.txt
|
||||||
|
- name: Lint with flake8
|
||||||
|
run: |
|
||||||
|
# stop the build if there are Python syntax errors or undefined names
|
||||||
|
flake8 .
|
||||||
|
- name: Test with nosetests
|
||||||
|
run: |
|
||||||
|
nosetests
|
||||||
-25
@@ -1,25 +0,0 @@
|
|||||||
# Travis CI configuration file
|
|
||||||
# http://about.travis-ci.org/docs/
|
|
||||||
|
|
||||||
language: python
|
|
||||||
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
cache:
|
|
||||||
pip: true
|
|
||||||
directories:
|
|
||||||
- lib
|
|
||||||
|
|
||||||
python:
|
|
||||||
- "2.7"
|
|
||||||
|
|
||||||
install:
|
|
||||||
- pip install -r requirements-dev.txt
|
|
||||||
|
|
||||||
script:
|
|
||||||
- pep8 headphones
|
|
||||||
- pyflakes headphones
|
|
||||||
- nosetests
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- if [[ $TRAVIS_PYTHON_VERSION == "2.7" ]]; then coveralls; fi
|
|
||||||
+15
-8
@@ -28,7 +28,7 @@ def getAlbumArt(albumid):
|
|||||||
|
|
||||||
# CAA
|
# CAA
|
||||||
logger.info("Searching for artwork at CAA")
|
logger.info("Searching for artwork at CAA")
|
||||||
artwork_path = 'http://coverartarchive.org/release-group/%s/front' % albumid
|
artwork_path = 'https://coverartarchive.org/release-group/%s/front' % albumid
|
||||||
artwork = getartwork(artwork_path)
|
artwork = getartwork(artwork_path)
|
||||||
if artwork:
|
if artwork:
|
||||||
logger.info("Artwork found at CAA")
|
logger.info("Artwork found at CAA")
|
||||||
@@ -41,7 +41,7 @@ def getAlbumArt(albumid):
|
|||||||
'SELECT ArtistName, AlbumTitle, ReleaseID, AlbumASIN FROM albums WHERE AlbumID=?',
|
'SELECT ArtistName, AlbumTitle, ReleaseID, AlbumASIN FROM albums WHERE AlbumID=?',
|
||||||
[albumid]).fetchone()
|
[albumid]).fetchone()
|
||||||
if dbalbum['AlbumASIN']:
|
if dbalbum['AlbumASIN']:
|
||||||
artwork_path = 'http://ec1.images-amazon.com/images/P/%s.01.LZZZZZZZ.jpg' % dbalbum['AlbumASIN']
|
artwork_path = 'https://ec1.images-amazon.com/images/P/%s.01.LZZZZZZZ.jpg' % dbalbum['AlbumASIN']
|
||||||
artwork = getartwork(artwork_path)
|
artwork = getartwork(artwork_path)
|
||||||
if artwork:
|
if artwork:
|
||||||
logger.info("Artwork found at Amazon")
|
logger.info("Artwork found at Amazon")
|
||||||
@@ -156,12 +156,19 @@ def getartwork(artwork_path):
|
|||||||
break
|
break
|
||||||
elif maxwidth and img_width > maxwidth:
|
elif maxwidth and img_width > maxwidth:
|
||||||
# Downsize using proxy service to max width
|
# Downsize using proxy service to max width
|
||||||
artwork_path = '{0}?{1}'.format('http://images.weserv.nl/', urlencode({
|
|
||||||
'url': artwork_path.replace('http://', ''),
|
|
||||||
'w': maxwidth,
|
|
||||||
}))
|
|
||||||
artwork = bytes()
|
artwork = bytes()
|
||||||
r = request.request_response(artwork_path, timeout=20, stream=True, whitelist_status_code=404)
|
url = "https://images.weserv.nl"
|
||||||
|
params = {
|
||||||
|
"url": artwork_path,
|
||||||
|
"w": maxwidth
|
||||||
|
}
|
||||||
|
r = request.request_response(
|
||||||
|
url,
|
||||||
|
params=params,
|
||||||
|
timeout=20,
|
||||||
|
stream=True,
|
||||||
|
whitelist_status_code=404
|
||||||
|
)
|
||||||
if r:
|
if r:
|
||||||
for chunk in r.iter_content(chunk_size=1024):
|
for chunk in r.iter_content(chunk_size=1024):
|
||||||
artwork += chunk
|
artwork += chunk
|
||||||
@@ -182,7 +189,7 @@ def getCachedArt(albumid):
|
|||||||
if not artwork_path:
|
if not artwork_path:
|
||||||
return
|
return
|
||||||
|
|
||||||
if artwork_path.startswith('http://'):
|
if artwork_path.startswith("http"):
|
||||||
artwork = request.request_content(artwork_path, timeout=20)
|
artwork = request.request_content(artwork_path, timeout=20)
|
||||||
|
|
||||||
if not artwork:
|
if not artwork:
|
||||||
|
|||||||
+6
-2
@@ -474,8 +474,12 @@ class Api(object):
|
|||||||
# Handle situations where the torrent url contains arguments that are
|
# Handle situations where the torrent url contains arguments that are
|
||||||
# parsed
|
# parsed
|
||||||
if kwargs:
|
if kwargs:
|
||||||
import urllib.request, urllib.parse, urllib.error
|
import urllib.request
|
||||||
import urllib.request, urllib.error, urllib.parse
|
import urllib.parse
|
||||||
|
import urllib.error
|
||||||
|
import urllib.request
|
||||||
|
import urllib.error
|
||||||
|
import urllib.parse
|
||||||
url = urllib.parse.quote(
|
url = urllib.parse.quote(
|
||||||
url, safe=":?/=&") + '&' + urllib.parse.urlencode(kwargs)
|
url, safe=":?/=&") + '&' + urllib.parse.urlencode(kwargs)
|
||||||
|
|
||||||
|
|||||||
+11
-6
@@ -540,12 +540,17 @@ class Cache(object):
|
|||||||
artwork_thumb = None
|
artwork_thumb = None
|
||||||
if 'fanart' in thumb_url:
|
if 'fanart' in thumb_url:
|
||||||
# Create thumb using image resizing service
|
# Create thumb using image resizing service
|
||||||
artwork_path = '{0}?{1}'.format('http://images.weserv.nl/', urlencode({
|
url = "https://images.weserv.nl"
|
||||||
'url': thumb_url.replace('http://', ''),
|
params = {
|
||||||
'w': 300,
|
"url": thumb_url,
|
||||||
}))
|
"w": 300
|
||||||
artwork_thumb = request.request_content(artwork_path, timeout=20, whitelist_status_code=404)
|
}
|
||||||
|
artwork_thumb = request.request_content(
|
||||||
|
url,
|
||||||
|
params=params,
|
||||||
|
timeout=20,
|
||||||
|
whitelist_status_code=404
|
||||||
|
)
|
||||||
if artwork_thumb:
|
if artwork_thumb:
|
||||||
with open(thumb_path, 'wb') as f:
|
with open(thumb_path, 'wb') as f:
|
||||||
f.write(artwork_thumb)
|
f.write(artwork_thumb)
|
||||||
|
|||||||
@@ -18,7 +18,9 @@
|
|||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
|
|
||||||
import urllib.request, urllib.parse, urllib.error
|
import urllib.request
|
||||||
|
import urllib.parse
|
||||||
|
import urllib.error
|
||||||
|
|
||||||
from .common import USER_AGENT
|
from .common import USER_AGENT
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class path(str):
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return 'headphones.config.path(%s)' % self
|
return 'headphones.config.path(%s)' % self
|
||||||
|
|
||||||
|
|
||||||
_CONFIG_DEFINITIONS = {
|
_CONFIG_DEFINITIONS = {
|
||||||
'ADD_ALBUM_ART': (int, 'General', 0),
|
'ADD_ALBUM_ART': (int, 'General', 0),
|
||||||
'ADVANCEDENCODER': (str, 'General', ''),
|
'ADVANCEDENCODER': (str, 'General', ''),
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
###################################
|
###################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|||||||
+1
-21
@@ -35,7 +35,6 @@
|
|||||||
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
|
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from headphones import logger
|
from headphones import logger
|
||||||
|
|
||||||
import time
|
import time
|
||||||
@@ -472,32 +471,13 @@ def _add_torrent_file(result):
|
|||||||
# content is torrent file contents that needs to be encoded to base64
|
# content is torrent file contents that needs to be encoded to base64
|
||||||
post_data = json.dumps({"method": "core.add_torrent_file",
|
post_data = json.dumps({"method": "core.add_torrent_file",
|
||||||
"params": [result['name'] + '.torrent',
|
"params": [result['name'] + '.torrent',
|
||||||
b64encode(result['content'].encode('utf8')), {}],
|
b64encode(result['content']).decode(), {}],
|
||||||
"id": 2})
|
"id": 2})
|
||||||
response = requests.post(delugeweb_url, data=post_data.encode('utf-8'), cookies=delugeweb_auth,
|
response = requests.post(delugeweb_url, data=post_data.encode('utf-8'), cookies=delugeweb_auth,
|
||||||
verify=deluge_verify_cert, headers=headers)
|
verify=deluge_verify_cert, headers=headers)
|
||||||
result['hash'] = json.loads(response.text)['result']
|
result['hash'] = json.loads(response.text)['result']
|
||||||
logger.debug('Deluge: Response was %s' % str(json.loads(response.text)))
|
logger.debug('Deluge: Response was %s' % str(json.loads(response.text)))
|
||||||
return json.loads(response.text)['result']
|
return json.loads(response.text)['result']
|
||||||
except UnicodeDecodeError:
|
|
||||||
try:
|
|
||||||
# content is torrent file contents that needs to be encoded to base64
|
|
||||||
# this time let's try leaving the encoding as is
|
|
||||||
logger.debug('Deluge: There was a decoding issue, let\'s try again')
|
|
||||||
post_data = json.dumps({"method": "core.add_torrent_file",
|
|
||||||
"params": [result['name'].decode('utf8') + '.torrent',
|
|
||||||
b64encode(result['content']), {}],
|
|
||||||
"id": 22})
|
|
||||||
response = requests.post(delugeweb_url, data=post_data.encode('utf-8'), cookies=delugeweb_auth,
|
|
||||||
verify=deluge_verify_cert, headers=headers)
|
|
||||||
result['hash'] = json.loads(response.text)['result']
|
|
||||||
logger.debug('Deluge: Response was %s' % str(json.loads(response.text)))
|
|
||||||
return json.loads(response.text)['result']
|
|
||||||
except Exception as e:
|
|
||||||
logger.error('Deluge: Adding torrent file failed after decode: %s' % str(e))
|
|
||||||
formatted_lines = traceback.format_exc().splitlines()
|
|
||||||
logger.error('; '.join(formatted_lines))
|
|
||||||
return False
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Deluge: Adding torrent file failed: %s' % str(e))
|
logger.error('Deluge: Adding torrent file failed: %s' % str(e))
|
||||||
formatted_lines = traceback.format_exc().splitlines()
|
formatted_lines = traceback.format_exc().splitlines()
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import functools
|
|||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
from mediafile import MediaFile, FileTypeError, UnreadableFileError
|
from mediafile import MediaFile, FileTypeError, UnreadableFileError
|
||||||
|
from unidecode import unidecode
|
||||||
import headphones
|
import headphones
|
||||||
|
|
||||||
|
|
||||||
@@ -41,6 +42,7 @@ RE_FEATURING = re.compile(r"[fF]t\.|[fF]eaturing|[fF]eat\.|\b[wW]ith\b|&|vs\.")
|
|||||||
RE_CD_ALBUM = re.compile(r"\(?((CD|disc)\s*[0-9]+)\)?", re.I)
|
RE_CD_ALBUM = re.compile(r"\(?((CD|disc)\s*[0-9]+)\)?", re.I)
|
||||||
RE_CD = re.compile(r"^(CD|dics)\s*[0-9]+$", re.I)
|
RE_CD = re.compile(r"^(CD|dics)\s*[0-9]+$", re.I)
|
||||||
|
|
||||||
|
|
||||||
def cmp(x, y):
|
def cmp(x, y):
|
||||||
"""
|
"""
|
||||||
Replacement for built-in function cmp that was removed in Python 3
|
Replacement for built-in function cmp that was removed in Python 3
|
||||||
@@ -53,6 +55,7 @@ def cmp(x, y):
|
|||||||
"""
|
"""
|
||||||
return (x > y) - (x < y)
|
return (x > y) - (x < y)
|
||||||
|
|
||||||
|
|
||||||
def multikeysort(items, columns):
|
def multikeysort(items, columns):
|
||||||
comparers = [
|
comparers = [
|
||||||
((itemgetter(col[1:].strip()), -1) if col.startswith('-') else (itemgetter(col.strip()), 1))
|
((itemgetter(col[1:].strip()), -1) if col.startswith('-') else (itemgetter(col.strip()), 1))
|
||||||
@@ -952,6 +955,8 @@ def sab_sanitize_foldername(name):
|
|||||||
if not name:
|
if not name:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
name = unidecode(name)
|
||||||
|
|
||||||
lst = []
|
lst = []
|
||||||
for ch in name.strip():
|
for ch in name.strip():
|
||||||
if ch in FL_ILLEGAL:
|
if ch in FL_ILLEGAL:
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ from headphones import db, logger, request
|
|||||||
|
|
||||||
TIMEOUT = 60.0 # seconds
|
TIMEOUT = 60.0 # seconds
|
||||||
REQUEST_LIMIT = 1.0 / 5 # seconds
|
REQUEST_LIMIT = 1.0 / 5 # seconds
|
||||||
ENTRY_POINT = "http://ws.audioscrobbler.com/2.0/"
|
ENTRY_POINT = "https://ws.audioscrobbler.com/2.0/"
|
||||||
API_KEY = "395e6ec6bb557382fc41fde867bce66f"
|
API_KEY = "395e6ec6bb557382fc41fde867bce66f"
|
||||||
|
|
||||||
# Required for API request limit
|
# Required for API request limit
|
||||||
|
|||||||
@@ -201,8 +201,6 @@ def libraryScan(dir=None, append=False, ArtistID=None, ArtistName=None,
|
|||||||
logger.info(f"Found {dbtracks_count} new/modified tracks in `{dir}`")
|
logger.info(f"Found {dbtracks_count} new/modified tracks in `{dir}`")
|
||||||
logger.info("Matching tracks to the appropriate releases....")
|
logger.info("Matching tracks to the appropriate releases....")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Sort the track_list by most vague (e.g. no trackid or releaseid)
|
# Sort the track_list by most vague (e.g. no trackid or releaseid)
|
||||||
# to most specific (both trackid & releaseid)
|
# to most specific (both trackid & releaseid)
|
||||||
# When we insert into the database, the tracks with the most
|
# When we insert into the database, the tracks with the most
|
||||||
@@ -210,7 +208,6 @@ def libraryScan(dir=None, append=False, ArtistID=None, ArtistName=None,
|
|||||||
|
|
||||||
sorted_dbtracks = helpers.multikeysort(dbtracks, ['ArtistName', 'AlbumTitle'])
|
sorted_dbtracks = helpers.multikeysort(dbtracks, ['ArtistName', 'AlbumTitle'])
|
||||||
|
|
||||||
|
|
||||||
# We'll use this to give a % completion, just because the
|
# We'll use this to give a % completion, just because the
|
||||||
# track matching might take a while
|
# track matching might take a while
|
||||||
tracks_completed = 0
|
tracks_completed = 0
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ def getLyrics(artist, song):
|
|||||||
"fmt": 'xml'
|
"fmt": 'xml'
|
||||||
}
|
}
|
||||||
|
|
||||||
url = 'http://lyrics.wikia.com/api.php'
|
url = 'https://lyrics.wikia.com/api.php'
|
||||||
data = request.request_minidom(url, params=params)
|
data = request.request_minidom(url, params=params)
|
||||||
|
|
||||||
if not data:
|
if not data:
|
||||||
|
|||||||
+7
-19
@@ -124,11 +124,7 @@ def findArtist(name, limit=1):
|
|||||||
'Cannot determine the best match from an artist/album search. Using top match instead')
|
'Cannot determine the best match from an artist/album search. Using top match instead')
|
||||||
artistlist.append({
|
artistlist.append({
|
||||||
# Just need the artist id if the limit is 1
|
# Just need the artist id if the limit is 1
|
||||||
# 'name': unicode(result['sort-name']),
|
|
||||||
# 'uniquename': uniquename,
|
|
||||||
'id': str(result['id']),
|
'id': str(result['id']),
|
||||||
# 'url': unicode("http://musicbrainz.org/artist/" + result['id']),#probably needs to be changed
|
|
||||||
# 'score': int(result['ext:score'])
|
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
artistlist.append(artistdict)
|
artistlist.append(artistdict)
|
||||||
@@ -137,7 +133,7 @@ def findArtist(name, limit=1):
|
|||||||
'name': str(result['sort-name']),
|
'name': str(result['sort-name']),
|
||||||
'uniquename': uniquename,
|
'uniquename': uniquename,
|
||||||
'id': str(result['id']),
|
'id': str(result['id']),
|
||||||
'url': str("http://musicbrainz.org/artist/" + result['id']),
|
'url': str("https://musicbrainz.org/artist/" + result['id']),
|
||||||
# probably needs to be changed
|
# probably needs to be changed
|
||||||
'score': int(result['ext:score'])
|
'score': int(result['ext:score'])
|
||||||
})
|
})
|
||||||
@@ -208,9 +204,9 @@ def findRelease(name, limit=1, artist=None):
|
|||||||
'id': str(result['artist-credit'][0]['artist']['id']),
|
'id': str(result['artist-credit'][0]['artist']['id']),
|
||||||
'albumid': str(result['id']),
|
'albumid': str(result['id']),
|
||||||
'url': str(
|
'url': str(
|
||||||
"http://musicbrainz.org/artist/" + result['artist-credit'][0]['artist']['id']),
|
"https://musicbrainz.org/artist/" + result['artist-credit'][0]['artist']['id']),
|
||||||
# probably needs to be changed
|
# probably needs to be changed
|
||||||
'albumurl': str("http://musicbrainz.org/release/" + result['id']),
|
'albumurl': str("https://musicbrainz.org/release/" + result['id']),
|
||||||
# probably needs to be changed
|
# probably needs to be changed
|
||||||
'score': int(result['ext:score']),
|
'score': int(result['ext:score']),
|
||||||
'date': str(result['date']) if 'date' in result else '',
|
'date': str(result['date']) if 'date' in result else '',
|
||||||
@@ -248,7 +244,7 @@ def findSeries(name, limit=1):
|
|||||||
'name': str(result['name']),
|
'name': str(result['name']),
|
||||||
'type': str(result['type']),
|
'type': str(result['type']),
|
||||||
'id': str(result['id']),
|
'id': str(result['id']),
|
||||||
'url': str("http://musicbrainz.org/series/" + result['id']),
|
'url': str("https://musicbrainz.org/series/" + result['id']),
|
||||||
# probably needs to be changed
|
# probably needs to be changed
|
||||||
'score': int(result['ext:score'])
|
'score': int(result['ext:score'])
|
||||||
})
|
})
|
||||||
@@ -295,7 +291,7 @@ def getArtist(artistid, extrasonly=False):
|
|||||||
releasegroups.append({
|
releasegroups.append({
|
||||||
'title': str(rg['title']),
|
'title': str(rg['title']),
|
||||||
'id': str(rg['id']),
|
'id': str(rg['id']),
|
||||||
'url': "http://musicbrainz.org/release-group/" + rg['id'],
|
'url': "https://musicbrainz.org/release-group/" + rg['id'],
|
||||||
'type': str(rg['type'])
|
'type': str(rg['type'])
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -356,7 +352,7 @@ def getArtist(artistid, extrasonly=False):
|
|||||||
releasegroups.append({
|
releasegroups.append({
|
||||||
'title': str(rg['title']),
|
'title': str(rg['title']),
|
||||||
'id': str(rg['id']),
|
'id': str(rg['id']),
|
||||||
'url': "http://musicbrainz.org/release-group/" + rg['id'],
|
'url': "https://musicbrainz.org/release-group/" + rg['id'],
|
||||||
'type': str(rg_type)
|
'type': str(rg_type)
|
||||||
})
|
})
|
||||||
artist_dict['releasegroups'] = releasegroups
|
artist_dict['releasegroups'] = releasegroups
|
||||||
@@ -691,7 +687,7 @@ def getTracksFromRelease(release):
|
|||||||
'number': totalTracks,
|
'number': totalTracks,
|
||||||
'title': track_title,
|
'title': track_title,
|
||||||
'id': str(track['recording']['id']),
|
'id': str(track['recording']['id']),
|
||||||
'url': "http://musicbrainz.org/track/" + track['recording']['id'],
|
'url': "https://musicbrainz.org/track/" + track['recording']['id'],
|
||||||
'duration': int(track['length']) if 'length' in track else 0
|
'duration': int(track['length']) if 'length' in track else 0
|
||||||
})
|
})
|
||||||
totalTracks += 1
|
totalTracks += 1
|
||||||
@@ -733,15 +729,7 @@ def findArtistbyAlbum(name):
|
|||||||
for releaseGroup in results:
|
for releaseGroup in results:
|
||||||
newArtist = releaseGroup['artist-credit'][0]['artist']
|
newArtist = releaseGroup['artist-credit'][0]['artist']
|
||||||
# Only need the artist ID if we're doing an artist+album lookup
|
# Only need the artist ID if we're doing an artist+album lookup
|
||||||
# if 'disambiguation' in newArtist:
|
|
||||||
# uniquename = unicode(newArtist['sort-name'] + " (" + newArtist['disambiguation'] + ")")
|
|
||||||
# else:
|
|
||||||
# uniquename = unicode(newArtist['sort-name'])
|
|
||||||
# artist_dict['name'] = unicode(newArtist['sort-name'])
|
|
||||||
# artist_dict['uniquename'] = uniquename
|
|
||||||
artist_dict['id'] = str(newArtist['id'])
|
artist_dict['id'] = str(newArtist['id'])
|
||||||
# artist_dict['url'] = u'http://musicbrainz.org/artist/' + newArtist['id']
|
|
||||||
# artist_dict['score'] = int(releaseGroup['ext:score'])
|
|
||||||
|
|
||||||
return artist_dict
|
return artist_dict
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class MetadataDict(dict):
|
|||||||
lowercase) in member variable self._lower. If case-sensitive lookup
|
lowercase) in member variable self._lower. If case-sensitive lookup
|
||||||
fails, another case-insensitive attempt is made.
|
fails, another case-insensitive attempt is made.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
super(MetadataDict, self).__setitem__(key, value)
|
super(MetadataDict, self).__setitem__(key, value)
|
||||||
self._lower.__setitem__(key.lower(), value)
|
self._lower.__setitem__(key.lower(), value)
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
from urllib.parse import urlencode, quote_plus
|
from urllib.parse import urlencode, quote_plus
|
||||||
import urllib.request, urllib.parse, urllib.error
|
import urllib.request
|
||||||
|
import urllib.parse
|
||||||
|
import urllib.error
|
||||||
import subprocess
|
import subprocess
|
||||||
import json
|
import json
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
@@ -7,7 +9,9 @@ import smtplib
|
|||||||
import email.utils
|
import email.utils
|
||||||
from http.client import HTTPSConnection
|
from http.client import HTTPSConnection
|
||||||
from urllib.parse import parse_qsl
|
from urllib.parse import parse_qsl
|
||||||
import urllib.request, urllib.error, urllib.parse
|
import urllib.request
|
||||||
|
import urllib.error
|
||||||
|
import urllib.parse
|
||||||
import requests as requests
|
import requests as requests
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
@@ -920,7 +924,7 @@ class BOXCAR(object):
|
|||||||
def notify(self, title, message, rgid=None):
|
def notify(self, title, message, rgid=None):
|
||||||
try:
|
try:
|
||||||
if rgid:
|
if rgid:
|
||||||
message += '<br></br><a href="http://musicbrainz.org/' \
|
message += '<br></br><a href="https://musicbrainz.org/' \
|
||||||
'release-group/%s">MusicBrainz</a>' % rgid
|
'release-group/%s">MusicBrainz</a>' % rgid
|
||||||
|
|
||||||
data = urllib.parse.urlencode({
|
data = urllib.parse.urlencode({
|
||||||
@@ -1019,7 +1023,7 @@ class TELEGRAM(object):
|
|||||||
|
|
||||||
# MusicBrainz link
|
# MusicBrainz link
|
||||||
if rgid:
|
if rgid:
|
||||||
message += '\n\n <a href="http://musicbrainz.org/' \
|
message += '\n\n <a href="https://musicbrainz.org/' \
|
||||||
'release-group/%s">MusicBrainz</a>' % rgid
|
'release-group/%s">MusicBrainz</a>' % rgid
|
||||||
|
|
||||||
# Send image
|
# Send image
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ __author__ = "Andrzej Ciarkowski <andrzej.ciarkowski@gmail.com>"
|
|||||||
|
|
||||||
class _PatternElement(object):
|
class _PatternElement(object):
|
||||||
'''ABC for hierarchy of path name renderer pattern elements.'''
|
'''ABC for hierarchy of path name renderer pattern elements.'''
|
||||||
|
|
||||||
def render(self, replacement):
|
def render(self, replacement):
|
||||||
# type: (Mapping[str,str]) -> str
|
# type: (Mapping[str,str]) -> str
|
||||||
'''Format this _PatternElement into string using provided substitution dictionary.'''
|
'''Format this _PatternElement into string using provided substitution dictionary.'''
|
||||||
@@ -55,6 +56,7 @@ class _Generator(_PatternElement):
|
|||||||
|
|
||||||
class _Replacement(_Generator):
|
class _Replacement(_Generator):
|
||||||
'''Replacement variable, eg. $title.'''
|
'''Replacement variable, eg. $title.'''
|
||||||
|
|
||||||
def __init__(self, pattern):
|
def __init__(self, pattern):
|
||||||
# type: (str)
|
# type: (str)
|
||||||
self._pattern = pattern
|
self._pattern = pattern
|
||||||
@@ -81,6 +83,7 @@ class _Replacement(_Generator):
|
|||||||
|
|
||||||
class _LiteralText(_PatternElement):
|
class _LiteralText(_PatternElement):
|
||||||
'''Just a plain piece of text to be rendered "as is".'''
|
'''Just a plain piece of text to be rendered "as is".'''
|
||||||
|
|
||||||
def __init__(self, text):
|
def __init__(self, text):
|
||||||
# type: (str)
|
# type: (str)
|
||||||
self._text = text
|
self._text = text
|
||||||
|
|||||||
@@ -342,6 +342,7 @@ def verify(albumid, albumpath, Kind=None, forced=False, keep_original_folder=Fal
|
|||||||
logger.warn(f"Could not identify {albumpath}. It may not be the intended album")
|
logger.warn(f"Could not identify {albumpath}. It may not be the intended album")
|
||||||
markAsUnprocessed(albumid, albumpath, keep_original_folder)
|
markAsUnprocessed(albumid, albumpath, keep_original_folder)
|
||||||
|
|
||||||
|
|
||||||
def markAsUnprocessed(albumid, albumpath, keep_original_folder=False):
|
def markAsUnprocessed(albumid, albumpath, keep_original_folder=False):
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
myDB.action(
|
myDB.action(
|
||||||
@@ -595,7 +596,7 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list,
|
|||||||
logger.info("Twitter notifications temporarily disabled")
|
logger.info("Twitter notifications temporarily disabled")
|
||||||
#logger.info("Sending Twitter notification")
|
#logger.info("Sending Twitter notification")
|
||||||
#twitter = notifiers.TwitterNotifier()
|
#twitter = notifiers.TwitterNotifier()
|
||||||
#twitter.notify_download(pushmessage)
|
# twitter.notify_download(pushmessage)
|
||||||
|
|
||||||
if headphones.CONFIG.OSX_NOTIFY_ENABLED:
|
if headphones.CONFIG.OSX_NOTIFY_ENABLED:
|
||||||
from headphones import cache
|
from headphones import cache
|
||||||
@@ -1135,6 +1136,7 @@ def updateFilePermissions(albumpaths):
|
|||||||
logger.error(f"Could not change permissions for `{full_path}`")
|
logger.error(f"Could not change permissions for `{full_path}`")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
def renameUnprocessedFolder(path, tag):
|
def renameUnprocessedFolder(path, tag):
|
||||||
"""
|
"""
|
||||||
Rename a unprocessed folder to a new unique name to indicate a certain
|
Rename a unprocessed folder to a new unique name to indicate a certain
|
||||||
|
|||||||
@@ -13,8 +13,12 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Headphones. If not, see <http://www.gnu.org/licenses/>.
|
# along with Headphones. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import urllib.request, urllib.parse, urllib.error
|
import urllib.request
|
||||||
import urllib.request, urllib.error, urllib.parse
|
import urllib.parse
|
||||||
|
import urllib.error
|
||||||
|
import urllib.request
|
||||||
|
import urllib.error
|
||||||
|
import urllib.parse
|
||||||
import http.cookiejar
|
import http.cookiejar
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import urllib.request, urllib.parse, urllib.error
|
import urllib.request
|
||||||
|
import urllib.parse
|
||||||
|
import urllib.error
|
||||||
import time
|
import time
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import re
|
import re
|
||||||
@@ -19,13 +21,13 @@ class Rutracker(object):
|
|||||||
self.timeout = 60
|
self.timeout = 60
|
||||||
self.loggedin = False
|
self.loggedin = False
|
||||||
self.maxsize = 0
|
self.maxsize = 0
|
||||||
self.search_referer = 'http://rutracker.org/forum/tracker.php'
|
self.search_referer = 'https://rutracker.org/forum/tracker.php'
|
||||||
|
|
||||||
def logged_in(self):
|
def logged_in(self):
|
||||||
return self.loggedin
|
return self.loggedin
|
||||||
|
|
||||||
def still_logged_in(self, html):
|
def still_logged_in(self, html):
|
||||||
if not html or "action=\"http://rutracker.org/forum/login.php\">" in html:
|
if not html or "action=\"https://rutracker.org/forum/login.php\">" in html:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
@@ -35,7 +37,7 @@ class Rutracker(object):
|
|||||||
Logs in user
|
Logs in user
|
||||||
"""
|
"""
|
||||||
|
|
||||||
loginpage = 'http://rutracker.org/forum/login.php'
|
loginpage = 'https://rutracker.org/forum/login.php'
|
||||||
post_params = {
|
post_params = {
|
||||||
'login_username': headphones.CONFIG.RUTRACKER_USER,
|
'login_username': headphones.CONFIG.RUTRACKER_USER,
|
||||||
'login_password': headphones.CONFIG.RUTRACKER_PASSWORD,
|
'login_password': headphones.CONFIG.RUTRACKER_PASSWORD,
|
||||||
@@ -159,7 +161,7 @@ class Rutracker(object):
|
|||||||
# Torrent topic page
|
# Torrent topic page
|
||||||
torrent_id = dict([part.split('=') for part in urlparse(url)[4].split('&')])[
|
torrent_id = dict([part.split('=') for part in urlparse(url)[4].split('&')])[
|
||||||
't']
|
't']
|
||||||
topicurl = 'http://rutracker.org/forum/viewtopic.php?t=' + torrent_id
|
topicurl = 'https://rutracker.org/forum/viewtopic.php?t=' + torrent_id
|
||||||
rulist.append((title, size, topicurl, 'rutracker.org', 'torrent', True))
|
rulist.append((title, size, topicurl, 'rutracker.org', 'torrent', True))
|
||||||
else:
|
else:
|
||||||
logger.info("%s is larger than the maxsize or has too little seeders for this category, "
|
logger.info("%s is larger than the maxsize or has too little seeders for this category, "
|
||||||
@@ -179,7 +181,7 @@ class Rutracker(object):
|
|||||||
return the .torrent data
|
return the .torrent data
|
||||||
"""
|
"""
|
||||||
torrent_id = dict([part.split('=') for part in urlparse(url)[4].split('&')])['t']
|
torrent_id = dict([part.split('=') for part in urlparse(url)[4].split('&')])['t']
|
||||||
downloadurl = 'http://rutracker.org/forum/dl.php?t=' + torrent_id
|
downloadurl = 'https://rutracker.org/forum/dl.php?t=' + torrent_id
|
||||||
cookie = {'bb_dl': torrent_id}
|
cookie = {'bb_dl': torrent_id}
|
||||||
try:
|
try:
|
||||||
headers = {'Referer': url}
|
headers = {'Referer': url}
|
||||||
|
|||||||
+10
-8
@@ -19,7 +19,9 @@ from base64 import b16encode, b32decode
|
|||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
import string
|
import string
|
||||||
import random
|
import random
|
||||||
import urllib.request, urllib.parse, urllib.error
|
import urllib.request
|
||||||
|
import urllib.parse
|
||||||
|
import urllib.error
|
||||||
import datetime
|
import datetime
|
||||||
import subprocess
|
import subprocess
|
||||||
import unicodedata
|
import unicodedata
|
||||||
@@ -40,7 +42,7 @@ from bencode import decode as bdecode
|
|||||||
|
|
||||||
# Magnet to torrent services, for Black hole. Stolen from CouchPotato.
|
# Magnet to torrent services, for Black hole. Stolen from CouchPotato.
|
||||||
TORRENT_TO_MAGNET_SERVICES = [
|
TORRENT_TO_MAGNET_SERVICES = [
|
||||||
'http://itorrents.org/torrent/%s.torrent',
|
'https://itorrents.org/torrent/%s.torrent',
|
||||||
'https://cache.torrentgalaxy.org/get/%s',
|
'https://cache.torrentgalaxy.org/get/%s',
|
||||||
'https://www.seedpeer.me/torrent/%s'
|
'https://www.seedpeer.me/torrent/%s'
|
||||||
]
|
]
|
||||||
@@ -611,7 +613,7 @@ def searchNZB(album, new=False, losslessOnly=False, albumlength=None,
|
|||||||
provider = newznab_host[0]
|
provider = newznab_host[0]
|
||||||
|
|
||||||
# Add a little mod for kere.ws
|
# Add a little mod for kere.ws
|
||||||
if newznab_host[0] == "http://kere.ws":
|
if newznab_host[0] == "https://kere.ws":
|
||||||
if categories == "3040":
|
if categories == "3040":
|
||||||
categories = categories + ",4070"
|
categories = categories + ",4070"
|
||||||
elif categories == "3040,3010":
|
elif categories == "3040,3010":
|
||||||
@@ -682,7 +684,7 @@ def searchNZB(album, new=False, losslessOnly=False, albumlength=None,
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = request.request_feed(
|
data = request.request_feed(
|
||||||
url='http://beta.nzbs.org/api',
|
url='https://beta.nzbs.org/api',
|
||||||
params=params, headers=headers,
|
params=params, headers=headers,
|
||||||
timeout=5
|
timeout=5
|
||||||
)
|
)
|
||||||
@@ -731,7 +733,7 @@ def searchNZB(album, new=False, losslessOnly=False, albumlength=None,
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = request.request_json(
|
data = request.request_json(
|
||||||
url='http://api.omgwtfnzbs.me/json/',
|
url='https://api.omgwtfnzbs.me/json/',
|
||||||
params=params, headers=headers
|
params=params, headers=headers
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1081,7 +1083,7 @@ def send_to_downloader(data, bestqual, album):
|
|||||||
logger.info("Twitter notifications temporarily disabled")
|
logger.info("Twitter notifications temporarily disabled")
|
||||||
#logger.info("Sending Twitter notification")
|
#logger.info("Sending Twitter notification")
|
||||||
#twitter = notifiers.TwitterNotifier()
|
#twitter = notifiers.TwitterNotifier()
|
||||||
#twitter.notify_snatch(name)
|
# twitter.notify_snatch(name)
|
||||||
if headphones.CONFIG.NMA_ENABLED and headphones.CONFIG.NMA_ONSNATCH:
|
if headphones.CONFIG.NMA_ENABLED and headphones.CONFIG.NMA_ONSNATCH:
|
||||||
logger.info("Sending NMA notification")
|
logger.info("Sending NMA notification")
|
||||||
nma = notifiers.NMA()
|
nma = notifiers.NMA()
|
||||||
@@ -1261,7 +1263,7 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None,
|
|||||||
|
|
||||||
def set_proxy(proxy_url):
|
def set_proxy(proxy_url):
|
||||||
if not proxy_url.startswith('http'):
|
if not proxy_url.startswith('http'):
|
||||||
proxy_url = 'http://' + proxy_url
|
proxy_url = 'https://' + proxy_url
|
||||||
if proxy_url.endswith('/'):
|
if proxy_url.endswith('/'):
|
||||||
proxy_url = proxy_url[:-1]
|
proxy_url = proxy_url[:-1]
|
||||||
|
|
||||||
@@ -1467,7 +1469,7 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None,
|
|||||||
|
|
||||||
if headphones.CONFIG.ORPHEUS:
|
if headphones.CONFIG.ORPHEUS:
|
||||||
provider = "Orpheus.network"
|
provider = "Orpheus.network"
|
||||||
providerurl = "http://orpheus.network/"
|
providerurl = "https://orpheus.network/"
|
||||||
|
|
||||||
bitrate = None
|
bitrate = None
|
||||||
bitrate_string = bitrate
|
bitrate_string = bitrate
|
||||||
|
|||||||
@@ -13,11 +13,15 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Headphones. If not, see <http://www.gnu.org/licenses/>.
|
# along with Headphones. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import urllib.request, urllib.parse, urllib.error
|
import urllib.request
|
||||||
|
import urllib.parse
|
||||||
|
import urllib.error
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import urllib.request, urllib.error, urllib.parse
|
import urllib.request
|
||||||
|
import urllib.error
|
||||||
|
import urllib.parse
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import http.cookiejar
|
import http.cookiejar
|
||||||
|
|
||||||
|
|||||||
+10
-6
@@ -19,12 +19,16 @@ from operator import itemgetter
|
|||||||
import threading
|
import threading
|
||||||
import secrets
|
import secrets
|
||||||
import random
|
import random
|
||||||
import urllib.request, urllib.parse, urllib.error
|
import urllib.request
|
||||||
|
import urllib.parse
|
||||||
|
import urllib.error
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
from html import escape as html_escape
|
from html import escape as html_escape
|
||||||
import urllib.request, urllib.error, urllib.parse
|
import urllib.request
|
||||||
|
import urllib.error
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@@ -1677,16 +1681,16 @@ class WebInterface(object):
|
|||||||
|
|
||||||
# Return the Cover Art Archive urls if not found on last.fm
|
# Return the Cover Art Archive urls if not found on last.fm
|
||||||
if AlbumID and not image_dict:
|
if AlbumID and not image_dict:
|
||||||
image_url = "http://coverartarchive.org/release/%s/front-500.jpg" % AlbumID
|
image_url = "https://coverartarchive.org/release/%s/front-500.jpg" % AlbumID
|
||||||
thumb_url = "http://coverartarchive.org/release/%s/front-250.jpg" % AlbumID
|
thumb_url = "https://coverartarchive.org/release/%s/front-250.jpg" % AlbumID
|
||||||
image_dict = {'artwork': image_url, 'thumbnail': thumb_url}
|
image_dict = {'artwork': image_url, 'thumbnail': thumb_url}
|
||||||
elif AlbumID and (not image_dict['artwork'] or not image_dict['thumbnail']):
|
elif AlbumID and (not image_dict['artwork'] or not image_dict['thumbnail']):
|
||||||
if not image_dict['artwork']:
|
if not image_dict['artwork']:
|
||||||
image_dict[
|
image_dict[
|
||||||
'artwork'] = "http://coverartarchive.org/release/%s/front-500.jpg" % AlbumID
|
'artwork'] = "https://coverartarchive.org/release/%s/front-500.jpg" % AlbumID
|
||||||
if not image_dict['thumbnail']:
|
if not image_dict['thumbnail']:
|
||||||
image_dict[
|
image_dict[
|
||||||
'thumbnail'] = "http://coverartarchive.org/release/%s/front-250.jpg" % AlbumID
|
'thumbnail'] = "https://coverartarchive.org/release/%s/front-250.jpg" % AlbumID
|
||||||
|
|
||||||
return image_dict
|
return image_dict
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from collections import Iterable, Mapping
|
from collections.abc import Iterable, Mapping
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
from collections import MutableMapping
|
from collections.abc import MutableMapping
|
||||||
from threading import RLock
|
from threading import RLock
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ __all__ = ["APEv2", "APEv2File", "Open", "delete"]
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import struct
|
import struct
|
||||||
from collections import MutableSequence
|
from collections.abc import MutableSequence
|
||||||
|
|
||||||
from ._compat import (cBytesIO, PY3, text_type, PY2, reraise, swap_to_string,
|
from ._compat import (cBytesIO, PY3, text_type, PY2, reraise, swap_to_string,
|
||||||
xrange)
|
xrange)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# Loosely based on the API implementation from 'whatbetter', by Zachary Denton
|
# Loosely based on the API implementation from 'whatbetter', by Zachary Denton
|
||||||
# See https://github.com/zacharydenton/whatbetter
|
# See https://github.com/zacharydenton/whatbetter
|
||||||
from html.parser import HTMLParser
|
import html
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
@@ -219,10 +219,10 @@ class GazelleAPI(object):
|
|||||||
else:
|
else:
|
||||||
artist = Artist(id, self)
|
artist = Artist(id, self)
|
||||||
if name:
|
if name:
|
||||||
artist.name = HTMLParser().unescape(name)
|
artist.name = html.unescape(name)
|
||||||
elif name:
|
elif name:
|
||||||
artist = Artist(-1, self)
|
artist = Artist(-1, self)
|
||||||
artist.name = HTMLParser().unescape(name)
|
artist.name = html.unescape(name)
|
||||||
else:
|
else:
|
||||||
raise Exception("You must specify either an ID or a Name to get an artist.")
|
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):
|
class InvalidArtistException(Exception):
|
||||||
pass
|
pass
|
||||||
@@ -29,7 +29,7 @@ class Artist(object):
|
|||||||
if self.id > 0:
|
if self.id > 0:
|
||||||
response = self.parent_api.request(action='artist', id=self.id)
|
response = self.parent_api.request(action='artist', id=self.id)
|
||||||
elif self.name:
|
elif self.name:
|
||||||
self.name = HTMLParser().unescape(self.name)
|
self.name = html.unescape(self.name)
|
||||||
try:
|
try:
|
||||||
response = self.parent_api.request(action='artist', artistname=self.name)
|
response = self.parent_api.request(action='artist', artistname=self.name)
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -47,7 +47,7 @@ class Artist(object):
|
|||||||
self.id = artist_json_response['id']
|
self.id = artist_json_response['id']
|
||||||
self.parent_api.cached_artists[self.id] = self
|
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.notifications_enabled = artist_json_response['notificationsEnabled']
|
||||||
self.has_bookmarked = artist_json_response['hasBookmarked']
|
self.has_bookmarked = artist_json_response['hasBookmarked']
|
||||||
self.image = artist_json_response['image']
|
self.image = artist_json_response['image']
|
||||||
|
|||||||
@@ -1,284 +0,0 @@
|
|||||||
[MASTER]
|
|
||||||
|
|
||||||
# Specify a configuration file.
|
|
||||||
#rcfile=
|
|
||||||
|
|
||||||
# Python code to execute, usually for sys.path manipulation such as
|
|
||||||
# pygtk.require().
|
|
||||||
init-hook=sys.path.insert(0, 'lib/')
|
|
||||||
|
|
||||||
# Profiled execution.
|
|
||||||
profile=no
|
|
||||||
|
|
||||||
# Add files or directories to the blacklist. They should be base names, not
|
|
||||||
# paths.
|
|
||||||
ignore=CVS
|
|
||||||
|
|
||||||
# Pickle collected data for later comparisons.
|
|
||||||
persistent=yes
|
|
||||||
|
|
||||||
# List of plugins (as comma separated values of python modules names) to load,
|
|
||||||
# usually to register additional checkers.
|
|
||||||
load-plugins=
|
|
||||||
|
|
||||||
|
|
||||||
[MESSAGES CONTROL]
|
|
||||||
|
|
||||||
# Enable the message, report, category or checker with the given id(s). You can
|
|
||||||
# either give multiple identifier separated by comma (,) or put this option
|
|
||||||
# multiple time. See also the "--disable" option for examples.
|
|
||||||
#enable=
|
|
||||||
|
|
||||||
# Disable the message, report, category or checker with the given id(s). You
|
|
||||||
# can either give multiple identifiers separated by comma (,) or put this
|
|
||||||
# option multiple times (only on the command line, not in the configuration
|
|
||||||
# file where it should appear only once).You can also use "--disable=all" to
|
|
||||||
# disable everything first and then reenable specific checks. For example, if
|
|
||||||
# you want to run only the similarities checker, you can use "--disable=all
|
|
||||||
# --enable=similarities". If you want to run only the classes checker, but have
|
|
||||||
# no Warning level messages displayed, use"--disable=all --enable=classes
|
|
||||||
# --disable=W"
|
|
||||||
#I0011 an inline option disables a pylint message or a messages category
|
|
||||||
#R0801 a set of similar lines has been detected among multiple file
|
|
||||||
#W0142 a function or method is called using *args or **kwargs to dispatch argument
|
|
||||||
|
|
||||||
# W1201(logging-not-lazy)
|
|
||||||
# C0330(bad-continuation)
|
|
||||||
# E1205(logging-too-many-args)
|
|
||||||
|
|
||||||
disable=I0011,R0801,W0142,C0103,C0111,C0301,C0302,C0304,C0321,C1001,E0101,E0203,E0602,E1101,E1123,R0201,R0401,R0911,R0912,R0914,R0915,R0923,W0102,W0109,W0120,W0141,W0201,W0212,W0231,W0232,W0233,W0301,W0311,W0401,W0403,W0404,W0511,W0601,W0602,W0603,W0611,W0612,W0613,W0621,W0622,W0633,W0702,W0703,W1401,W1201,C0330
|
|
||||||
|
|
||||||
[REPORTS]
|
|
||||||
|
|
||||||
# Set the output format. Available formats are text, parseable, colorized, msvs
|
|
||||||
# (visual studio) and html. You can also give a reporter class, eg
|
|
||||||
# mypackage.mymodule.MyReporterClass.
|
|
||||||
#output-format=parseable
|
|
||||||
|
|
||||||
# Put messages in a separate file for each module / package specified on the
|
|
||||||
# command line instead of printing them on stdout. Reports (if any) will be
|
|
||||||
# written in a file name "pylint_global.[txt|html]".
|
|
||||||
files-output=no
|
|
||||||
|
|
||||||
# Tells whether to display a full report or only the messages
|
|
||||||
reports=no
|
|
||||||
|
|
||||||
# Python expression which should return a note less than 10 (10 is the highest
|
|
||||||
# note). You have access to the variables errors warning, statement which
|
|
||||||
# respectively contain the number of errors / warnings messages and the total
|
|
||||||
# number of statements analyzed. This is used by the global evaluation report
|
|
||||||
# (RP0004).
|
|
||||||
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
|
|
||||||
|
|
||||||
# Add a comment according to your evaluation note. This is used by the global
|
|
||||||
# evaluation report (RP0004).
|
|
||||||
comment=no
|
|
||||||
|
|
||||||
# Template used to display messages. This is a python new-style format string
|
|
||||||
# used to format the massage information. See doc for all details
|
|
||||||
#msg-template=
|
|
||||||
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
|
|
||||||
|
|
||||||
[BASIC]
|
|
||||||
|
|
||||||
# Required attributes for module, separated by a comma
|
|
||||||
required-attributes=
|
|
||||||
|
|
||||||
# List of builtins function names that should not be used, separated by a comma
|
|
||||||
bad-functions=map,filter,apply,input
|
|
||||||
|
|
||||||
# Regular expression which should only match correct module names
|
|
||||||
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
|
||||||
|
|
||||||
# Regular expression which should only match correct module level names
|
|
||||||
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
|
||||||
|
|
||||||
# Regular expression which should only match correct class names
|
|
||||||
class-rgx=[A-Z_][a-zA-Z0-9]+$
|
|
||||||
|
|
||||||
# Regular expression which should only match correct function names
|
|
||||||
function-rgx=[a-z_][a-z0-9_]{2,50}$
|
|
||||||
|
|
||||||
# Regular expression which should only match correct method names
|
|
||||||
method-rgx=[a-z_][a-z0-9_]{2,50}$
|
|
||||||
|
|
||||||
# Regular expression which should only match correct instance attribute names
|
|
||||||
attr-rgx=[a-z_][a-z0-9_]{2,50}$
|
|
||||||
|
|
||||||
# Regular expression which should only match correct argument names
|
|
||||||
argument-rgx=[a-z_][a-z0-9_]{2,50}$
|
|
||||||
|
|
||||||
# Regular expression which should only match correct variable names
|
|
||||||
variable-rgx=[a-z_][a-z0-9_]{2,50}$
|
|
||||||
|
|
||||||
# Regular expression which should only match correct attribute names in class
|
|
||||||
# bodies
|
|
||||||
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
|
||||||
|
|
||||||
# Regular expression which should only match correct list comprehension /
|
|
||||||
# generator expression variable names
|
|
||||||
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
|
||||||
|
|
||||||
# Good variable names which should always be accepted, separated by a comma
|
|
||||||
good-names=i,j,k,ex,Run,_
|
|
||||||
|
|
||||||
# Bad variable names which should always be refused, separated by a comma
|
|
||||||
bad-names=foo,bar,baz,toto,tutu,tata
|
|
||||||
|
|
||||||
# Regular expression which should only match function or class names that do
|
|
||||||
# not require a docstring.
|
|
||||||
no-docstring-rgx=__.*__
|
|
||||||
|
|
||||||
# Minimum line length for functions/classes that require docstrings, shorter
|
|
||||||
# ones are exempt.
|
|
||||||
docstring-min-length=-1
|
|
||||||
|
|
||||||
|
|
||||||
[FORMAT]
|
|
||||||
|
|
||||||
# Maximum number of characters on a single line.
|
|
||||||
max-line-length=150
|
|
||||||
|
|
||||||
# Allow the body of an if to be on the same line as the test if there is no
|
|
||||||
# else.
|
|
||||||
single-line-if-stmt=no
|
|
||||||
|
|
||||||
# Regexp for a line that is allowed to be longer than the limit.
|
|
||||||
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
|
||||||
|
|
||||||
# Maximum number of lines in a module
|
|
||||||
max-module-lines=1000
|
|
||||||
|
|
||||||
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
|
||||||
# tab).
|
|
||||||
indent-string=' '
|
|
||||||
|
|
||||||
|
|
||||||
[MISCELLANEOUS]
|
|
||||||
|
|
||||||
# List of note tags to take in consideration, separated by a comma.
|
|
||||||
notes=FIXME,XXX,TODO
|
|
||||||
|
|
||||||
|
|
||||||
[SIMILARITIES]
|
|
||||||
|
|
||||||
# Minimum lines number of a similarity.
|
|
||||||
min-similarity-lines=4
|
|
||||||
|
|
||||||
# Ignore comments when computing similarities.
|
|
||||||
ignore-comments=yes
|
|
||||||
|
|
||||||
# Ignore docstrings when computing similarities.
|
|
||||||
ignore-docstrings=yes
|
|
||||||
|
|
||||||
# Ignore imports when computing similarities.
|
|
||||||
ignore-imports=no
|
|
||||||
|
|
||||||
|
|
||||||
[TYPECHECK]
|
|
||||||
|
|
||||||
# Tells whether missing members accessed in mixin class should be ignored. A
|
|
||||||
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
|
||||||
ignore-mixin-members=yes
|
|
||||||
|
|
||||||
# List of classes names for which member attributes should not be checked
|
|
||||||
# (useful for classes with attributes dynamically set).
|
|
||||||
ignored-classes=SQLObject
|
|
||||||
|
|
||||||
# When zope mode is activated, add a predefined set of Zope acquired attributes
|
|
||||||
# to generated-members.
|
|
||||||
zope=no
|
|
||||||
|
|
||||||
# List of members which are set dynamically and missed by pylint inference
|
|
||||||
# system, and so shouldn't trigger E0201 when accessed. Python regular
|
|
||||||
# expressions are accepted.
|
|
||||||
generated-members=REQUEST,acl_users,aq_parent,objects
|
|
||||||
|
|
||||||
|
|
||||||
[VARIABLES]
|
|
||||||
|
|
||||||
# Tells whether we should check for unused import in __init__ files.
|
|
||||||
init-import=no
|
|
||||||
|
|
||||||
# A regular expression matching the beginning of the name of dummy variables
|
|
||||||
# (i.e. not used).
|
|
||||||
dummy-variables-rgx=_$|dummy
|
|
||||||
|
|
||||||
# List of additional names supposed to be defined in builtins. Remember that
|
|
||||||
# you should avoid to define new builtins when possible.
|
|
||||||
additional-builtins=
|
|
||||||
|
|
||||||
|
|
||||||
[CLASSES]
|
|
||||||
|
|
||||||
# List of interface methods to ignore, separated by a comma. This is used for
|
|
||||||
# instance to not check methods defines in Zope's Interface base class.
|
|
||||||
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
|
|
||||||
|
|
||||||
# List of method names used to declare (i.e. assign) instance attributes.
|
|
||||||
defining-attr-methods=__init__,__new__,setUp
|
|
||||||
|
|
||||||
# List of valid names for the first argument in a class method.
|
|
||||||
valid-classmethod-first-arg=cls
|
|
||||||
|
|
||||||
# List of valid names for the first argument in a metaclass class method.
|
|
||||||
valid-metaclass-classmethod-first-arg=mcs
|
|
||||||
|
|
||||||
|
|
||||||
[DESIGN]
|
|
||||||
|
|
||||||
# Maximum number of arguments for function / method
|
|
||||||
max-args=10
|
|
||||||
|
|
||||||
# Argument names that match this expression will be ignored. Default to name
|
|
||||||
# with leading underscore
|
|
||||||
ignored-argument-names=_.*
|
|
||||||
|
|
||||||
# Maximum number of locals for function / method body
|
|
||||||
max-locals=15
|
|
||||||
|
|
||||||
# Maximum number of return / yield for function / method body
|
|
||||||
max-returns=6
|
|
||||||
|
|
||||||
# Maximum number of branch for function / method body
|
|
||||||
max-branches=12
|
|
||||||
|
|
||||||
# Maximum number of statements in function / method body
|
|
||||||
max-statements=50
|
|
||||||
|
|
||||||
# Maximum number of parents for a class (see R0901).
|
|
||||||
max-parents=7
|
|
||||||
|
|
||||||
# Maximum number of attributes for a class (see R0902).
|
|
||||||
max-attributes=20
|
|
||||||
|
|
||||||
# Minimum number of public methods for a class (see R0903).
|
|
||||||
min-public-methods=0
|
|
||||||
|
|
||||||
# Maximum number of public methods for a class (see R0904).
|
|
||||||
max-public-methods=100
|
|
||||||
|
|
||||||
|
|
||||||
[IMPORTS]
|
|
||||||
|
|
||||||
# Deprecated modules which should not be used, separated by a comma
|
|
||||||
deprecated-modules=regsub,TERMIOS,Bastion,rexec
|
|
||||||
|
|
||||||
# Create a graph of every (i.e. internal and external) dependencies in the
|
|
||||||
# given file (report RP0402 must not be disabled)
|
|
||||||
import-graph=
|
|
||||||
|
|
||||||
# Create a graph of external dependencies in the given file (report RP0402 must
|
|
||||||
# not be disabled)
|
|
||||||
ext-import-graph=
|
|
||||||
|
|
||||||
# Create a graph of internal dependencies in the given file (report RP0402 must
|
|
||||||
# not be disabled)
|
|
||||||
int-import-graph=
|
|
||||||
|
|
||||||
|
|
||||||
[EXCEPTIONS]
|
|
||||||
|
|
||||||
# Exceptions that will emit a warning when being caught. Defaults to
|
|
||||||
# "Exception"
|
|
||||||
overgeneral-exceptions=Exception
|
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
coverage==4.0.3
|
coverage==6.2
|
||||||
coveralls==1.1
|
coveralls==3.3.1
|
||||||
mock==1.3.0
|
mock==4.0.3
|
||||||
nose==1.3.7
|
nose==1.3.7
|
||||||
pep8==1.7.0
|
flake8==4.0.1
|
||||||
pyflakes==1.1.0
|
|
||||||
pylint==1.3.1 # pylint 1.4 does not run under python 2.6
|
|
||||||
pyOpenSSL==0.15.1
|
|
||||||
|
|||||||
Reference in New Issue
Block a user