def queueAlbum(self, AlbumID, ArtistID): conn=sqlite3.connect(database) c=conn.cursor() c.execute('UPDATE albums SET status = "Wanted" WHERE AlbumID="%s"' % AlbumID) conn.commit() c.close() import searcher searcher.searchNZB(AlbumID) raise cherrypy.HTTPRedirect("/artistPage?ArtistID=%s" % ArtistID)
"AlbumTitle": release_dict['rg_title'], "AlbumASIN": release_dict['asin'], "TrackTitle": track['title'], "TrackDuration": track['duration'], "TrackNumber": track['number'], "CleanName": cleanname } match = myDB.action('SELECT Location, BitRate from have WHERE CleanName=?', [cleanname]).fetchone() if not match: match = myDB.action('SELECT Location, BitRate from have WHERE ArtistName LIKE ? AND AlbumTitle LIKE ? AND TrackTitle LIKE ?', [release_dict['artist_name'], release_dict['rg_title'], track['title']]).fetchone() if not match: match = myDB.action('SELECT Location, BitRate from have WHERE TrackID=?', [track['id']]).fetchone() if match: newValueDict['Location'] = match['Location'] newValueDict['BitRate'] = match['BitRate'] myDB.action('DELETE from have WHERE Location=?', [match['Location']]) myDB.upsert("tracks", newValueDict, controlValueDict) #start a search for the album import searcher searcher.searchNZB(rgid, False) elif not rg_exists and not release_dict: logger.error("ReleaseGroup does not exist in the database and did not get a valid response from MB. Skipping release.") return else: logger.info('Release ' + str(rid) + " already exists in the database!")
def forceSearch(self): import searcher searcher.searchNZB() raise cherrypy.HTTPRedirect("/")
match = myDB.action( 'SELECT Location, BitRate, Format from have WHERE TrackID=?', [track['id']]).fetchone() if match: newValueDict['Location'] = match['Location'] newValueDict['BitRate'] = match['BitRate'] newValueDict['Format'] = match['Format'] myDB.action('DELETE from have WHERE Location=?', [match['Location']]) myDB.upsert("tracks", newValueDict, controlValueDict) #start a search for the album import searcher searcher.searchNZB(rgid, False) elif not rg_exists and not release_dict: logger.error( "ReleaseGroup does not exist in the database and did not get a valid response from MB. Skipping release." ) return else: logger.info('Release ' + str(rid) + " already exists in the database!") def updateFormat(): myDB = db.DBConnection() tracks = myDB.select( 'SELECT * from tracks WHERE Location IS NOT NULL and Format IS NULL') if len(tracks) > 0: logger.info('Finding media format for %s files' % len(tracks))