XBMC Community Forum
[AppleTV2] MySQL database / library support? - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: XBMC General Help and Support (/forumdisplay.php?fid=111)
+---- Forum: iOS support (/forumdisplay.php?fid=137)
+---- Thread: [AppleTV2] MySQL database / library support? (/showthread.php?tid=91485)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26


- haffi - 2011-03-05 16:02

Advocate Wrote:For the moment I'm giving up on the whole path substitution/remote thumbnails thing. Having to do one thing for the ATV2 and something completely different for the other machines on the network is frankly a bit ridiculous.

We need to get to the stage where all artwork is stored in the MySQL database, including banners, posters, cleararts, logos etc. This would also make skinning that much easier as all the different kinds of artwork would just need to be called by their correct name (eg listitem.banner listitem.poster etc)

For now I'll scrape on the Mac Pro and periodically copy the thumbnails directory from there to the other machines.

anyone know if this is something that is beeing worked on ? causeit sound like the right thingto do


a DB is a DB - TheRealDL - 2011-03-05 21:13

I vote against putting ANY artwork into the DB. I feel that performance on the MySQL DB is slow enough that throwing (in my case) over 500MB of artwork at it is counter productive.

The SAMBA shortcuts work perfectly on iOS and will be rolled into the Desktop releases. In the mean time, a couple of Symlinks ain't half bad.

That said, why is my iPad and iPhone 4 soooo much slower using XBMC than the Apple TV?? Battery vs. ACConfused??

Cheers!

PS... Looks as though it's possible to implement DB storage with FUSE but I don't know if XBMC will be able to use it.
Linux.com::Using MySQL as a filesystem


MySQL DB with both ATV2 and Nightlies - Odon - 2011-03-05 21:17

I don't really know if it has been talked about, but i've found a way to use the same Video database for both AppleTV2 official release and Nigthly build (DB Version >42): mysql-proxy. It can be used to fake database response to a query.

Install mysql-proxy (see link above) (for debian, just: apt-get install mysql-proxy)

Create a lua script:
Code:
function read_query( packet )
   print(proxy.connection.client.src.address)
   if string.byte(packet) == proxy.COM_QUERY then
     local query = string.sub(packet, 2)
     if string.match(string.upper(query), '^%s*SELECT IDVERSION FROM VERSION')
     then
       proxy.response.type = proxy.MYSQLD_PACKET_OK
       proxy.response.resultset = {
         fields = {
                    {
                      type = proxy.MYSQL_TYPE_INT,
                      name = "idVersion",
                    },
                  },
         rows = { { 42 } }
       }
       return proxy.PROXY_SEND_RESULT
     else
       return proxy.PROXY_SEND_QUERY
     end
   end
end

and then launch mysql-proxy with this script, in my case:
Code:
/usr/bin/mysql-proxy --max-open-files 1024 --proxy-lua-script=/etc/mysql/XBMCatv42.lua --proxy-address=0.0.0.0:3307 --proxy-backend-addresses=127.0.0.1:3306

where:
- /etc/mysql/XBMCatv42.lua is the path to my script
- 127.0.0.1:3306 is the address of mysql server (here, same host for both mysql and mysql-proxy)
- 0.0.0.0:3307 configure mysql-proxy to wait for connection on port 3307
- --max-open-files 1024 is to avoid a critical error i had when launching mysql-proxy

(on debian, you can edit /etc/default/mysql-proxy to enable launch start and change option with previous ones)

Then in your ATV2 advancedsettings.xml change mysql address and port to mysql-proxy address / port only for video DB (or music DB won't work anymore) (eventually add <port>...</port> if missing).

To avoid potential side effect you can add a default value to the new field since DB version 42 (I think it can avoid problem when updating DB from ATV2)
Code:
ALTER TABLE `xbmc_video`.`settings` CHANGE COLUMN `VerticalShift` `VerticalShift` FLOAT NULL DEFAULT 0.0  ;



- mod24 - 2011-03-06 13:03

Hi all,

I have a very strange Problem regarding a centralized MYSQL-DB and path substitution on ATV2 and IPAD.

I've got two linux boxes running xbmc with a central mysql-db on a synology NAS. The Datasources for Video and Music are mounted as NFS on those boxes. Now I recently bought an ATV2, jailbreaked it and installed latest XBMC (Nightly Build, but also tried the release) on it. I want to use the Database here as well and used the pathsubstitution for getting my Thumbnails to work and to translate the Video-Sources from nfs to smb.
Now everything seems to work well, thumbnails get loaded and if I want to look tv-shows the substitution just works as i want it to work. The only thing I can't get to work for 2 weeks now are my movies. The movies are on the same source as the tv-shows just in a different subfolder. But if I want to watch ANY movie, I get a dialouge asking me, if I want to delete the Movie from the DB, since the file cannot be found. I cannot understand, since the same substitiuntion for the same source works well with the tv-shows.

I already enabled Debug-logging and I can see the smb-calls for the Screenshots (loading .tbn files), but I cannot even see a call for the movie. I just see that the delete-dialouge (yesno.xml, or so) get's loaded.

I am really stuck in this situation and I hope that anyone from you might help me out, since I really have no further idea. It would be easier for me to comprehend if nothing regarding the subsitution would work, but having 50% working and 50% not without any obvious reason is driving me insane.

I appreciate any feedback on this.

Kind Regards
Michael

P.s.: Excuse my bad english, i am obviously no native speaker


- vicbitter - 2011-03-06 16:06

mod24 Wrote:Hi all,

I have a very strange Problem regarding a centralized MYSQL-DB and path substitution on ATV2 and IPAD.

I've got two linux boxes running xbmc with a central mysql-db on a synology NAS. The Datasources for Video and Music are mounted as NFS on those boxes. Now I recently bought an ATV2, jailbreaked it and installed latest XBMC (Nightly Build, but also tried the release) on it. I want to use the Database here as well and used the pathsubstitution for getting my Thumbnails to work and to translate the Video-Sources from nfs to smb.
Now everything seems to work well, thumbnails get loaded and if I want to look tv-shows the substitution just works as i want it to work. The only thing I can't get to work for 2 weeks now are my movies. The movies are on the same source as the tv-shows just in a different subfolder. But if I want to watch ANY movie, I get a dialouge asking me, if I want to delete the Movie from the DB, since the file cannot be found. I cannot understand, since the same substitiuntion for the same source works well with the tv-shows.

I already enabled Debug-logging and I can see the smb-calls for the Screenshots (loading .tbn files), but I cannot even see a call for the movie. I just see that the delete-dialouge (yesno.xml, or so) get's loaded.

I am really stuck in this situation and I hope that anyone from you might help me out, since I really have no further idea. It would be easier for me to comprehend if nothing regarding the subsitution would work, but having 50% working and 50% not without any obvious reason is driving me insane.

I appreciate any feedback on this.

Kind Regards
Michael

P.s.: Excuse my bad english, i am obviously no native speaker

Are you able to post your advancedsettings.xml and xbmc.log? Without these it is difficult to provide help.


- freaksworth - 2011-03-06 17:43

Odon Wrote:I don't really know if it has been talked about, but i've found a way to use the same Video database for both AppleTV2 official release and Nigthly build (DB Version >42): mysql-proxy. It can be used to fake database response to a query.

Install mysql-proxy (see link above) (for debian, just: apt-get install mysql-proxy)

Create a lua script:
Code:
function read_query( packet )
   print(proxy.connection.client.src.address)
   if string.byte(packet) == proxy.COM_QUERY then
     local query = string.sub(packet, 2)
     if string.match(string.upper(query), '^%s*SELECT IDVERSION FROM VERSION')
     then
       proxy.response.type = proxy.MYSQLD_PACKET_OK
       proxy.response.resultset = {
         fields = {
                    {
                      type = proxy.MYSQL_TYPE_INT,
                      name = "idVersion",
                    },
                  },
         rows = { { 42 } }
       }
       return proxy.PROXY_SEND_RESULT
     else
       return proxy.PROXY_SEND_QUERY
     end
   end
end

and then launch mysql-proxy with this script, in my case:
Code:
/usr/bin/mysql-proxy --max-open-files 1024 --proxy-lua-script=/etc/mysql/XBMCatv42.lua --proxy-address=0.0.0.0:3307 --proxy-backend-addresses=127.0.0.1:3306

where:
- /etc/mysql/XBMCatv42.lua is the path to my script
- 127.0.0.1:3306 is the address of mysql server (here, same host for both mysql and mysql-proxy)
- 0.0.0.0:3307 configure mysql-proxy to wait for connection on port 3307
- --max-open-files 1024 is to avoid a critical error i had when launching mysql-proxy

(on debian, you can edit /etc/default/mysql-proxy to enable launch start and change option with previous ones)

Then in your ATV2 advancedsettings.xml change mysql address and port to mysql-proxy address / port only for video DB (or music DB won't work anymore) (eventually add <port>...</port> if missing).

To avoid potential side effect you can add a default value to the new field since DB version 42 (I think it can avoid problem when updating DB from ATV2)
Code:
ALTER TABLE `xbmc_video`.`settings` CHANGE COLUMN `VerticalShift` `VerticalShift` FLOAT NULL DEFAULT 0.0  ;

... thanks! that's really helpful. Nod


- TheRealDL - 2011-03-06 18:44

Your english is far better than mine mate.

MEthinks that your NFS connections are the issue you're having with the ATV.

You MUST create the MySQL DB with your datasources connected via SMB for the ATV to see the video files, otherwise the database populates with whatever path you have connected at the time. I had the same problem with the DB and the files on the same machine. I had to create SMB sources even though the files were local.

Try creating a test DB, create a temp advancedsettings.xml that points to your test db on one linux box, connect to your data via SMB on the test box, Import a few vids for testing, reconfig the ATV to point at the test DB. You should have everything!

Cheers!

mod24 Wrote:Hi all,

I have a very strange Problem regarding a centralized MYSQL-DB and path substitution on ATV2 and IPAD.

I've got two linux boxes running xbmc with a central mysql-db on a synology NAS. The Datasources for Video and Music are mounted as NFS on those boxes. Now I recently bought an ATV2, jailbreaked it and installed latest XBMC (Nightly Build, but also tried the release) on it. I want to use the Database here as well and used the pathsubstitution for getting my Thumbnails to work and to translate the Video-Sources from nfs to smb.
Now everything seems to work well, thumbnails get loaded and if I want to look tv-shows the substitution just works as i want it to work. The only thing I can't get to work for 2 weeks now are my movies. The movies are on the same source as the tv-shows just in a different subfolder. But if I want to watch ANY movie, I get a dialouge asking me, if I want to delete the Movie from the DB, since the file cannot be found. I cannot understand, since the same substitiuntion for the same source works well with the tv-shows.

I already enabled Debug-logging and I can see the smb-calls for the Screenshots (loading .tbn files), but I cannot even see a call for the movie. I just see that the delete-dialouge (yesno.xml, or so) get's loaded.

I am really stuck in this situation and I hope that anyone from you might help me out, since I really have no further idea. It would be easier for me to comprehend if nothing regarding the subsitution would work, but having 50% working and 50% not without any obvious reason is driving me insane.

I appreciate any feedback on this.

Kind Regards
Michael

P.s.: Excuse my bad english, i am obviously no native speaker



- freaksworth - 2011-03-06 18:51

Quote:You MUST create the MySQL DB with your datasources connected via SMB for the ATV to see the video files, otherwise the database populates with whatever path you have connected at the time. I had the same problem with the DB and the files on the same machine. I had to create SMB sources even though the files were local.
... I think that's what path substitution is actually made for. To translate local paths in DB to remote ones.


- TheRealDL - 2011-03-06 21:15

I thoroughly agree and I am hoping for NFS support on all XBMC clients very soon but I believe the iOS clients currently only support SMB.

freaksworth Wrote:... I think that's what path substitution is actually made for. To translate local paths in DB to remote ones.



- zosky - 2011-03-06 23:05

TheRealDL Wrote:I thoroughly agree and I am hoping for NFS support on all XBMC clients very soon but I believe the iOS clients currently only support SMB.

(thanks to the popularity of winBlows) SMB has been made to work on all platforms & can be built into xbmc ... so mySQL+SMB = a platform agnostic solution.

i have 3 xbmc boxes (all linux, all NFS ). i asked the same on IRC & was told NFS needs kernel extensions which can't be done on iOS.

the path substitution works, but there are a bunch of movies & tv shows that dont play in iOS because the path or file contains a windows special character, like (:,') Frown