Fixed: dupe release checking is case-insensitive (thanks to merlin_xl54 for spotting)Fixed: requests not being shown after script restart/incorrect loading/etc (thanks to merlin_xl54 and P_pan for testing)

Fixed: requests were improperly loaded thus the bot always said there aren't any (reported by merlin_xl54)Fixed: the case when there are less adders than the default number raised an error (reported by 2ceedz)Fixed: a relative path variable remained in kernel.luaChanged: the topadders displaying was reworked and optimizedPlease test it. Thanks.

« Last Edit: 21 May, 2008, 19:57:16 by bastya_elvtars »

Logged

Everything could have been anything else and it would have just as much meaning.

Have it up on the Hub (150 users 7000 releases)and all works fine so far but Releases > Show top release-adders... Results in the following. Using PtokaX 0.4.0.0. I restarted it when I added the new lib, and it seemed to work then stopped again. A lot of releases were added I'm not sure if it needs time to sort it out etc?

All users can see in our Hub. Did you change any files? Main/config will show levels.

Quote

- when i want delete category: !delcat Music bot give me info: ?release? The category Music does not exist.

cCase Ssensitive - Try music

Quote

- and what is mean?-- This is the maximum age of the item (in days).-- After this, release pruning will delete it.-- Pruning is always manual and releases get backed up when run.MaxItemAge = 30is mean after 30 days my release will be deleted? couse i dont want...

If you manually delete releases it will only save 30 days. All will stay if you don't Delete Old releases.

--[[Extras for FreshStuff3 v5 by bastya_elvtarsRelease pruning and top addersDistributed under the terms of the Common Development and Distribution License (CDDL) Version 1.0. See docs/license.txt for details.]]

do setmetatable (Engine,_Engine) Engine[Commands.Prune]= { function (nick,data,env) if #AllStuff == 0 then return "There is nothing to prune.",1 end setmetatable (AllStuff,nil) local Count=#AllStuff local days=data:match("(%d+)") days=days or MaxItemAge local cnt=0 local x=os.clock() local oldest=days*1440*60 local filename = ScriptsPath.."data/releases"..os.date("%Y%m%d%H%M%S")..".dat" if #AllStuff > 0 then table.save(AllStuff, filename) end for i=#AllStuff,1,-1 do local diff=JulianDiff(JulianDate(SplitTimeString(AllStuff[i][3].." 00:00:00"))) if diff > oldest then HandleEvent("OnRelDeleted", nick, i) table.remove(AllStuff,i) cnt=cnt+1 end end if cnt ~=0 then table.save(AllStuff,ScriptsPath.."data/releases.dat") ReloadRel() else os.remove (filename) end return "Release prune process just finished, all releases older than "..days.." days have been deleted from the database. "..Count.." items were parsed and "..cnt.." were removed. Took "..os.clock()-x.." seconds.",4 end, {},Levels.Prune,"<days>\t\t\t\t\tDeletes all releases older than n days, with no option, it deletes the ones older than "..MaxItemAge.." days." } Engine[Commands.TopAdders]= { function (nick, data, env) local TopAdders, TAC = CountTopAdders() local num num = tonumber (data) or TopAddersCount if num > TAC then num = TAC end local tmp2 = {} for num, ppl in pairs(TopAdders) do table.insert(tmp2, {["N"] = num, ["P"] = ppl} ) end table.sort(tmp2, function(a, b) return a.N > b.N end) local msg="\r\nThe top "..num.." release-addders sorted by the number of releases are:\r\n"..("-"):rep(33).."\r\n" for nm = 1, num do msg=msg..tmp2[nm].P..": "..tmp2[nm].N.." items added\r\n" end return msg,2 end, {},Levels.TopAdders,"<number>\t\t\t\tShows the n top-release-adders (with no option, defaults to 5)." }end

rightclick[{Levels.Prune,"1 3","Releases\\Delete old releases","!"..Commands.Prune.." %[line:Max. age in days (Enter=defaults to "..MaxItemAge.."):]"}]=0rightclick[{Levels.TopAdders,"1 3","Releases\\Show top release-adders","!"..Commands.TopAdders.." %[line:Number of top-adders (Enter defaults to 5):]"}]=0

module ("Extras",package.seeall)ModulesLoaded["Extras"] = true

function OnCatDeleted (nick, id) SendOut (nick..": "..id)end

function OnRelDeleted (nick, n) local who = AllStuff[n][2]end

SendOut("*** "..Bot.version.." 'extras' module loaded.")

Logged

Everything could have been anything else and it would have just as much meaning.