mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-20 16:03:59 +01:00
@@ -59,6 +59,11 @@ def artistlist_to_mbids(artistlist, forced=False):
|
|||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.warn('Failed to update arist information from Last.fm: %s' % e)
|
logger.warn('Failed to update arist information from Last.fm: %s' % e)
|
||||||
|
|
||||||
|
def addArtistIDListToDB(artistidlist):
|
||||||
|
# Used to add a list of artist IDs to the database in a single thread
|
||||||
|
logger.debug("Importer: Adding artist ids %s" % artistidlist)
|
||||||
|
for artistid in artistidlist:
|
||||||
|
addArtisttoDB(artistid)
|
||||||
|
|
||||||
def addArtisttoDB(artistid, extrasonly=False):
|
def addArtisttoDB(artistid, extrasonly=False):
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ class WebInterface(object):
|
|||||||
newValueDict = {'IncludeExtras': 1}
|
newValueDict = {'IncludeExtras': 1}
|
||||||
myDB.upsert("artists", newValueDict, controlValueDict)
|
myDB.upsert("artists", newValueDict, controlValueDict)
|
||||||
threading.Thread(target=importer.addArtisttoDB, args=[ArtistID, True]).start()
|
threading.Thread(target=importer.addArtisttoDB, args=[ArtistID, True]).start()
|
||||||
time.sleep(10)
|
|
||||||
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
|
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
|
||||||
getExtras.exposed = True
|
getExtras.exposed = True
|
||||||
|
|
||||||
@@ -152,7 +151,6 @@ class WebInterface(object):
|
|||||||
|
|
||||||
def addArtists(self, **args):
|
def addArtists(self, **args):
|
||||||
threading.Thread(target=importer.artistlist_to_mbids, args=[args, True]).start()
|
threading.Thread(target=importer.artistlist_to_mbids, args=[args, True]).start()
|
||||||
time.sleep(5)
|
|
||||||
raise cherrypy.HTTPRedirect("home")
|
raise cherrypy.HTTPRedirect("home")
|
||||||
addArtists.exposed = True
|
addArtists.exposed = True
|
||||||
|
|
||||||
@@ -212,6 +210,7 @@ class WebInterface(object):
|
|||||||
|
|
||||||
def markArtists(self, action=None, **args):
|
def markArtists(self, action=None, **args):
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
|
artistsToAdd = []
|
||||||
for ArtistID in args:
|
for ArtistID in args:
|
||||||
if action == 'delete':
|
if action == 'delete':
|
||||||
myDB.action('DELETE from artists WHERE ArtistID=?', [ArtistID])
|
myDB.action('DELETE from artists WHERE ArtistID=?', [ArtistID])
|
||||||
@@ -226,9 +225,10 @@ class WebInterface(object):
|
|||||||
newValueDict = {'Status': 'Active'}
|
newValueDict = {'Status': 'Active'}
|
||||||
myDB.upsert("artists", newValueDict, controlValueDict)
|
myDB.upsert("artists", newValueDict, controlValueDict)
|
||||||
else:
|
else:
|
||||||
# These may and probably will collide - need to make a better way to queue musicbrainz queries
|
artistsToAdd.append(ArtistID)
|
||||||
threading.Thread(target=importer.addArtisttoDB, args=[ArtistID]).start()
|
if len(artistsToAdd) > 0:
|
||||||
time.sleep(30)
|
logger.debug("Refreshing artists: %s" % artistsToAdd)
|
||||||
|
threading.Thread(target=importer.addArtistIDListToDB, args=[artistsToAdd]).start()
|
||||||
raise cherrypy.HTTPRedirect("home")
|
raise cherrypy.HTTPRedirect("home")
|
||||||
markArtists.exposed = True
|
markArtists.exposed = True
|
||||||
|
|
||||||
@@ -266,21 +266,18 @@ class WebInterface(object):
|
|||||||
def forceUpdate(self):
|
def forceUpdate(self):
|
||||||
from headphones import updater
|
from headphones import updater
|
||||||
threading.Thread(target=updater.dbUpdate).start()
|
threading.Thread(target=updater.dbUpdate).start()
|
||||||
time.sleep(5)
|
|
||||||
raise cherrypy.HTTPRedirect("home")
|
raise cherrypy.HTTPRedirect("home")
|
||||||
forceUpdate.exposed = True
|
forceUpdate.exposed = True
|
||||||
|
|
||||||
def forceSearch(self):
|
def forceSearch(self):
|
||||||
from headphones import searcher
|
from headphones import searcher
|
||||||
threading.Thread(target=searcher.searchforalbum).start()
|
threading.Thread(target=searcher.searchforalbum).start()
|
||||||
time.sleep(5)
|
|
||||||
raise cherrypy.HTTPRedirect("home")
|
raise cherrypy.HTTPRedirect("home")
|
||||||
forceSearch.exposed = True
|
forceSearch.exposed = True
|
||||||
|
|
||||||
def forcePostProcess(self):
|
def forcePostProcess(self):
|
||||||
from headphones import postprocessor
|
from headphones import postprocessor
|
||||||
threading.Thread(target=postprocessor.forcePostProcess).start()
|
threading.Thread(target=postprocessor.forcePostProcess).start()
|
||||||
time.sleep(5)
|
|
||||||
raise cherrypy.HTTPRedirect("home")
|
raise cherrypy.HTTPRedirect("home")
|
||||||
forcePostProcess.exposed = True
|
forcePostProcess.exposed = True
|
||||||
|
|
||||||
@@ -528,7 +525,6 @@ class WebInterface(object):
|
|||||||
|
|
||||||
def addReleaseById(self, rid):
|
def addReleaseById(self, rid):
|
||||||
threading.Thread(target=importer.addReleaseById, args=[rid]).start()
|
threading.Thread(target=importer.addReleaseById, args=[rid]).start()
|
||||||
time.sleep(5)
|
|
||||||
raise cherrypy.HTTPRedirect("home")
|
raise cherrypy.HTTPRedirect("home")
|
||||||
addReleaseById.exposed = True
|
addReleaseById.exposed = True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user