disable timeknob and coverart if webradio

Suggestions/requests/ideas for RuneAudio core features and functions

disable timeknob and coverart if webradio

Postby waves » 15 Jan 2015, 09:21

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.
waves
 
Posts: 125
Joined: 31 Dec 2014, 10:33

Re: disable timeknob and coverart if webradio

Postby ACX » 15 Jan 2015, 14:57

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.
User avatar
ACX
RuneAudio co-founder
 
Posts: 1692
Joined: 29 Nov 2013, 02:25
Location: Udine, Italy

Re: disable timeknob and coverart if webradio

Postby ACX » 15 Jan 2015, 15:50

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.
User avatar
ACX
RuneAudio co-founder
 
Posts: 1692
Joined: 29 Nov 2013, 02:25
Location: Udine, Italy

Re: disable timeknob and coverart if webradio

Postby waves » 15 Jan 2015, 20:48

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 :)
waves
 
Posts: 125
Joined: 31 Dec 2014, 10:33

Re: disable timeknob and coverart if webradio

Postby waves » 16 Jan 2015, 13:58

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');
waves
 
Posts: 125
Joined: 31 Dec 2014, 10:33

Re: disable timeknob and coverart if webradio

Postby waves » 16 Jan 2015, 16:14

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
waves
 
Posts: 125
Joined: 31 Dec 2014, 10:33

Re: disable timeknob and coverart if webradio

Postby ACX » 16 Jan 2015, 20:28

Yes. Have you managed to get the desired result?
User avatar
ACX
RuneAudio co-founder
 
Posts: 1692
Joined: 29 Nov 2013, 02:25
Location: Udine, Italy

Re: disable timeknob and coverart if webradio

Postby waves » 16 Jan 2015, 22:02

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
 
Posts: 125
Joined: 31 Dec 2014, 10:33

Re: disable timeknob and coverart if webradio

Postby ACX » 17 Jan 2015, 03:55

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
User avatar
ACX
RuneAudio co-founder
 
Posts: 1692
Joined: 29 Nov 2013, 02:25
Location: Udine, Italy

Re: disable timeknob and coverart if webradio

Postby robertinjo » 19 Jan 2015, 20:57

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
robertinjo
 
Posts: 27
Joined: 10 Jan 2015, 16:30
Location: Croatia, Zagreb

support RuneAudio Donate with PayPal

Next

Return to Feature request

Who is online

Users browsing this forum: No registered users and 0 guests