-- uFlow plugin 1 return { api = 1, id = "library-tools", name = "Library Tools", version = "1.0", filters = {{ id = "publisher", label = "With publisher", match = function(game) return game.publisher ~= "" end }}, sorts = {{ id = "developer", label = "Developer, then title", key = function(game) return string.lower(game.developer) end }}, subtitles = {{ id = "credits", label = "Publisher and year", text = function(game) if game.publisher == "" then return game.year end if game.year == "" then return game.publisher end return game.publisher .. " (" .. game.year .. ")" end }}, contentTypes = {{ id = "ds", name = "DS homebrew", extensions = {".nds"}, launcher = "noods" }}, actions = {{id = "result", label = "Last publisher count"}}, run = function(action, view, state) return state.summary or "Run Count publishers first." end, jobs = {{ id = "tally", label = "Count publishers", prompt = { title = "Count publishers", text = "Count games with publisher information in the current view?", choices = {{id = "start", label = "Start count"}} }, run = function(view, state, report, choice) local count = 0 for i = 1, view.count do if view.game(i).publisher ~= "" then count = count + 1 end if i % 64 == 0 then report(math.floor(100 * i / view.count), "Counting games") end end state.summary = count .. " of " .. view.count .. " games have a publisher." return state.summary end }} }