Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#!/usr/bin/env lua
-- This file:
-- http://angg.twu.net/youtube-db/ydb
-- http://angg.twu.net/youtube-db/ydb.html
--  (find-angg        "youtube-db/ydb")
--
-- «.package.path»	(to "package.path")
-- «.srinivas»		(to "srinivas")
-- «.ls_db_angg»	(to "ls_db_angg")
-- «.big_db_angg»	(to "big_db_angg")
-- «.lr_db_angg»	(to "lr_db_angg")
-- «.url_to_fname_angg»	(to "url_to_fname_angg")
-- «.dooptions»		(to "dooptions")
--   «.simple2»		(to "simple2")


-- «package.path» (to ".package.path")
-- (find-blogme3 "blogme3.lua" "blogmedir")
fnamedirectory    = function (fname) return fname:match"^(.*/)[^/]*$"  end
fnamenondirectory = function (fname) return fname:match     "([^/]*)$" end
youtubedbdir      = (arg and fnamedirectory(arg[0])) or "./"
package.path      = youtubedbdir .. "?.lua;" .. package.path

posix = require "posix"
require "edrxlib"       -- (find-ydb "edrxlib.lua")
require "ydbtoolbox"    -- (find-ydb "ydbtoolbox.lua")



-- «ls_db_angg» (to ".ls_db_angg")
ls_db_angg = function (url)
    local y = YoutubeDB.new()
    y:ls("/sda5/videos/")
    y:ls("/sda5/videos/Math/")
    -- y:ls("/sda5/videos/hoop/")
    -- y:ls("/sda5/videos/manifs/")
    -- y:ls("/sda7/videos/manifs/")
    -- y:ls("/sda5/videos/kristi/")
    -- y:ls("/sda5/videos/calculo2/")
    -- y:ls("/sda5/videos/bellydance/")
    -- y:ls("/sda5/videos/shibari/")
    -- y:ls("/sda5/videos/scarlatti/")
    return y
  end

-- «big_db_angg» (to ".big_db_angg")
big_db_angg = function ()
    local y = YoutubeDB.new()
    -- print(y:read("~/linkdasruas2.txt"))
    print(y:read("~/linkdasruas3.org"))
    print(y:read0(youtube_db_string))
    print(y:read0(youtube_dbu_string))
    print(y:run("grep youtu ~/TODO"))
    print(y:run("grep youtu ~/varda/TODO"))
    print(y:run("grep youtu ~/ORG/index.org"))
    print(y:run("grep youtu ~/varda/index.org"))
    return y
  end

-- «lr_db_angg» (to ".lr_db_angg")
lr_db_angg = function ()
    -- return YoutubeDB.new():read("~/linkdasruas2.txt")
    return YoutubeDB.new():read("~/linkdasruas3.org")
  end

-- «url_to_fname_angg» (to ".url_to_fname_angg")
url_to_fname_angg = function (url)
    return ls_db_angg():url_to_fname(url)
  end



-- «dooptions» (to ".dooptions")
-- Adapted from:
-- (find-dn5 "options.lua")

dooption_fake = function ()
    ys.fake = YScripts.fake()
  end
dooption_local = function (url)
    local fname = url_to_fname_angg(url)
    if not fname then return end
    print(fname)
  end
dooption_nohtml = function ()
    ys.nohtml = 1
  end
dooption_simple0 = function (stem)   -- old, obsolete, will be deleted...
    simple_toplevel {dir="/tmp/videos/", stem=stem}
  end
dooption_simple = function (stem)
    simple_toplevel2(ys, stem)
  end

_O = _O or {}
_O["-fake"]    = function (...)       dooption_fake(); dooptions(...) end
_O["-local"]   = function (url, ...)  dooption_local(url); dooptions(...) end
_O["-nohtml"]  = function (...)       dooption_nohtml(); dooptions(...) end
_O["-simple0"] = function (stem, ...) dooption_simple0(stem); dooptions(...) end
_O["-simple"]  = function (stem, ...) dooption_simple(stem); dooptions(...) end

dooptions = function (optionname, ...)
    -- PP("o", optionname, ...)
    if not    optionname  then return end
    if not _O[optionname] then
      error(format("Not in _O (for dooptions): %q", optionname))
    end
    -- PP(optionname, ...)
    _O[optionname](...)
  end

ys = ys or YScripts.real()
dooptions(...)





-- Local Variables:
-- coding: raw-text-unix
-- mode: lua
-- End: