Skip to content

Commit

Permalink
teh fix0rz
Browse files Browse the repository at this point in the history
  • Loading branch information
comotion committed Nov 19, 2012
1 parent 7f25319 commit 2f255c9
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
4 changes: 4 additions & 0 deletions TODO
@@ -1,6 +1,10 @@

What to do and how:

+ file upload fucks up!
+ empty searches
+ getracks 01.fuck yuo

- get_next:
knows about silences, metadata, can queue songs
knows about shows & jingles
Expand Down
10 changes: 8 additions & 2 deletions web/hangover.lua
Expand Up @@ -74,7 +74,7 @@ function getfile(file)
-- XXX: mayhap we shouldn't accept anything other than audio/?
t.contenttype = string.gsub(string.gsub(file['content-type'], "audio",""), "/","")
t.extension = file.name:gmatch(".(%w+)$")()
local dest,tname = u.open_temp_file(temp_dir.."/hangover_up@@@")
local dest, tname = u.open_temp_file(temp_dir.."/hangover_up@@@")
local bytes = file.contents
if not dest then
return nil,json.encode{{status="fail",reason="bad tempfile, baad"}}
Expand All @@ -85,13 +85,16 @@ function getfile(file)
print("["..os.date("%c", t.submitted).. "] '"..t.filename.."' -> "..tname)
print("'"..t.filename .. "'".." " .. os.difftime(os.time(), t.submitted).."s")
t.md5 = crypto.digest("md5", bytes)
local destname = t.md5..t.extension-- krav's pathless filename
local destname = t.md5..'.'..t.extension-- krav's pathless filename
t.path = tracks_path .. "/" .. destname
print("now moving ... ".. tname .. ' path: '..t.path)
os.execute('mkdir -p '..tracks_path)
local rc, err = os.rename(tname, t.path)
if not rc then
return nil, json.encode{{status="fail", reason=err}}
end
print("'"..destname.. "'".." " .. os.difftime(os.time(), t.submitted).."s")
print(u.dump(t));
return t
end

Expand All @@ -102,6 +105,9 @@ function post_db(web,...)
local id, file = web.POST.id, web.POST.file
if file then -- someone is uploading a mix
t, some = getfile(file)
if not t then
return some
end
-- attempt id3 extraction / file metadata
tags, failure = meta.gettags(t.path, t)
if not tags then
Expand Down
2 changes: 1 addition & 1 deletion web/lib/lamt
Submodule lamt updated from 1c6f6e to 6a2772
23 changes: 21 additions & 2 deletions web/lib/program.lua
Expand Up @@ -13,8 +13,9 @@
-- { id, name, [selector, playlist]}
require "os"
require "math"
local db = require "lib.tokyo"
local u = require "lib.util"
local db = require "lib.tokyo"
--local tracks = require "lib.tracks"
local u = require "lib.util"

module("program", package.seeall)

Expand All @@ -23,6 +24,24 @@ function program:init()
end
prg = program:init()

program = {
name = "zonkas kronkas",
start = 123556127,
time = '12:45',
day = "sunday",
duration = '60 minutes',
recur = 'weekly',
stop = 133377777,
selector = { artist='mama', mood='evening' },
selector = "zabu cronik",
playlist = { 1, 3, 4, 10, 42 },
}


function selector(search)
end


function program:put(pkey,cols)
return tokyo:put(prg,pkey,cols)
end
Expand Down

0 comments on commit 2f255c9

Please sign in to comment.