FreshStuff3 5.0 RC8
 

FreshStuff3 5.0 RC8

Started by bastya_elvtars, 20 May, 2008, 22:30:45

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bastya_elvtars

OK, here it is (attached). Changelog:

r114 | bastya_elvtars | 2008-05-20 22:18:53 +0200 | 3 lines

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)

------------------------------------------------------------------------
r113 | bastya_elvtars | 2008-05-17 21:32:00 +0200 | 6 lines

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.lua
Changed: the topadders displaying was reworked and optimized


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

merlin_xl54

Quote from: bastya_elvtars on 20 May, 2008, 22:30:45
OK, here it is (attached). Please test it. Thanks.

The lib & libnew folders are empty. I copied from rc7 and it seems to work so far. Was I correct? I'm still quite new at this.

PtokaX 0.4.0.0 & 0.4.1.0RC7

Case sensitive works. ;D
Note- You can add a request even if it is in the database as a release.

Thanks again,

M
Living is easy with eyes closed.

gouos

doesnt work ....

[17:42] Składnia freshstuff.lua:57: module 'pxlfs' not found:
   no field package.preload['pxlfs']
   no file 'C:/ptokax/scripts/freshstuff/pxlfs.lua'
   no file 'C:/ptokax/scripts/freshstuff/libnew/pxlfs.dll'

bastya_elvtars

Archive above updated, please redownload it, forgot to include libs.
@merlin: this is very low priority, won't fix now
Everything could have been anything else and it would have just as much meaning.

P_pan

script is working fine now B_E.. :)

although i still get the msg...
but it still works fine...
ya doing a very great job..
to please us!

Thank You...

bastya_elvtars

Yeah, you will get that message. Do you consider it annoying? (Only operators get it.)
Everything could have been anything else and it would have just as much meaning.

merlin_xl54

#6
Quote from: bastya_elvtars on 21 May, 2008, 19:57:54
Archive above updated, please redownload it, forgot to include libs.

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?

[2008-05-21 13:01] ...kaX 0.4.0.0/scripts/freshstuff/components/extras.lua:67: bad argument #1 to 'concat' (table expected, got number)
[2008-05-21 13:01] <usernick> !topadders

[2008-05-21 15:59] ...kaX 0.4.0.0/scripts/freshstuff/components/extras.lua:67: bad argument #1 to 'concat' (table expected, got number)
[2008-05-21 15:59] <usernick> !topadders

TIA,

M

Edit, We only use 1 category and the rest were removed.
Edit 2, I played around and it happens after a new release is added. If I delete that release it works again etc.
Living is easy with eyes closed.

P_pan

no sir the msg  aint np at all for me :)

gouos

i have questions,
- why only ops see release/reqests in right click?

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

- 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 = 30

is mean after 30 days my release will be deleted? couse i dont want...

ps, sorry, my english is not good...:(

merlin_xl54

Quote from: gouos on 22 May, 2008, 20:22:16
- why only ops see release/reqests in right click?.

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 = 30
is 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.

M
Living is easy with eyes closed.

gouos

thx M:)
del music:) all good, but still see only ops. no, i dont make anything in that files. i delete all, freshstuff.lua and folder and copy new again. Still not good.
i use DiXBot, mayby that...

bastya_elvtars

gouos, what is the output of !showcats ?
Everything could have been anything else and it would have just as much meaning.

bastya_elvtars

Here is an updated extras.lua. I have rewritten the whole topadders count. Note that it was overcomplicated, I found a much simpler solution.
--[[
Extras for FreshStuff3 v5 by bastya_elvtars
Release pruning and top adders
Distributed under the terms of the Common Development and Distribution License (CDDL) Version 1.0. See docs/license.txt for details.
]]

local conf = ScriptsPath.."config/extras.lua"
local _,err = loadfile (conf)
if not err then dofile (conf) else error(err) end

function CountTopAdders()
  local TopAdders, TA = {}, {}
  for _, w in ipairs(AllStuff) do
    local _, who = unpack(w)
    TA[who] = TA[who] or 0
    TA[who] = TA[who] + 1
  end
  local TAC = 0
  for name, number in pairs(TA) do
    local x = TopAdders[number]
    if x then
      TopAdders[number] = x..", "..name
    else
      TopAdders[number] = name
      TAC = TAC+1
    end
  end
  TA=nil; collectgarbage ("collect"); io.flush()
  return TopAdders, TAC
end

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.."):]"}]=0
rightclick[{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.")
Everything could have been anything else and it would have just as much meaning.

merlin_xl54

Quote from: bastya_elvtars on 22 May, 2008, 21:29:26
Here is an updated extras.lua. I have rewritten the whole topadders count. Note that it was overcomplicated, I found a much simpler solution.

Tested with 0.4.0.0 & 0.4.1.0rc7 with great success ;D I thank you once again!

Thanks,

M
Living is easy with eyes closed.

Tommy666

Don?t know what?s wrong with the top adders count.

For some reason I always get the top 2 release adders, even if I want to see more:

The top 2 release-addders sorted by the number of releases are:
---------------------------------
Ironkim: 175 items added
Lord_Death: 66 items added

bastya_elvtars

Quote from: Tommy666 on 23 May, 2008, 09:59:26
Don?t know what?s wrong with the top adders count.

For some reason I always get the top 2 release adders, even if I want to see more:

The top 2 release-addders sorted by the number of releases are:
---------------------------------
Ironkim: 175 items added
Lord_Death: 66 items added

OK, did you update your extras.lua? And what is the exact command you are issuing? :o
Everything could have been anything else and it would have just as much meaning.

merlin_xl54

FYI Just a test update. I added a category and all worked fine. I then tried to delete it and got the following.

[2008-05-23 10:30] <Post-It_Memo>
======================
Available categories:
======================

Test      Test
music      music

[10:32:01] ... 0.4.0.0/scripts/freshstuff/components/requester.lua:233: bad argument #1 to 'remove' (string expected, got nil)
[10:32:01] <usernick> !delcat Test

It shows that it was deleted, and after restarting the scrip it works fine.

[2008-05-23 10:34] <Post-It_Memo>
======================
Available categories:
======================

music      music

It allso creates a new "requests_non_comp20080523103201" and releases20080523103217dat file.

Just thought you may want the info.

M

* I use 1 category so it is not a problem, just testing things.
Living is easy with eyes closed.

Tommy666

Quote from: bastya_elvtars on 23 May, 2008, 15:18:44
OK, did you update your extras.lua? And what is the exact command you are issuing? :o

Normally I use right click, when I add 1 as number it shows me the number 1 top adder, but with every other number I get the top 2 adders.

I have to say that I have 4 categorys. Everything else works fine.

Running Ptokax PtokaX 0.4.1.0RC7

and as allinone script Leviathan v 4.0, there I had to remove the inbuilt release bot, as it is not the way I wanted it.

But this is not the problem as I have tested with disabled Leviathan v 4.0 and still only get the top 2 adders. And yes I have updated  the extra.lua.

Well at the moment I have disabled the topadders command, but it would be cool to enable it again if it works like it should.




Tommy666

Ok, I reinstalled the whole new Freshstuff version, and deleted the old one from the script folder. And now it works!

Seems there was a small problem with copying and overwriting the old file.

Anyway it works now!

I really love your release bot!

bastya_elvtars

Quote from: merlin_xl54 on 23 May, 2008, 16:57:35
[10:32:01] ... 0.4.0.0/scripts/freshstuff/components/requester.lua:233: bad argument #1 to 'remove' (string expected, got nil)
[10:32:01] <usernick> !delcat Test

It shows that it was deleted, and after restarting the scrip it works fine.

Fixed, I'll post the final version.
Everything could have been anything else and it would have just as much meaning.

bastya_elvtars

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

SMF spam blocked by CleanTalk