Skip to content
Browse files

kill dead gettag code

  • Loading branch information...
1 parent a7d63c5 commit 90d58fff9333a25908469f1757aa1fbf62bd4410 @comotion committed Oct 30, 2012
Showing with 2 additions and 56 deletions.
  1. +2 −56 web/lib/getracks.lua
View
58 web/lib/getracks.lua
@@ -6,6 +6,7 @@ module("getracks",package.seeall)
--id3 = require "lib.meta.id3-lua" -- doesnt handle UTF16
--id3 = require "lamt.id3v1" -- fucken v1
--local id3v2 = require "lamt.id3v2"
+-- lesson learned: libs suck!
package.path = package.path..";lib/?.lua;lib/?/?.lua"
local u = require "util"
@@ -16,62 +17,7 @@ local md5 = require "md5"
local json = require "cjson"
local p = require "lamt.tagfrompath"
local types,info,edit = unpack(require "lamt.mpeg")
-
-function getv2tags(path)
- --tag = id3.getV1(file) --or id4.getV2(file,"artist")
- --tag = id3.readID3(file)
- --tag = id3.readtags(file) -- id3-lua
- local file = assert(io.open(path, 'rb'))
- local off, header,get = id3v2.find(file)
- local tag
- if off then
- ok,tag = pcall(id3v2.read,get,header)
- end
- if not ok or not tag then
- -- fail
- return nil, "tag fail"
- else
- -- clean up tags, unpacking table{table} things
- for k,v in pairs(tag) do
- if type(v) == "table" then
- v = u.join(v)
- tag[k] = v
- end
- end
- tag.path = path
- --print(json.encode{path,tag})
- return tag
- end
-end
-
-function notag(path)
- -- Tag matching patterns
- -- Let tags be guessed by file paths
- -- Tags are surrounded by //
- -- //_// is a junk operator
- -- ? makes the preceding character optional
-pat = {
- Basic = "//Artist// - //Title//" ;
- Daurn = "//Album Artist//, //Album// ?{?//Release//}? ?(?D?i?s?c? ?//Disc//)?/[//Track//] //Artist// - //Title//" ;
- Track = "//Artist// - //Album// - //_////Track//.? ?//Title//";
- TF = "//Artist// - //Album// - //_////Track// -? ?//Title//";
- EAC = "//Artist// - //Album// (//Year//)//_/////Track// - //Title//" ;
-}
- -- Default - must be the name of a pattern from above.
- -- fucks up with:
- -- ["Sonny Boy Williamson II - Nine Below Zero - The Blues Collection 10\/10 - Bring It On Home.mp3",{"artist":"Sonny Boy Williamson II - Nine Below Zero - The Blues Collection 10 - 10","title":"Bring It On Home"}]
- -- ["karifon\/04 Blodtørst.m4a",{"artist":"karifon","title":"04 Blodtørst"}]
- -- ["Sleep\/Sleep - 1995 - Jerusalem\/03 - Jerusalem (pt. 3).mp3",{"artist":"Sleep - Sleep - 1995 - Jerusalem - 03","title":"Jerusalem (pt. 3)"}]
- -- ["Melissa auf der Maur\/Out Of Our Minds 2010\/09 - Father's Grave.mp3",{"artist":"Melissa auf der Maur - Out Of Our Minds 2010 - 09","title":"Father's Grave"}]
-
- local info
- if not info then info = p.info(path,pat.Basic) end
- -- could run track match if /(%d+) ?
-
- if not info then info = p.info(path,pat.Track) end
- --print(json.encode{path,info})
- return info
-end
+local BUFSIZE = 1048576
for path in io.lines() do
tag = {}

0 comments on commit 90d58ff

Please sign in to comment.
Something went wrong with that request. Please try again.