FreshStuff3 5.0 RC7
 

FreshStuff3 5.0 RC7

Started by bastya_elvtars, 11 May, 2008, 18:54:25

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

bastya_elvtars

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

merlin_xl54

Thank you...

The problem with requests having an error when users are offline and connect was fixed and works fine! Nice.

Thanks again..

M
Living is easy with eyes closed.

P_pan

Thank You again B_E  !

Annie

If i wanted to add an extra category like tv series   how do i get it to show in the right click




merlin_xl54

Quote from: Annie on 14 May, 2008, 10:21:58
If i wanted to add an extra category like tv series   how do i get it to show in the right click

Do you have add a category on the R-Click now? You can do it there, or in the freshstuff/data/categories lua file. Restart the script and your client.

M
Living is easy with eyes closed.

Annie

Thank you its working now :D

merlin_xl54

I seem to be loosing the added requests when freshstuff is restarted. Also, it may happen other times but I'n not 100% sure on that. Running PtokaX 0.4.0.0, freshstuff rc7, Snowball War and PXCommands. I tried running just freshstuff and it still happens. So the other scripts don't seem to make a difference.

[12:40:35] <Post-It_Memo> Your request has been saved, you will have to wait until it gets fulfilled. Thanks for your patience!
[12:40:52] <Post-It_Memo>
--------- All The Requests --------
music
---------------------------------

ID: 1   Test - 0000 - test // (Added by nick)

--------- All The Requests --------

Restart script.

[12:41:07] <Post-It_Memo>


--------- All The Requests --------

There are no requests now, everyone seems to be satisfied.

--------- All The Requests --------

Not sure if anything can be changed. Also do/should the requests stay untill filled?

TIA

M


Living is easy with eyes closed.

merlin_xl54

#7
Quote from: bastya_elvtars on 17 May, 2008, 19:16:41
Requests stay until filled. BTW I can confirm the error.
Edit: bug found and fixed. Here is the updated requester.lua:

Just tried it and have same problem :(

I use Strong 2.12

Edit, I also have custom catogories if that matters.
Living is easy with eyes closed.

bastya_elvtars

Code above updated, please try again.
(ARGH, the 3rd party SVN repo is also down.)
Everything could have been anything else and it would have just as much meaning.

merlin_xl54

#9
Quote from: bastya_elvtars on 17 May, 2008, 20:42:29
Code above updated, please try again.
(ARGH, the 3rd party SVN repo is also down.)

Looks like that was it! Thanks so much!!!! I will continue to test and reply if need be.

[15:23:19] Loaded 1 requests in 0 seconds.

Thanks for your fast reply,

M

Edit, [15:35:04] Loaded 14 requests in 1600000000326 seconds.

Requests were still there just did not load ;D
Living is easy with eyes closed.

bastya_elvtars

#10
Yes, they persisted on disk but they have been wiped from memory afterwards.
Attached is a reissue of RC7. It fixes this issue and fixes a topadders bug and another low severity bug.
Everything could have been anything else and it would have just as much meaning.

P_pan

looks to me it stil aint fixed with the updated requester.lua...

it simply says that the dat file doesnt exsist....  while ya restart thes script.......

bastya_elvtars

What is the exact error message? Do you have any requests at all? :)
Everything could have been anything else and it would have just as much meaning.

P_pan

the exact error after restarting the script is this :
[11:23:38] cannot open C:/Leo/scripts/freshstuff/data/requests_comp.dat: No such file or directory

while sure the datfile is there....

rolling back to rc7 works fine....

bastya_elvtars

What is your PtokaX version? With RC7 it works fine here.
BTW I realized that it is NOT a problem if there is no requests file.
Everything could have been anything else and it would have just as much meaning.

P_pan

hubsoft is 0.4.0.0.....
i really can't find this error...

the files are in proper place..
never did change that..

but what i did find out out is

when getting rid of the old  dat file
im able to place a reqest and it does show up.....
but.. when restarting the script again ill get the same error
although the datfile is created correctly.

weird......

bastya_elvtars

Try with 0.4.1.0 RC7 please.
Everything could have been anything else and it would have just as much meaning.

merlin_xl54

#17
Quote from: bastya_elvtars on 17 May, 2008, 21:41:30
Yes, they persisted on disk but they have been wiped from memory afterwards.
Attached is a reissue of RC7. It fixes this issue and fixes a topadders bug and another low severity bug.

I use PtokaX 0.4.0.0

I have another issue with the rc7 freshstuff. The requests would not show but were in the request non comp. Kept getting this.

[2008-05-18 16:31] <Post-It_Memo>


--------- All The Requests --------

--------- All The Requests --------
[2008-05-18 16:57] <Post-It_Memo>


--------- All The Requests --------

--------- All The Requests --------
[2008-05-18 17:25] <Post-It_Memo>


--------- All The Requests --------

--------- All The Requests --------
[2008-05-18 17:57] <Post-It_Memo>


--------- All The Requests --------

--------- All The Requests --------



I deleted it and put them back in. All worked fine and today only the first 2 showed in show requests.


This is what the return line is in the request non comp. return {{[1] = {2},[2] = {3},[4] = {4},[5] = {5},[6] = {6},[7] = {7},[8] = {8},[9] = {9},[10] = {10},[11] = {11},},

Seems to miss 3 = 4? Could that be it. There are 11 requests but I edited them out to post.

TIA,

M

Edit, Fixed the sequence to 3 = 4, 4 = 5 etc. They show now. Any reason why it would do that?
Living is easy with eyes closed.

bastya_elvtars

merlin_xl54 could you please send me the contents of requests_non_comp.dat?
Everything could have been anything else and it would have just as much meaning.

merlin_xl54

Quote from: bastya_elvtars on 19 May, 2008, 18:03:13
merlin_xl54 could you please send me the contents of requests_non_comp.dat?

Done with copy of log.

TIA

M
Living is easy with eyes closed.

P_pan

as requested : Try with 0.4.1.0 RC7 please.


results are the same....

bastya_elvtars

#21
I am puzzled because it works fine here. Anyway, here is an updated requester.lua, please try:
--[[
Requester module for freshstuff
You can:
    - add a request
    - list requests
    - delete a request, if you have the right or you are the one who has added it
    - add releases with an extra option that tells the script you are fulfilling a request
    - Note that you can only delete a request from the non-completed ones, completed requests get deleted 
    when the user who requested logs in. If this is a problem, future versions may contain comp. request pruning.
    - It calls OnReqFulfilled when a request is fulfilled. that way, hostapp-specific modules take care of proper user
    notification, which ensures portability.

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/requester.lua"
local _, err = loadfile (conf)
if not err then dofile (conf) else error(err) end

Requests ={Completed = {}, NonCompleted = {}}

do
  setmetatable(Engine,_Engine)
  Engine[Commands.Add]= -- Yeah, we are redeclaring it. :-)
    {-- You enter a number reflecting the request you completed by releasing this (optional).
      function (nick,data)
        setmetatable (AllStuff, 
          {
            __newindex=function (tbl, key, value)
              if #tbl >= #NewestStuff then -- Take care of removing the thing from NewestStuff too
                table.remove (NewestStuff, 1)
              end
              local cat, nick, date, tune = unpack(value)
              table.insert (NewestStuff,{cat, nick, date, tune,key}) -- and the new 'Newest' entry gets added
              rawset(tbl, key, value)
              table.save(tbl,ScriptsPath.."data/releases.dat")
              ShowRel(NewestStuff); ShowRel()
            end
          })
        local reqcomp,cat,tune=string.match(data,"(%d*)%s*(%S+)%s+(.+)")
        if cat then
          if Types[cat] then
            for _,word in pairs(ForbiddenWords) do
              if string.find(tune,word,1,true) then
                return "The release name contains the following forbidden word (thus not added): "..word, 1
              end
            end
            if #AllStuff > 0 then
              for i,v in ipairs(AllStuff) do
                if string.lower(v[4]) == string.lower(tune) then
                  return "The release is already added under category "..v[1].." by "..v[2]..".", 1
                end
              end
            end
            if reqcomp == "" then
              local count = #AllStuff
              AllStuff[count + 1] = {cat,nick,os.date("%m/%d/%Y"),tune}
              HandleEvent("OnRelAdded", nick, data, cat, tune)
              return tune.." is added to the releases as "..cat, 1
            else
              reqcomp = tonumber(reqcomp)
              if Requests.NonCompleted[reqcomp] then
                local done = Requests.NonCompleted[reqcomp]
                if done[2] ~= cat then
                  return "This is not the same category as the request. You have specified "..cat.." while the request's category was "..done[2]..". Request and release have NOT been added.", 1
                else
                  local count = #AllStuff
                  AllStuff[count + 1] = {cat,nick,os.date("%m/%d/%Y"),tune}
                  local username, cat, reqdetails=unpack(done)
--                   Requests.NonCompleted[tonumber(reqcomp)]=nil
                  table.remove (Requests.NonCompleted, reqcomp)
                  Requests.Completed[username]={reqdetails, tune, cat, nick}
                  table.save(Requests.NonCompleted,ScriptsPath.."data/requests_non_comp.dat")
                  table.save(Requests.Completed,ScriptsPath.."data/requests_comp.dat")
                  HandleEvent("OnRelAdded", nick, data, cat, tune)
                  HandleEvent("OnReqFulfilled", nick, data, cat, tune, reqcomp, username, reqdetails)
                  return tune.." is added to the releases as "..cat..". Request #"..reqcomp.." has successfully been fulfilled. Thank you.", 1
                  end
              else
                return "No request with ID "..reqcomp..". Release has NOT been added.",1
              end
            end
            return tune.." is added to the releases as "..cat, 1
          else
            return "Unknown category: "..cat, 1
          end
        else
          return "yea right, like i know what you got 2 add when you don't tell me!",1
        end
      end,
      {},Levels.Add,"<requestnumber> <type> <name>\t\t\t\tAdd release of given type. Enter the number of request that you are fulfilling wih this release, before category and release name (optional)."
    }
    Engine[Commands.AddReq]=
    {
      function(nick,data)
        if data~="" then
          local cat,req = string.match (data,"(%S+)%s+(.+)")
          if cat then
            if not Types[cat] then
              return "The category "..cat.." does not exist.",1
            else
              for _,word in ipairs(ForbiddenWords) do
                if string.find(req,word,1,true) then
                  return "The request name contains the following forbidden word (thus not added): "..word,1
                end
              end
            for nick,tbl in pairs(Requests.Completed) do
              if req == tbl[2] then
                return req.." has already been requested by "..nick.." and has been fulfilled under category "..tbl[3].. " with name "..tbl[2].." by "..tbl[4],1
              end
            end
            for id,tbl in ipairs(Requests.NonCompleted) do
                if tbl[3] == req then
                  return req.." has already been requested by "..tbl[1].." in category "..tbl[2].." (ID: "..id..").",1
                end
              end
            end
            table.insert(Requests.NonCompleted,{nick, cat, req})
            table.save(Requests.NonCompleted,ScriptsPath.."data/requests_non_comp.dat")
            return "Your request has been saved, you will have to wait until it gets fulfilled. Thanks for your patience!",1
          else
            return "yea right, like i know what i got 2 add when you don't tell me!.",1
          end
        end
      end,
      {},Levels.AddReq,"<type> <name>\t\t\t\tAdd a request for a particular release."
    }
    Engine[Commands.ShowReqs]=
    {
      function(nick,data)
        local CatArray={}
        local MsgAll
        local Msg = "\r\n"
        local cat, who, title
        local tmptbl={}
        setmetatable(tmptbl,{__newindex=function(tbl,k,v) rawset(tbl,k,v); table.insert(CatArray,k); end})
        local cunt=0
        if #Requests.NonCompleted == 0 then
          return "\r\n\r\r\n".." --------- All The Requests -------- \r\n\r\nThere are no requests now, everyone seems to be satisfied. :-)\r\n\r\n --------- All The Requests -------- \r\n\r\n", 2
        else
          for key, val in ipairs(Requests.NonCompleted) do
            who, cat, title = unpack(val)
            if who then
              tmptbl[Types[cat]]=tmptbl[Types[cat]] or {}
              table.insert(tmptbl[Types[cat]],Msg.."ID: "..key.."\t"..title.." // (Added by "..who..")")
            end
          end
          for _,a in ipairs (CatArray) do
            local b=tmptbl[a]
            if SortStuffByName==1 then table.sort(b,function(v1,v2) local c1=v1:match("ID:%s+%d+(.+)%/%/") local c2=v2:match("ID:%s+%d+(.+)%/%/") return c1:lower() < c2:lower() end) end
            Msg=Msg.."\r\n"..a.."\r\n"..string.rep("-",33).."\r\n"..table.concat(b).."\r\n"
          end
          return "\r\n\r\r\n".." --------- All The Requests -------- "..Msg.."\r\n --------- All The Requests --------", 2
        end
      end,
      {},Levels.ShowReqs,"<type> <name>\t\t\t\tShow pending requests."
    }
    Engine[Commands.DelReq]=
    {
      function (nick, data)
        if data ~="" and string.find(data,"%d+") then
          local msg = ""
          for req in string.gmatch (data,"(%d+)") do
            req=tonumber(req)
            if Requests.NonCompleted[req] then
              local reqnick=Requests.NonCompleted[req][1]
              if nick == reqnick or Allowed(nick,Levels.DelReq) then
                table.remove(Requests.NonCompleted, req)
                table.save(Requests.NonCompleted,ScriptsPath.."data/requests_non_comp.dat")
                msg=msg.."\r\nRequest #"..req.." has been deleted."
              else
                return "You aren't allowed to delete requests that haven't bee submitted by you.", 1
              end
            else
              msg=msg.."\r\nRequest #"..req.." does not exist."
            end
          end
          return msg, 1
        else
          return "yea right, like i know what i got 2 delete when you don't tell me!.", 1
        end
      end,
      {},1,"<type> <name>\t\t\t\tDelete a request from the non-completed ones."
    }
end

rightclick[{Levels.DelReq,"1 3","Requests\\Delete a request","!"..Commands.DelReq.." %[line:ID number(s):]"}]=0
rightclick[{Levels.ShowReqs,"1 3","Requests\\Show requests","!"..Commands.ShowReqs}]=0

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

function Connected (nick)
  if Requests.Completed[nick] then
    local reqdetails,tune,cat,goodguy=unpack(Requests.Completed[nick])
    Requests.Completed[nick]=nil
    table.save(Requests.Completed, ScriptsPath.."data/requests_comp.dat")
    return "Your request (\""..reqdetails.."\") has been completed! It is named "..tune.." under category "..cat..". Has been addded by "..goodguy,2
  end
end

function Start()
  local file_non, file_comp = ScriptsPath.."data/requests_non_comp.dat", ScriptsPath.."data/requests_comp.dat"
  local x = os.clock()
  local _, e1 = loadfile (file_non)
  local _, e2 = loadfile (file_comp)
  local bErr
  if not e1 then
      Requests.NonCompleted = table.load (file_non)
    if not e2 then
      Requests.Completed = table.load (file_comp)
    else bErr = true end
  else bErr = true end
  e1 = e1 or e2; if e1 then SendOut ("Warning: "..e1) end
  SendOut("Loaded "..#Requests.NonCompleted.." requests in "..os.clock()-x.." seconds.")
  for a,b in pairs(Types) do -- Add categories to rightclick. This MIGHT be possible on-the-fly, just get the DC ÜB3RH4XX0R!!!11one1~~~ guys to fucking document $UserCommand
    rightclick[{Levels.AddReq,"1 3","Requests\\Add an item to the\\"..b,"!"..Commands.AddReq.." "..a.." %[line:Name:]"}]=0
  end
end

function OnCatDeleted (cat)
  table.save(Requests.NonCompleted, ScriptsPath.."data/requests_non_comp"..os.date("%Y%m%d%H%M%S")..".dat")
  local bRemoved
  for key, value in ipairs (Requests.NonCompleted) do
    if value[2] == cat then
      table.remove (Requests.NonCompleted, key)
      bRemoved = true
    end
  end
  if bRemoved then
    table.save(Requests.NonCompleted,ScriptsPath.."data/requests_non_comp.dat")
  else
    os.remove (filename)
  end
  return "Note that incomplete requests have been backed up to "..filename.." in case you have made a mistake.", 1
end

SendOut("*** "..Bot.version.." 'requester' module loaded.")
Everything could have been anything else and it would have just as much meaning.

merlin_xl54

#22
Quote from: bastya_elvtars on 19 May, 2008, 21:41:27
I am puzzled because it works fine here. Anyway, here is an updated requester.lua, please try:

;D

Thanks. It works fine with 0.4.0.0 and 0.4.1.0 RC7. Note# On a small test Hub. When uploaded to the main server I will reply if needed.

Thanks again,

M

I did notice if the Post it window is open when you add a release this happens. Just FYI no big deal.
[23:13:59]  *** User went offline
[23:13:59]  *** User went online [Post-It_Memo - Hub Name] ***


Edit, Is there a way to control release info format? (The Beatles, The beatles, the Beatles, the beatles, etc.) All can be entered which allows for many duplicate entries.
Living is easy with eyes closed.

bastya_elvtars

Quote from: merlin_xl54 on 20 May, 2008, 05:16:26
I did notice if the Post it window is open when you add a release this happens. Just FYI no big deal.
[23:13:59]  *** User went offline
[23:13:59]  *** User went online [Post-It_Memo - Hub Name] ***

This is not a bug but a feature, the bot re-registration is necessary to display the new releases 'today'.


Quote from: merlin_xl54 on 20 May, 2008, 05:16:26Edit, Is there a way to control release info format? (The Beatles, The beatles, the Beatles, the beatles, etc.) All can be entered which allows for many duplicate entries.


I'll fix this, nice catch.
Everything could have been anything else and it would have just as much meaning.

P_pan

#24
well ill guess i got a weird pc me thinks...
a brandnew ptokax setup + brandnewest freshhstuff..
starting up ..works fine....
no error is shown...

but as soon ill restart the script

ill strait get this msg >

[17:29:53] *** Loaded 0 releases in 0 seconds.
[17:29:53] *** FreshStuff3 5.0 Stable kernel loaded.
[17:29:53] *** FreshStuff3 5.0 Stable 'extras' module loaded.
[17:29:53] *** FreshStuff3 5.0 Stable 'requester' module loaded.
[17:29:53] cannot open C:/Users/demo/Desktop/0.4.1.0rc7/scripts/freshstuff/data/requests_non_comp.dat: No such file or directory

[17:29:53] Loaded 0 requests in 0 seconds.

i did not even add any release or any request...im puzzled too  :(




what im trying to say is..
when ya doing a total new freshstuff setup....
all works fine
ya can ad releases ect requests

but oh boy if ya gonna restart the script...
the requests will not show...
while the dat file is there and fully intact.

also when ya add again a new request to it...
the old ones will get be overwritten by the new added one....

hope i did explain good now....

SMF spam blocked by CleanTalk