summaryrefslogtreecommitdiff
path: root/nopsyncd/playlog.lua
diff options
context:
space:
mode:
Diffstat (limited to 'nopsyncd/playlog.lua')
-rw-r--r--nopsyncd/playlog.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/nopsyncd/playlog.lua b/nopsyncd/playlog.lua
index 3aa0361..37b9ea6 100644
--- a/nopsyncd/playlog.lua
+++ b/nopsyncd/playlog.lua
@@ -25,6 +25,8 @@ require "luasql.mysql"
-- GRANT select,insert,update ON rhnop.* TO 'nopsyncd' IDENTIFIED BY '123456';
-- CREATE TABLE IF NOT EXISTS now (timestamp VARCHAR(16) PRIMARY KEY NOT NULL, cart INT NOT NULL, len INT, showtitle VARCHAR(255), title VARCHAR(255), artist VARCHAR(255), album VARCHAR(255), ismusic BOOLEAN)
+conf = require "conf"
+
local playlog = {}
function playlog:init()
@@ -35,7 +37,7 @@ function playlog:init()
return nil, err
end
- self.con, err = self.env:connect("rhnop", "nopsyncd", "123456", "127.0.0.1")
+ self.con, err = self.env:connect(conf.playlog_db, conf.playlog_user, conf.playlog_pwd, conf.playlog_host, conf.playlog_port)
if self.con == nil then
return nil, err
end
@@ -59,7 +61,7 @@ function playlog:getLastCart()
return cart
end
-function playlog:insertMusic(timestamp, cart, len, title, artist, album)
+function playlog:insertNowMusic(timestamp, cart, len, title, artist, album)
cart = tonumber(cart)
len = tonumber(len)
if cart < 400000 or cart > 450000 then
@@ -67,7 +69,6 @@ function playlog:insertMusic(timestamp, cart, len, title, artist, album)
else
poolnum = math.floor(cart/1000) - 399
end
- -- usage of undocumented escape function...
local cur, err = self.con:execute("INSERT into now VALUES(" .. self.con:escape(timestamp) .. ", " .. cart .. ", " .. len .. ", 'Musikpool " .. poolnum .. "', '" .. self.con:escape(title) .. "', '" .. self.con:escape(artist) .."', '" .. self.con:escape(album) .. "', 1)")
if cur == nil then
return nil, err