Beispiel #1
0
PROMPT = '> '

## First, set up the world map
world_map = world.World()
world_map.load_rooms(data.map_rooms)
world_map.load_connections(data.map_connections)
world_map.set_current_room('stockton-home')

## Set up the world state
world_state = state.State()
world_state.set_funds(100)
world_state.set_world_map(world_map)

## set up the parsing engine
verbs = Verbs()


def tokenize_command(command):
    # Take a command and turn it into a list of tokens.  As an
    # example, it will turn "go south " into ['go', 'south']
    command = ' '.join(command.split())
    return command.split(' ')


def read_input(tokenize):
    # Read in a set of commands from the prompt.  There can be
    # multiple commands per line separated by ';'.  This is the only
    # place that will read input for the user.  If tokenize is True,
    # it will return a list of lowercase tokens that can be parsed
    # individually.  As an example, it could return: [['take',
Beispiel #2
0
import spotipy.util as util
from localSecret import CLIENT_ID,CLIENT_SECRET
client_id = CLIENT_ID
client_secret = CLIENT_SECRET 
redirect_uri=   "https://localhost/fake2718:8080"

username = USERNAME
scopesList = ['user-read-currently-playing'
             ,'user-modify-playback-state'
             ,'user-read-playback-state']
scopes = ' '.join(scopesList)
token = util.prompt_for_user_token(username,scopes,client_id,client_secret,redirect_uri,show_dialog=True)

#Blessed initalization
term = Terminal()
reqVerbs = Verbs(token)
tui = TUI(term,reqVerbs)



def getCurrSongNameArtist(json):
    song = json['item']['name']
    artists = [elem['name'] for elem in json['item']['artists']]
    artists = '/'.join(artists)
    songInfo = "{} - {}".format(song,artists) 
    return songInfo




while(True):