Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

next/prev keys for quick station change in playlist mode

See original GitHub issue

Hi @coderholic @s-n-g ,

thanks for this great app. It would be nice if there were two keyboard shortcuts for playing next/previous station in a playlist.

It would be great if mvp or another player could use these shortcuts. I mean I have next/prev pause/play physical keys on my keyboard which works in many apps which are playing in the background e.g. Spotify.

I also noticed that the pause/play key on my keyboard already works (only) with mvp player.

If you agree and can give me some info. I can create a PR.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

s-n-gcommented, Aug 2, 2021

Oh, I see what you mean!

I do not think this can be done with pyradio at this time, though… You see, it just reads keyboard input from the terminal, which means that the terminal has to be focused to do that

Now, there is a way to do it: a keyboard listener Try this out:

from pynput import keyboard

def on_press(key):
        print('alphanumeric key {0} pressed'.format(
    except AttributeError:
        print('special key {0} pressed'.format(

def on_release(key):
    print('{0} released'.format(
    if key == keyboard.Key.esc:
        # Stop listener
        return False

# Collect events until released
with keyboard.Listener(
        on_release=on_release) as listener:

You will have to install the following python module beforehand: pynput

Save the program as and execute


Focus any other window and start typing. You should be able to see the keys you type. You should also be able to see your “extra” keys (next / previous / play / ‘pause’, etc)

Please do tell me how that goes!

Finally, I may be able to incorporete this functionality to pyradio (not sure how, thought), but in any case this is something for the future.

I will leave this issue open, so that I do not forget about it 😃

jirikreplcommented, Aug 2, 2021

Hi @s-n-g

sorry for my late answer. I tested your code and ^N and ^P works great! But what I meant was if pyradio could do prev next even when terminal is out of focus.

On my keyboard when using media keys I can do prev/next, play/pause Spotify, even if Spotify does not have focus

Currently I can do play/pause when using pyradio with mplayer and terminal does not focus. prev next does not work

Here is my keyboard layout where there are those media keys

Here are some screenshots with keycodes Screen Shot 2021-08-02 at 10 14 47 Screen Shot 2021-08-02 at 10 18 03 Screen Shot 2021-08-02 at 10 18 24 Screen Shot 2021-08-02 at 10 18 10

I tested your script but it will not print anything if I press media keys. It works only fine with single letter keys

Screen Shot 2021-08-02 at 10 21 16

I used karabiner event view to print keycodes for those media keys (there are keydown and keyup events):

  • play_or_pause
  • scan_previous_track
  • scan_next_track
Screen Shot 2021-08-02 at 10 31 39 Screen Shot 2021-08-02 at 10 31 53 Screen Shot 2021-08-02 at 10 32 04
Read more comments on GitHub >

github_iconTop Results From Across the Web

StationPlaylist Scripts Keystroke Summary
To build a list of all items in the playlist press the StationPlaylist key then Control+B. Press Enter to focus an item. To...
Read more >
DAD User Manual
Assigning Cuts to an Array in Full Height Mode. ... Keyboard Shortcuts . ... Quick review of PLAYLIST MODIFY window .
Read more >
Using Playlists in Pro Tools [Quick Keys, Shortcuts ... - YouTube
I share Quick Keys, Shortcuts, and Workflows all inside Pro Tools. ... Shift +S Move the Edit cursor up and down through Playlist...
Read more >
FastServe | Live Edit User Guide v2018.3 - Avid Technology
Fast Playlist : Adding Clips by Events. ... The four Select Input/Recording Channel keys (marked A, B, C, ... Next/ Prev by Sort....
Read more >
PX5] MtcdTools-Control music players, customize buttons ...
Yes, it is possible to switch to next/prev/toggle play video but you have to play a YouTube playlist. Last edited: Mar 6, 2017....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found