I`ve been trying to get file hooks in the browser/ Drag and drop to work but without success.
Ive been trying something similar to the following code which prints "hook_added: other true" fine, so I know the hook has been registered as far as the tool is concerned. However when I try and load a renamed text document as a .Timbuktu file, it does not appear as a registered file in the renoise browser
other` category so is not bolded there and will not override as it should?
--file hook values
local my_extensions = {"Timbuktu"}
local my_print = function(filename) print("Timbuktu Loaded") end
local browser_cat = "other"
--file hook table
local def_table = {category = browser_cat,
extensions = my_extensions,
invoke = my_print}
--if no hook add it
if not renoise.tool():has_file_import_hook(browser_cat,my_extensions) then
renoise.tool():add_file_import_hook(def_table)
end
--THIS PRINT WORKS CONFIRMING HOOK ADDED BUT .Timbuktu FILES ARE NOT REGISTERED IN BROWSER?
print("hook_added: "..browser_cat.." "..tostring(renoise.tool():has_file_import_hook(browser_cat, my_extensions)))
Here is some code from Mxb`s fileformats tool which does seem to register in the browser.
function snd_integration_func(filename)
mpc2000_loadsample(filename, nil, renoise.song().selected_sample, nil)
return true
end
snd_integration = { category = "sample",
extensions = {"snd"},
invoke = snd_integration_func} -- returns true
if renoise.tool():has_file_import_hook("sample", {"snd"}) == false then
renoise.tool():add_file_import_hook(snd_integration)
end