diff --git a/data/interfaces/default/artist.html b/data/interfaces/default/artist.html index 3a145197..104c219c 100644 --- a/data/interfaces/default/artist.html +++ b/data/interfaces/default/artist.html @@ -10,6 +10,8 @@
Refresh Artist Delete Artist + Scan Artist + Scan Artist %if artist['Status'] == 'Paused': Resume Artist %else: diff --git a/headphones/webserve.py b/headphones/webserve.py index 45a37c08..ff0c9f94 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -253,6 +253,18 @@ class WebInterface(object): def deleteArtist(self, ArtistID): self.removeArtist(ArtistID) raise cherrypy.HTTPRedirect("home") + + @cherrypy.expose + def scanArtist(self, ArtistID): + logger.info(u"Scanning artist: " + ArtistID) + myDB = db.DBConnection() + artistname=myDB.select('select distinct ArtistName from artists WHERE ArtistID=?', [ArtistID]) + artistfolder= os.path.join(headphones.DESTINATION_DIR,artistname[0][0]) + try: + threading.Thread(target=librarysync.libraryScan(dir=artistfolder)).start() + except Exception, e: + logger.error('Unable to complete the scan: %s' % e) + raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID) @cherrypy.expose def deleteEmptyArtists(self):