[Solved] Sort Webradio list

Volumio achieves what it set out to - I was up and running in 5 minutes, streaming albums from my Windows (eek!) server and adding all my favourite radio channels. I love the clean no fuss interface. However, what I can’t abide is a random list of radio channels. How do I sort the list of channels in Webradio?

I have:
BBC Radio 5
BBC Radio 1 Extra
BBC Radio 3
BBC Radio 4
BBC Radio 1

You get the picture.

Please help.

dont know exactly how volumio sorts the webradio.
try it first with renaming the files.
If this doesn´t work, try it with recreating the files in the order it should be displayed in volumio.

Hi Chaos

If you are comfortable editing the code, modify /var/lib/inc/player_lib.php

Line 617 becomes
#return array_merge($dirArray, $plistArray);
$tmp = array_merge($dirArray, $plistArray);
foreach ($tmp as $key => $row) {
$filename[$key] = $row[‘file’];
}
array_multisort($filename, SORT_ASC, $tmp);
return $tmp;

Then reboot.

Hi AussieRules

I applied succesfully your solution and is fantastic!!!
now the webradio item are sorted! WOW!!!

thanks a lot!!

Great Stuff @AussieRules!

Not sure if it was a typo but on my Volumio 1.55 box the file is

/var/www/inc/player_lib.php

I’m a linux-newbie, could someone explain a bit better how to do this modification?
The file to modify is /var/lib/inc/player_lib.php or /var/www/inc/player_lib.php?
Thanks.

I think AussieRules made a typo… in Volumio v1.55 its /var/www/inc/player_lib.php :smiley:

Here’s my pre-edited file, (its from Volumio v1.55). Save a copy of the original (eg rename it player_lib.php.original) then unzip and copy my file to /var/www/inc/ folder.

New edited file posted further down!

this is out of date:
player_lib.zip (12.1 KB)

Thank you Sog Sussex for the file: it works well with my B+ and Volumio 1.55 :wink:

Also many thanks! Works excellent!

Thanks from here, too! I hate unsorted lists :slight_smile:

Unfortunately this fix also messes up the playlist queue :blush: I will post back when I’ve sussed a fix :nerd:

UPDATE
ok, heres the new edits:

in /var/www/inc/player_lib.php on line 579
change

function _parseFileListResponse($resp) {

to

function _parseFileListResponse($resp, $plylst) {

then change line 339 from

return _parseFileListResponse($playqueue);

to

return _parseFileListResponse($playqueue, 'true');

if you’ve not added the earlier fix
change on line 617

	return array_merge($dirArray, $plistArray);

to

	#return array_merge($dirArray, $plistArray);
	$tmp = array_merge($dirArray, $plistArray);
	if ($plylst != 'true'){
		foreach ($tmp as $key => $row){
		$filename[$key] = $row['file'];
		}
		array_multisort($filename, SORT_ASC, $tmp);
	}
	return $tmp;

if you have applied the earlier fix edit the code to include the ‘if ($plylst != ‘true’){’ line. and then line the ‘}’ (on its own line just above ‘return $tmp;’) as shown above.

I’ll post the edited file soon…

ok, heres the new pre-edited file from v1.55

player_lib.zip (12.1 KB)

Thanks :wink: