Skip to content

Commit

Permalink
add current playing song to toolbar (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarneo authored Nov 10, 2017
1 parent f88678f commit 2566412
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pytify/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def interaction(self):
)

while 1:
search_input = custom_prompt()
search_input = custom_prompt(self.pytify.get_current_playing())

if self.command.run(search_input):
continue
Expand Down
14 changes: 8 additions & 6 deletions pytify/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ def completer():
return WordCompleter(set(list), ignore_case=True)


def get_bottom_toolbar_tokens(cli):
return [
(Token.Toolbar, ' exit: ctrl+d | clear: ctrl+c ')
]
def get_bottom_toolbar_tokens(currentSong):
def toolbar(cli):
return [
(Token.Toolbar, ' exit: ctrl+d | clear: ctrl+c | song: %s' % currentSong)
]

return toolbar

def get_prompt_tokens(cli):
return [
Expand All @@ -47,14 +49,14 @@ def get_prompt_tokens(cli):
]


def custom_prompt():
def custom_prompt(currentSong):
return prompt(
get_prompt_tokens=get_prompt_tokens,
history=history(),
auto_suggest=AutoSuggestFromHistory(),
enable_history_search=True,
on_abort=AbortAction.RETRY,
get_bottom_toolbar_tokens=get_bottom_toolbar_tokens,
get_bottom_toolbar_tokens=get_bottom_toolbar_tokens(currentSong),
completer=completer(),
complete_while_typing=True,
style=style
Expand Down

0 comments on commit 2566412

Please sign in to comment.