def result(): lyrics = False query = request.args.get('query') lyrics_ = request.args.get('lyrics') if lyrics_ and lyrics_.lower() != 'false': lyrics = True if 'saavn' not in query: return jsonify(jiosaavn.search_for_song(query, lyrics)) try: if '/song/' in query: print("Song") song_id = jiosaavn.get_song_id(query) song = jiosaavn.get_song(song_id, lyrics) return jsonify(song) elif '/album/' in query: print("Album") id = jiosaavn.get_album_id(query) songs = jiosaavn.get_album(id, lyrics) return jsonify(songs) elif '/playlist/' or '/featured/' in query: print("Playlist") id = jiosaavn.get_playlist_id(query) songs = jiosaavn.get_playlist(id, lyrics) return jsonify(songs) except Exception as e: print_exc() error = {"status": True, "error": str(e)} return jsonify(error) return None
def album(): lyrics = False query = request.args.get('query') lyrics_ = request.args.get('lyrics') if lyrics_ and lyrics_.lower() != 'false': lyrics = True if query: id = jiosaavn.get_album_id(query) songs = jiosaavn.get_album(id, lyrics) return jsonify(songs) else: error = { "status": False, "error": 'Query is required to search albums!' } return jsonify(error)