Skip to content

Instantly share code, notes, and snippets.

@mallomar
Last active November 18, 2025 06:30
Show Gist options
  • Select an option

  • Save mallomar/22176237a7c72b585b802db83d67b38f to your computer and use it in GitHub Desktop.

Select an option

Save mallomar/22176237a7c72b585b802db83d67b38f to your computer and use it in GitHub Desktop.
User patch to filter JPEG files from Project:Title Library Mode (Requires Project:Title plugin: https://github.com/joshuacant/ProjectTitle)
-- User patch to hide JPG and JPEG files in Project Title Library Mode
-- This hooks into the CoverMenuGenItemTable function as suggested by Project Title dev Joshua Cant
local function filterJPEGFiles(items)
local filtered_items = {}
for i, item in ipairs(items or {}) do
local filename = item.text or ""
local filepath = item.path or ""
-- Check if the file is a JPEG (case-insensitive)
local is_jpeg = string.match(filename:lower(), "%.jpe?g$") or
string.match(filepath:lower(), "%.jpe?g$")
-- Only include non-JPEG files
if not is_jpeg then
table.insert(filtered_items, item)
end
end
return filtered_items
end
-- Hook into Project Title's CoverMenuGenItemTable function
local function patchCoverMenuGenItemTable()
-- Try different ways to access the function
local success = false
-- Method 1: Try to find it in the global namespace
if _G.CoverMenuGenItemTable then
local original_func = _G.CoverMenuGenItemTable
_G.CoverMenuGenItemTable = function(dirs, files, path)
local items = original_func(dirs, files, path)
return filterJPEGFiles(items)
end
success = true
end
-- Method 2: Hook into require to catch when covermenu module loads
local original_require = require
require = function(module_name)
local result = original_require(module_name)
-- Check if this is Project Title's covermenu
if string.find(module_name:lower(), "covermenu") and type(result) == "table" then
-- Try to patch the function if it exists
if result.CoverMenuGenItemTable then
local original_func = result.CoverMenuGenItemTable
result.CoverMenuGenItemTable = function(dirs, files, path)
local items = original_func(dirs, files, path)
return filterJPEGFiles(items)
end
success = true
elseif result.genItemTable then
local original_func = result.genItemTable
result.genItemTable = function(self, dirs, files, path)
local items = original_func(self, dirs, files, path)
return filterJPEGFiles(items)
end
success = true
end
end
return result
end
return success
end
-- Apply the patch
patchCoverMenuGenItemTable()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment