diff --git a/code/handlers/roothandler.lua b/code/handlers/roothandler.lua
index fd41169..d23f155 100644
--- a/code/handlers/roothandler.lua
+++ b/code/handlers/roothandler.lua
@@ -1,19 +1,17 @@
local to_json = require("lapis.util").to_json
local autoload = require("lapis.util").autoload
local config = require("lapis.config")
-
--- print(to_json(config.get()))
-
local hotmixes = autoload("hotmixes")
local function Roothandler(self)
- local stuff = hotmixes.utils.these_files( hotmixes.utils.data_path )
- local latest_path, latest_name = hotmixes.utils.these_latest()
+ local path = config.get().mount .. self.titles.url
+ local stuff = hotmixes.utils.these_files( path .. hotmixes.utils.request_path )
+ local latest_path, latest_name = hotmixes.utils.these_latest( path )
- self.total = hotmixes.utils.total_files_dir( config.get().mount )
+ self.total = hotmixes.utils.total_files_dir( path )
self.uri = hotmixes.utils.request_path
- self.path = '/data' .. hotmixes.utils.request_path
+ self.path = '/data/' .. self.titles.url .. hotmixes.utils.request_path
self.dirs = stuff.dirs
self.files = stuff.files
self.images = stuff.images
diff --git a/code/hotmixes/utils.lua b/code/hotmixes/utils.lua
index ad7acba..ab58432 100644
--- a/code/hotmixes/utils.lua
+++ b/code/hotmixes/utils.lua
@@ -41,7 +41,7 @@ utils['match_image'] = function( file )
end
end
-utils['latest_files'] = function(directory)
+utils['latest_files'] = function( directory )
local i, t, popen = 0, {}, io.popen
local pfile = popen('find "'..directory..'" -type f ! -name \'*.filepart\' -printf \'%C@ %p\n\'| sort -nr | head -7 | cut -f2- -d" "| sed s:"'..directory..'/"::')
for filename in pfile:lines() do
@@ -80,17 +80,14 @@ utils['these_files'] = function( path )
return stuff
end
-utils['these_latest'] = function()
+utils['these_latest'] = function( path )
-- list last 10 modified files in our directory
local latest_path, latest_name = {}, {}
- for i, file_path in ipairs( utils.latest_files( data_dir ) ) do
- file_path = file_path:gsub( data_dir, "/" )
+ for i, file_path in ipairs( utils.latest_files( path ) ) do
+ file_path = file_path:gsub( path, "/" )
table.insert( latest_path, file_path)
- -- local to_json = require("lapis.util").to_json
- -- print( to_json(latest_path) )
-
local temp = ""
local result = ""
for i = file_path:len(), 1, -1 do
diff --git a/code/views/layout.etlua b/code/views/layout.etlua
index e47c9ab..a3d6f19 100644
--- a/code/views/layout.etlua
+++ b/code/views/layout.etlua
@@ -23,7 +23,7 @@