Linux (OpenELEC 3.2.0) Video Party Mode fails with MySQL database
#1
Hi All,

I'm cross posting this on here and on OpenELEC as I am not sure where the issue lies (in the git version they pulled for the 3.2.0 or if it is still present in the latest committed master git version).

The OE build is based on Git:68a881d and compiled on Sep 12 2013.

--

This may not be specifically related to this version of OpenElec as I've only just enabled MySQL as a backend so I can have the libraries shared between the three OpenELEC installations in the house.

I can post this up on XBMC as well if that helps.

When I run a Video Party Mode on my Music Videos it issues the following query to the db:

select * from musicvideoview where idMVideo not in (112,344,211,99,128,310,213,235,148,63) order by RANDOM() limit 1;

This is all well and good except MySQL doesn't have a RANDOM() function it uses RAND() instead! When I substitute RAND for RANDOM in the above query on the database directly it works perfectly. This is common over both the Generic and Intel versions I run.

I end up with the following in the log:

20:50:44 T:140079770117952 DEBUG: GetRandomMusicVideo query = select * from musicvideoview where idMVideo not in (112,344,211,99,128,310,213,235,148,63) order by RANDOM() limit 1
20:50:44 T:140079770117952 ERROR: SQL: Undefined MySQL error: Code (1305)
Query: select * from musicvideoview where idMVideo not in (112,344,211,99,128,310,213,235,148,63) order by RANDOM() limit 1
20:50:44 T:140079770117952 ERROR: GetRandomMusicVideo (idMVideo not in (112,344,211,99,128,310,213,235,148,63)) failed

followed by (when I actually acknowledge the error):

20:51:01 T:140079770117952 DEBUG: LIRC: Update - NEW at 53201780:160 0 KEY_OK devinput (KEY_OK)
20:51:01 T:140079770117952 DEBUG: OnKey: 11 (0b) pressed, action is Select
20:51:01 T:140079770117952 DEBUG: ------ Window Deinit (DialogOK.xml) ------
20:51:01 T:140079770117952 ERROR: PARTY MODE MANAGER: Cannot get songs from database. Aborting.

Thanks and Regards,

Brett
Reply
#2
I have cheated at the moment and this does not quite work as designed as the original query will not select any of the songs already in the next 10 songs but this will allow it to still work.

You need access to your MySQL database and type the following:

> delimiter $$
> create FUNCTION RANDOM() RETURNS int BEGIN DECLARE retVal int; DECLARE countVal int; select count(*) into countVal from musicvideoview; select FLOOR(1 + RAND() * (countVal - 1)) into retVal; RETURN retVAL; END;$$
> delimiter ;

This will create a function RANDOM that will ONLY work for the music videos at the moment. It suffices for me though.

Thanks,

Brett

I'll add this when I fix it! D'oh! Fixed function.
Reply

Logout Mark Read Team Forum Stats Members Help
(OpenELEC 3.2.0) Video Party Mode fails with MySQL database0