Page 1 of 2

disable timeknob and coverart if webradio

PostPosted: 15 Jan 2015, 09:21
by waves
I want to disable the timeknob and coverart on the playback tab when playing webradio. The timeknob is of no use for live streams and the webradios I listen to have no coverart so that box only wastes space (extra scrolling to reach the volume knob on android device).

To do this I need to add some conditional statements to playback.php, similar to this
Code: Select all
<?php if ($this->coverart == 1): ?>

but instead of checking for coverart I want to check if the currently playing item is not a webstream. Can you describe the php syntax for such a check?

I posted in "feature request" since I found no better forum category for this post. And I do request an option to disable timeknob and coverart for webstreams. But for know I mostly want to know the syntax so I can myself manually modify the playback.php on my pi.

Re: disable timeknob and coverart if webradio

PostPosted: 15 Jan 2015, 14:57
by ACX
You should do that on the client side with Javascript, as the webradio info comes in realtime from the Nginx Pushtream Module channel and the UI updates consequently.

Go in this file:
https://github.com/RuneAudio/RuneUI/blo ... /runeui.js

Look inside the function
Code: Select all
function refreshState()

You'll find some conditionals around like this:
Code: Select all
if (GUI.stream === 'radio')

Use that to show/hide the parts of the UI that you don't need, using the jQuery method addClass('hide') to hide and removeClass('hide') to show them.

Re: disable timeknob and coverart if webradio

PostPosted: 15 Jan 2015, 15:50
by ACX
Oh, I forgot that you have to minify the file into this one
https://github.com/RuneAudio/RuneUI/blo ... eui.min.js
after the mod.

Re: disable timeknob and coverart if webradio

PostPosted: 15 Jan 2015, 20:48
by waves
Thanks, I'll give that a try and report back here later. I've been poking around the code and that js file already tried out a few modifications. Mostly disabling stuff to make the UI even more minimal. That is one great thing with local server/browser software - users can jump right in and start change things up on their local install very easily. (... and also break things. But reinstalls are cheap :)

Re: disable timeknob and coverart if webradio

PostPosted: 16 Jan 2015, 13:58
by waves
I'm new to javascript compression. I did a quick test with http://jscompress.com/ but RA then seems to overwrite the resulting runeui.min.js file on boot with a default one. What tool should I use to minify?

Once I've figured out minify I will try these commands:
$('#timeknob').addClass('hide');
$('#timeknob').removeClass('hide');

Re: disable timeknob and coverart if webradio

PostPosted: 16 Jan 2015, 16:14
by waves
Ok, took another stab at minify and got it working now with http://gpbmike.github.io/refresh-sf/ .

There are two active
Code: Select all
if (GUI.stream === 'radio')
checks in runeui.js (a third is commented out and can be ignored). For both of the active checks I added
Code: Select all
$('#timeknob, #repeat, #random, #single, #cover-art').addClass('hide');

to the if actions and
Code: Select all
$('#timeknob, #repeat, #random, #single, #cover-art').removeClass('hide');

to the else actions.
Minify the code and save (overwrite) runeui.min.js

Re: disable timeknob and coverart if webradio

PostPosted: 16 Jan 2015, 20:28
by ACX
Yes. Have you managed to get the desired result?

Re: disable timeknob and coverart if webradio

PostPosted: 16 Jan 2015, 22:02
by waves
Yes! The above edits to runeui.js + minifying did the trick. The timeknob and coverart are autohidden when playing a stream and autoshown again when playing a file from usb storage.

Not that using the online minify tool is any problem or anything but just out of curiousity is there a command line tool bundled with RuneAudio for minifying?

Re: disable timeknob and coverart if webradio

PostPosted: 17 Jan 2015, 03:55
by ACX
I use UglifyJS with Grunt to automate the process on every edit.
If you want to perform that manually, here's a online tool:
https://marijnhaverbeke.nl/uglifyjs

Re: disable timeknob and coverart if webradio

PostPosted: 19 Jan 2015, 20:57
by robertinjo
waves wrote:Yes! The above edits to runeui.js + minifying did the trick. The timeknob and coverart are autohidden when playing a stream and autoshown again when playing a file from usb storage.

Not that using the online minify tool is any problem or anything but just out of curiousity is there a command line tool bundled with RuneAudio for minifying?


waves, can You share the files edited or process in detail, so that I, without knowledge in JS can replace them or edit them to achieve same thing?

I have problem with CPU usage when playing radio streams, so that could be a hack so solve it...

Thanks