remove rofi-radio
This commit is contained in:
parent
35cf936ebb
commit
d4fb211a82
|
@ -176,8 +176,6 @@ bindsym $mod+Shift+q kill
|
|||
bindsym $mod+Control+Return exec rofi -combi drun -show drun -modi drun,window
|
||||
# start rofi-pass for password autotype
|
||||
bindsym $mod+Shift+Return exec rofi-pass
|
||||
# start rofi-radio
|
||||
bindsym $mod+p exec ~/bin/rofi-radio
|
||||
|
||||
# change focus
|
||||
bindsym $mod+h focus left
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
- name: Nectarine
|
||||
loc: 'http://nectarine.ers35.net:8000/necta192.mp3'
|
||||
- name: TheBase
|
||||
loc: 'http://radio.thebase.sc:8000/stream'
|
||||
- name: CJPX 99.5 Radio-Classique Montréal
|
||||
loc: 'http://stream.statsradio.com:8030/stream'
|
||||
- name: CBF 95.1 ICI Radio-Canada Première Montréal
|
||||
loc: 'http://2qmtl0.akacast.akamaistream.net/7/953/177387/v1/rc.akacast.akamaistream.net/2QMTL0'
|
||||
- name: CBFX-FM 100.7 ICI Musique Montréal
|
||||
loc: 'http://7qmtl0.akacast.akamaistream.net/7/445/177407/v1/rc.akacast.akamaistream.net/7QMTL0'
|
||||
- name: '----- Youtube playlists'
|
||||
loc: ''
|
||||
- name: Nik Cooper - Progressive
|
||||
loc: 'https://www.youtube.com/playlist?list=PL4C9F90A46845CCB1'
|
||||
- name: Two Step From Hell - Battlecry
|
||||
loc: 'https://www.youtube.com/playlist?list=PLR5APJwPaxYLbEsztLyouK8VaOqh8b3vm'
|
||||
- name: Two Step From Hell - Invicible
|
||||
loc: 'https://www.youtube.com/playlist?list=PL7B16C924C1FAD7BD'
|
||||
- name: Falkkone - Monster Hunter
|
||||
loc: 'https://www.youtube.com/playlist?list=PLkU8l1ITH2CUKg-4zZMzBO2tZGLNTWGui'
|
||||
- name: Falkkone - Undertale
|
||||
loc: 'https://www.youtube.com/playlist?list=PLkU8l1ITH2CUoLhyOjBgj3av9Tl0YqBB8'
|
|
@ -1,75 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
import json
|
||||
import os
|
||||
from subprocess import Popen, PIPE, check_output, check_call
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
station_name_file = '/run/user/%s/rofi-radio-name' % os.getuid()
|
||||
|
||||
def mpv_ipc(*args):
|
||||
try:
|
||||
j = json.loads(check_output(['mpv-ipc'] + list(args)))
|
||||
if j:
|
||||
return j['data']
|
||||
except:
|
||||
pass
|
||||
return ''
|
||||
|
||||
with open(os.path.expanduser("~/.local/share/rofi-radio/playlists.yaml")) as f:
|
||||
stations = yaml.load(f)
|
||||
|
||||
rofi_command = ['rofi', '-i', '-selected-row', '0', '-dmenu', '-p', 'mpv']
|
||||
|
||||
current_song = mpv_ipc('get_property_string', 'media-title')
|
||||
if current_song:
|
||||
try:
|
||||
with open(station_name_file) as f:
|
||||
station_name = f.readline()
|
||||
except:
|
||||
station_name = ''
|
||||
rofi_command += ['-mesg', station_name]
|
||||
commands = b"Play/Pause\nStop\nShuffle\nNext\nPrevious"
|
||||
|
||||
else:
|
||||
commands = bytes('\n'.join([s["name"] for s in stations]), 'utf8')
|
||||
|
||||
rofi = Popen(rofi_command, stdout=PIPE, stdin=PIPE)
|
||||
choice = rofi.communicate(input=commands)[0].decode('utf8').rstrip()
|
||||
|
||||
if current_song:
|
||||
if choice == "Play/Pause":
|
||||
mpv_ipc('cycle', 'pause')
|
||||
elif choice == "Stop":
|
||||
mpv_ipc('stop')
|
||||
elif choice == "Shuffle":
|
||||
mpv_ipc('playlist-shuffle')
|
||||
elif choice == "Next":
|
||||
mpv_ipc('playlist-next')
|
||||
elif choice == "Previous":
|
||||
mpv_ipc('playlist-prev')
|
||||
else:
|
||||
s = [s for s in stations if s["name"] == choice]
|
||||
if s:
|
||||
# Load the selected playlist
|
||||
loc = s[0]["loc"]
|
||||
station_name = s[0]["name"]
|
||||
if loc.startswith('http') or loc.startswith('ytdl'):
|
||||
# Load the url
|
||||
mpv_ipc('loadfile', loc)
|
||||
else:
|
||||
# Load the file
|
||||
workdir = mpv_ipc('get_property_string', 'working-directory')
|
||||
mpv_ipc('loadfile', os.path.expanduser(loc))
|
||||
station_name = loc
|
||||
with open(station_name_file, 'w') as f:
|
||||
f.write(station_name)
|
||||
else:
|
||||
# Try to load the user input
|
||||
mpv_ipc('loadfile', choice)
|
||||
mpv_ipc('set_property_string', 'pause', 'no')
|
||||
|
||||
|
||||
# force update of i3status
|
||||
check_call(['killall', '-USR1', 'i3status'])
|
Loading…
Reference in New Issue