Erland, in -bitrates.cb.xml- the Bitrates are presented -reverse
alphabetically sorted- (instead of numerically sorted).

This is due to the following code you use:

Code:
--------------------
    
                        <menudata>
                                select case when lossless=1 then 'Lossless' 
else floor((bitrate+16000)/32000)*32000 end as calculatedbitrate,case when 
lossless=1 then 'Lossless' else concat(floor((bitrate+16000)/32000)*32,' kbps') 
end from tracks 
                                where 
                                        audio=1 
                                group by calculatedbitrate
                                order by calculatedbitrate desc
                        </menudata>
  
--------------------


The "case" statement will always return the "compatible aggregated type
of all return values", which is -STRING- in this case. Thus, numerical
bitrate values will be sorted alphabetically instead.

Unfortunately, the "Lossless" in the SELECT cannot be represented by
some arbitrary number like -MaxInt- in order to always get a numeric
result, because further searches would then fail.

I came up with a "quick 'n' dirty" solution to patch up my Bitrates
menu, but maybe you have a better idea?

I use a zero-padded "calculatedbitrate" string for now, but there must
surely be a better solution. Here’s the code:


Code:
--------------------
    
                        <menudata>
                                select case when lossless=1 then 'Lossless' 
else right(concat('00000000000',floor((bitrate+16000)/32000)*32000),11) end as 
calculatedbitrate,case when lossless=1 then 'Lossless' else 
concat(floor((bitrate+16000)/32000)*32,' kbps') end from tracks 
                                where 
                                        audio=1 
                                group by calculatedbitrate
                                order by calculatedbitrate desc
                        </menudata>
  
--------------------


-- 
Moonbase

Moonbase: 'The Problem Solver' (http://www.kaufen-ist-toll.de/moonbase)
------------------------------------------------------------------------
Moonbase's Profile: http://forums.slimdevices.com/member.php?userid=21594
View this thread: http://forums.slimdevices.com/showthread.php?t=49483

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to