def home(): try: if not DB.isLoaded(): GMusic.load_database() return render_template('albums.html', art_display_size='200', all_albums=DB.allData('albums')), 200, { 'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache' } except: return redirect(url_for('login'))
def home(): try: GMusic.load_database() return render_template( 'index.html', art_display_size='200', song_count=DB.count('songs'), artist_count=DB.count('artists'), album_count=DB.count('albums'), all_songs=DB.allSongs() ), 200, {'Cache-Control': 'no-cache, no-store', 'Pragma': 'no-cache'} except: return redirect(url_for('login'))
def login(): error = None if request.method == 'POST': if GMusic.login_check(request.form['username'], request.form['password']): print "Credentials check out" return redirect(url_for('home')) else: error = 'Invalid Credentials. Please try again.' return render_template('login.html', error=error)
import GMusic import web.WebServer as webServer from optparse import OptionParser parser = OptionParser() parser.add_option("-o", "--offline", action="store_true", dest="offline", help="Runs in offline mode to use the cache file", default=False) (options, args) = parser.parse_args() GMusic.set_offline_mode(options.offline) webServer.runFlask()