2011-03-11, 00:22
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.if your mysql proxy is on the same as the mysql host then itd be the same IP for the proxy, correct?
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 ;
also, - 0.0.0.0:3307 configure mysql-proxy to wait for connection on port 3307 - do i need to put something in place of those 0s?
windows people, how can i setup it to run that entire command without command prompt?