You are not logged in.

#1 2017-09-29 21:46:03

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,715

radioClicky, almost brilliant radio for your tint2 and ob pipemenu

https://github.com/brontosaurusrex/radioClicky

Requires: reasonably modern mpv, socat, notify-send, sed, grep, pgrep (procps), latest tint2, inotify-tools, jq
Likes: curl, wget, streamripper

Change array to your favorite radio stations and add appropriate stuff to tint2rc.

Check the needs

radioClicky sysinfo

may return

mpv 0.27.0-226-gb3178eb59e (C) 2000-2017 mpv/MPlayer/mplayer2 projects
 --lavfi-complex                  String (default: )
socat version 1.7.3.1 on Jul 14 2017 13:52:03
tint2 version 15.2
notify-send 0.7.7
inotifywait 3.14
sed (GNU sed) 4.4
grep (GNU grep) 2.27
pgrep from procps-ng 3.3.12
Streamripper 1.64.6
GNU Wget 1.18 built on linux-gnu.
curl 7.52.1 (x86_64-pc-linux-gnu) libcurl/7.52.1 OpenSSL/1.0.2l zlib/1.2.8 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) libssh2/1.7.0 nghttp2/1.18.1 librtmp/2.3
jq-1.5-1-a5b5cbe
macpro @ Debian GNU/Linux 9.2 (stretch) / 4.9.0-4-amd6

It will look like this: ' / 12' for on or this ' \ ' for off. '12' is stream id.

radioClicky.th.png

Optional openbox pipemenu and some conkyness

optionalOpenboxAndConly.th.png

Long&boring install/test/debug instructions:

1. install

# required
sudo apt install mpv libnotify-bin sed procps socat jq inotify-tools curl wget
# script
cd ~/bin
wget https://raw.githubusercontent.com/brontosaurusrex/stretchbang/master/bin/radioClicky
chmod +x radioClicky
# configure script as needed, change 
# array=("url1" "url2" "urlN")
# to your prefered radio stations. 

2. test from terminal

radioClicky           # show status 
radioClicky toggle    # on/off
radioClicky notify    # notify-send (or echo) icy-title or stream url
radioClicky +         # next station
radioClicky -         # prev station
radioClicky 5         # station with id 5
radioClicky sysinfo   # post this with your complaint
radioClicky help      # for more

2. b) make short version of command (optional for easier cli usage), a softlink:

cd ~/bin
ln -s radioClicky r
# now 'r' is your new command

Note: radioClicky is perfectly useful from cli, so if you don't need any gui's thats it.

radioClickyScrot.th.png

^ tmux left: interactive cli, right: 'radioClicky spam'

3. a) Adding to tint2 as executor

radioClicky tint2 # for instructions

3. b) and/or Adding to openbox menu (optional)

# In .config/openbox/menu.xml add
<menu id="radio" label="radio" execute="radioClicky openbox" />

3. c) conky showing last 5 valid icy-titles (optional)

${font RobotoCondensed-Light:size=12}${color cccccc}
${execpi 5 radioClicky last | tail -n 5}

3. d) example shortkeys in openbox rc.xml (alt + e, r, t, n)

    <!-- toggleRadio -->
    <keybind key="A-r">
      <action name="Execute">
        <command>r t</command>
      </action>
    </keybind>
    <!-- Radio next -->
    <keybind key="A-t">
      <action name="Execute">
        <command>r +</command>
      </action>
    </keybind>
    <!-- Radio prev -->
    <keybind key="A-e">
      <action name="Execute">
        <command>r -</command>
      </action>
    </keybind>
    <!-- Radio what song -->
    <keybind key="A-n">
      <action name="Execute">
        <command>r n</command>
      </action>
    </keybind>

4. debug
Start tint2 from terminal and observe what happens when you click on the '/'.

At this point you should be in business, if not:

5. Complain, please add this output next to your complaint:

radioClicky sysinfo

6.  changelog
- Changed internals to bidirectional remote model (mpv).
- Changed tint2 executor to continuous version

Last edited by brontosaurusrex (2017-10-30 14:19:38)

Offline

#2 2017-09-29 22:12:28

hhh
That's it!
Registered: 2015-09-17
Posts: 7,250
Website

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

Looks convenient but you'll have to talk me through it. Putting it in ~/bin, naming it radioClicky and making it executable doesn't WFM.

/thick in the head

Offline

#3 2017-09-29 22:31:45

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,715

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

Testing from cli:

radioClicky toggle    # on/off
radioClicky notify    # notify-send icy-title
radioClicky           # show status

If that is working fine, next step is that tint2rc executor code, basically patching lmb to "toggle", rmb to "notify" and occasional refresh to "show status", that way you can stop toggle it from cli and tint2 will eventually refresh.

note: Bunch of code is missing to check for actual pid/mpv playback (maybe later).

Last edited by brontosaurusrex (2017-09-30 10:41:51)

Offline

#4 2017-09-29 22:46:34

hhh
That's it!
Registered: 2015-09-17
Posts: 7,250
Website

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

ah, thanks. radioClicky play has it running, but no slash in the systray yet.

-edit- lol, your station is currently doing caller "Yo' mamma is...' jokes. Good times.

Offline

#5 2017-09-29 23:00:48

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,715

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

There is no "play" in latest version, check if you are up to date. Edit: It's not a systray, it's an executor thing.

Last edited by brontosaurusrex (2017-10-01 05:45:34)

Offline

#6 2017-09-30 00:39:54

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

radioClicky - hehe, this just too cool!   cool   It worked fine for me from terminal (not the tint2 stuff so far). While trying it out I also received "line 13 no such process" error messages, but I might have done something wrong.

If you check the running processes, you might notice "youtube-dl". Starting mpv with --no-ytdl stops running it.

For the life of me I could not filter out the url for xray.fm in FF (at least the one in the network tab did not work...

Offline

#7 2017-09-30 07:47:37

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,715

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

"line 13 no such process"

@martix, Thats missing code for actual check, rm ~/tmp/radiopid should fix it.

mpv with --no-ytdl

Fixed.

Also noticed that older tint (stretch version) will not refresh the status after click (it will eventually on interval), don't know how to fix that and I don't want to do another continuous kind of script, it's pain to do.

For the life of me I could not filter out the url for xray.fm in FF

http://listen.xray.fm:8000/stream

(In FF inspector under network/other)

Last edited by brontosaurusrex (2017-09-30 11:48:50)

Offline

#8 2017-09-30 14:22:31

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

^Many thanks for the link! Great to have this radio-url, I was looking for it several times.

I'm not sure what I'm doing wrong, all I find under network/other is "Remote adress: 195.181.217.58:443" - which is not the stream.

I'm wondering: Is the original idea having a "/" or "\" in the system tray and clicking on it turn on/off the radio? Anyhow it's a great little tool for the terminal even without tint2.

Offline

#9 2017-09-30 17:37:38

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,715

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

martix wrote:

I'm wondering: Is the original idea having a "/" or "\" in the system tray and clicking on it turn on/off the radio? Anyhow it's a great little tool for the terminal even without tint2.

Certainly could be seen somewhere, so I can't claim that, hardly an idea anyway smile

Offline

#10 2017-09-30 19:36:40

hhh
That's it!
Registered: 2015-09-17
Posts: 7,250
Website

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

Not to rain on bronto's parade, but if anyone wants a more flexible systray radio icon...
https://github.com/ebruck/radiotray-ng

Offline

#11 2017-09-30 20:50:57

obscurant
Member
Registered: 2017-08-06
Posts: 114

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

^ That's neat, but I like the idea of rex's simple script.. It works here at the command line, but left, right-clicking the / on thint2 has no effect. I also like the radio streams posted.

For what it's worth, here's Kevin Smith's "Smodcast Internet Radio." Some shows are better than others, and it's very NSFW language.

http://64.150.176.42:8242/stream

Offline

#12 2017-10-01 04:26:55

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,715

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

@obscuration,  a. Perhaps post your tint2rc and tint2 --version.
b. To see what's going on, (debug) start tint2 from terminal and click around.
edit: I have added long&boring install instructions to first post ^.

Last edited by brontosaurusrex (2017-10-01 06:25:03)

Offline

#13 2017-10-04 06:58:00

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,715

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

Added openbox pipe menu option as an option, it's pretty awesome at this point imho (almost brilliant).

Last edited by brontosaurusrex (2017-10-04 06:58:43)

Offline

#14 2017-10-04 09:05:27

obscurant
Member
Registered: 2017-08-06
Posts: 114

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

brontosaurusrex wrote:

@obscuration,  a. Perhaps post your tint2rc and tint2 --version.
b. To see what's going on, (debug) start tint2 from terminal and click around.
edit: I have added long&boring install instructions to first post ^.

It works great now. I upgraded to tint2 15.2, not sure if that's related the issue I had.

brontosaurusrex wrote:

Added openbox pipe menu option as an option, it's pretty awesome at this point imho (almost brilliant).

It's really cool and minimal.

Last edited by obscurant (2017-10-04 09:07:04)

Offline

#15 2017-10-04 10:14:46

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

^Oh, it works for you on 15.2? Hmmm, I must be doing something wrong... I have all the packages, added E, starting in terminal shows correctly "panel items: LTSCE", code added to the end of tint2rc too, I can even see tint2 showing in terminal "tint2: Executing: radioClicky # echo status / or \"-messages but there is nothing to see in tint2. Tried also LTSEC and ELTSC, changed font type and size - no luck.

Otherwise it's really cool from command line, that 'almost' can be surely removed from the title. Unfortunately radionomy has geoblocking but the other stations work great.

Last edited by martix (2017-10-04 10:22:38)

Offline

#16 2017-10-04 11:17:03

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,715

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

@martix: post your tint2rc?

Offline

#17 2017-10-04 19:11:42

obscurant
Member
Registered: 2017-08-06
Posts: 114

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

The version of mpv shipped with Bundenlabs Hydrogen doesn't support the --no-ytdl switch, or the lavfi switch, and will fail.

Error parsing option no-ytdl (option not found)
Setting commandline option --no-ytdl= failed.
Exiting... (Fatal error)
[libav] AVFilterGraph: No such filter: 'loudnorm'
[lavfi] Can't configure libavfilter graph.
Reinitialization did not work, audio filter 'lavfi' returned error code -2
Could not create audio filter chain.
Error at audio filter chain pre-init!
Audio: no audio

Nor does the version in jessie backports (not sure if they're the same version).

It works fine without those switches though.

Offline

#18 2017-10-04 19:17:47

mrneilypops
The BL Scrot.Moe Guy
From: luxembourg
Registered: 2015-09-30
Posts: 538
Website

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

@brontosaurusrex
NICE WORK! bookmarked for dwmXS inclusion  wink

Offline

#19 2017-10-04 22:30:39

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,715

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

obscurant wrote:

The version of mpv shipped with Bundenlabs Hydrogen doesn't support the --no-ytdl switch, or the lavfi switch, and will fail.

Error parsing option no-ytdl (option not found)
Setting commandline option --no-ytdl= failed.
Exiting... (Fatal error)
[libav] AVFilterGraph: No such filter: 'loudnorm'
[lavfi] Can't configure libavfilter graph.
Reinitialization did not work, audio filter 'lavfi' returned error code -2
Could not create audio filter chain.
Error at audio filter chain pre-init!
Audio: no audio

Nor does the version in jessie backports (not sure if they're the same version).

It works fine without those switches though.

Thanks for reporting, will think about how to catch and report bad exists, if there is a low verbosity stderr switch that will work with modern and older mpvs. Or at least catch mpv exiting with error. Until then I'd stick that under 'configure the script'. p.s. Another option is to change entire model to running mpv as slave, don't know if it's really worth bothering (It will make script at least two times larger and it's getting quite fat even without that).

edit: status function should now at least catch the situation when player has exited and pidfile is still there (status echoes when running radioClicky with no switches), eventually showing something like '/ err', showing ' \ ', basically I'am scripting around instead of attacking real problem (flaky model).

Last edited by brontosaurusrex (2017-10-05 01:40:12)

Offline

#20 2017-10-04 22:33:56

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,715

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

mrneilypops wrote:

@brontosaurusrex
NICE WORK! bookmarked for dwmXS inclusion  wink

Cool and thanks.

Offline

#21 2017-10-05 00:19:31

obscurant
Member
Registered: 2017-08-06
Posts: 114

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

brontosaurusrex wrote:

edit: status should now catch the situation when player has exited and pidfile is still there (status echoes when running radioClicky with no switches), eventually showing something like '/ err', basically I'am scripting around instead of attacking real problem (flaky model).

Could that be displayed in the tooltip?

I have another issue, that I think is tint2 related. It seems that the exec button on tint2 is caching old versions of radioClicky. Even after restarting tint2, deleting the contents of /tmp, and rebooting. This doesn't happen in cli, only the tint2 exec button.

It's still using a version of radioClicky from two versions ago, before you added the --no-ytdl and lavfi switches, and before you added the multiple streams array. And pasting in new stream URLs won't change the stream the tint2 exec button plays. The path in tint2 is correct.

So it's like tint2 caches the entire script somewhere.

Offline

#22 2017-10-05 01:45:33

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,715

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

Could that be displayed in the tooltip?

Actually changed my mind, it will just clean up (delete pidfile) and show off ' \ ' now, 'err' is not a useful error anyway.

pasting in new stream URLs won't change the stream the tint2 exec button plays

Clicking off/on is what should 'restart' the script, including the new urls.

tint2 --version 

says?

Last edited by brontosaurusrex (2017-10-05 03:12:17)

Offline

#23 2017-10-05 02:04:26

obscurant
Member
Registered: 2017-08-06
Posts: 114

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

brontosaurusrex wrote:

Clicking off/on is what should restart the script, including the new urls.

That's how I'm using it. By clicking on/off.  But I'm trying some different things. Hopefully if it persists, I'll be able to explain it better. It's playing a stream URL that no longer exist in radioClicky though. Strange.

tint2 --version 

15.2

Last edited by obscurant (2017-10-05 02:11:01)

Offline

#24 2017-10-05 02:11:24

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,715

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

Pretty sure it's not tint2 issue (I have tested behaviorism on two machines now and never saw something like that), try the latest version of the script perhaps (It is working just fine with just one stream in array as well).

Last edited by brontosaurusrex (2017-10-05 02:13:34)

Offline

#25 2017-10-05 14:47:16

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Re: radioClicky, almost brilliant radio for your tint2 and ob pipemenu

brontosaurusrex wrote:

@martix: post your tint2rc?

I guess it's something with my system config... At least I know now that it works fine with tint2 (15.2) and I double checked all the tint2rc settings. However: I had an older tint2 version and I tried to update it after adding bunsen-stretch-backports but it simply did not work (in the end updated it via gitlab). And after startint the system, tint2 shows the last digit of the clock in a second line (too narrow tint2) but: Simply killall tint2 and starting it via tint2 again fixes it (after system start somehow it does not uses the actual tint2rc settings. Why? I'm not sure, but I'll investigate it).

And a tip for using radioClicky: Using bashrc for aliases for radioClicky-commands makes it even more comfortable using the radio via command line.

Last edited by martix (2017-10-05 14:48:18)

Offline

Board footer

Powered by FluxBB