25 lines
591 B
Lua
25 lines
591 B
Lua
|
|
local apiSync = {
|
||
|
|
|
||
|
|
syncHashtags = function(opts)
|
||
|
|
local synced = 0
|
||
|
|
local tags = opts.tags
|
||
|
|
if #tags == 0 then table.insert(tags,'') end
|
||
|
|
foreach( tags, function(k,tag)
|
||
|
|
local url = opts.apiCall( #tag > 0 and tag or nil)
|
||
|
|
opts.body = nil -- erase previous url result
|
||
|
|
print('🤞 fetch ' .. url)
|
||
|
|
local t = opts.fetch(url,opts)
|
||
|
|
if t then
|
||
|
|
synced = synced + opts.download(t,tag)
|
||
|
|
end
|
||
|
|
end, true)
|
||
|
|
if synced > 0 then
|
||
|
|
app.plugin.diskscan.scan(app.opts.plugin_diskscan_dir)
|
||
|
|
end
|
||
|
|
return synced
|
||
|
|
end
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
return apiSync
|