mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-22 12:49:26 +00:00
Merge remote-tracking branch 'doskir/bugs2012-10-07' into develop
This commit is contained in:
@@ -65,7 +65,8 @@ class Cache(object):
|
||||
|
||||
def _findfilesstartingwith(self,pattern,folder):
|
||||
files = []
|
||||
for fname in os.listdir(folder):
|
||||
if os.path.exists(folder):
|
||||
for fname in os.listdir(folder):
|
||||
if fname.startswith(pattern):
|
||||
files.append(os.path.join(folder,fname))
|
||||
return files
|
||||
|
||||
@@ -21,7 +21,7 @@ from lib.beets.mediafile import MediaFile
|
||||
import headphones
|
||||
from headphones import logger, helpers, db, mb, albumart, lastfm
|
||||
|
||||
#[anonymous],[data],[no artist],[traditional],[unknown],Various Artists
|
||||
blacklisted_special_artist_names = ['[anonymous]','[data]','[no artist]','[traditional]','[unknown]','Various Artists']
|
||||
blacklisted_special_artists = ['f731ccc4-e22a-43af-a747-64213329e088','33cf029c-63b0-41a0-9855-be2a3665fb3b',\
|
||||
'314e1c25-dde7-4e4d-b2f4-0a7b9f7c56dc','eec63d3c-3b81-4ad4-b1e4-7c147d4d2b61',\
|
||||
'9be7f096-97ec-4615-8957-8d40b5dcbc41','125ec42a-7229-4250-afc5-e057484327fe',\
|
||||
@@ -138,6 +138,14 @@ def addArtisttoDB(artistid, extrasonly=False):
|
||||
|
||||
artist = mb.getArtist(artistid, extrasonly)
|
||||
|
||||
if artist and artist.get('artist_name') in blacklisted_special_artist_names:
|
||||
logger.warn('Cannot import blocked special purpose artist: %s' % artist.get('artist_name'))
|
||||
myDB.action('DELETE from artists WHERE ArtistID=?', [artistid])
|
||||
#in case it's already in the db
|
||||
myDB.action('DELETE from albums WHERE ArtistID=?', [artistid])
|
||||
myDB.action('DELETE from tracks WHERE ArtistID=?', [artistid])
|
||||
return
|
||||
|
||||
if not artist:
|
||||
logger.warn("Error fetching artist info. ID: " + artistid)
|
||||
if dbartist is None:
|
||||
|
||||
@@ -30,6 +30,8 @@ from headphones.helpers import checked, radio,today
|
||||
|
||||
import lib.simplejson as simplejson
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
|
||||
def serve_template(templatename, **kwargs):
|
||||
@@ -926,14 +928,18 @@ class Artwork(object):
|
||||
|
||||
if not relpath:
|
||||
relpath = "data/interfaces/default/images/no-cover-art.png"
|
||||
basedir = os.path.dirname(sys.argv[0])
|
||||
path = os.path.join(basedir,relpath)
|
||||
cherrypy.response.headers['Content-type'] = 'image/png'
|
||||
cherrypy.response.headers['Cache-Control'] = 'no-cache'
|
||||
else:
|
||||
relpath = relpath.replace('cache/','',1)
|
||||
path = os.path.join(headphones.CACHE_DIR,relpath)
|
||||
fileext = os.path.splitext(relpath)[1][1::]
|
||||
cherrypy.response.headers['Content-type'] = 'image/' + fileext
|
||||
cherrypy.response.headers['Cache-Control'] = 'max-age=31556926'
|
||||
|
||||
path = os.path.abspath(relpath)
|
||||
path = os.path.normpath(path)
|
||||
f = open(path,'rb')
|
||||
return f.read()
|
||||
default.exposed = True
|
||||
@@ -955,14 +961,18 @@ class Artwork(object):
|
||||
|
||||
if not relpath:
|
||||
relpath = "data/interfaces/default/images/no-cover-artist.png"
|
||||
basedir = os.path.dirname(sys.argv[0])
|
||||
path = os.path.join(basedir,relpath)
|
||||
cherrypy.response.headers['Content-type'] = 'image/png'
|
||||
cherrypy.response.headers['Cache-Control'] = 'no-cache'
|
||||
else:
|
||||
relpath = relpath.replace('cache/','',1)
|
||||
path = os.path.join(headphones.CACHE_DIR,relpath)
|
||||
fileext = os.path.splitext(relpath)[1][1::]
|
||||
cherrypy.response.headers['Content-type'] = 'image/' + fileext
|
||||
cherrypy.response.headers['Cache-Control'] = 'max-age=31556926'
|
||||
|
||||
path = os.path.abspath(relpath)
|
||||
path = os.path.normpath(path)
|
||||
f = open(path,'rb')
|
||||
return f.read()
|
||||
default.exposed = True
|
||||
|
||||
Reference in New Issue
Block a user