i was wondering if this has been done yet, or if its possible.
the script would announce new dir's (folders) that get uploaded to the ftp in main on dc. similar to the ircbot "eggdrop".
please let me know, this would add a great feature to my hub. thanks in advance.
GILLIS?
QuoteOriginally posted by GILLIS
i was wondering if this has been done yet, or if its possible.
the script would announce new dir's (folders) that get uploaded to the ftp in main on dc. similar to the ircbot "eggdrop".
please let me know, this would add a great feature to my hub. thanks in advance.
GILLIS?
Sure it can be done, but it is... hmm... courageous thing to run an FTP server and a DC Hub Server on the same machine. Anyway, you should specify whether these are proper releases and .nfo should be read or just the foldername. Both are easy, I will make it for you.
yes it is, i have been running a hub, small hub ofcourse max 30users and an ftp on my pc for around 3 months now, both seems to be working great!
i find that amazing that you can just wip something like this up. they will be proper releases. just the folder would be great.
oh and would this be a script for ptokax?
that is what i run the hub on.
QuoteOriginally posted by GILLIS
oh and would this be a script for ptokax?
that is what i run the hub on.
Sure, but can also be done for BCDC++/DCDM++.
ok, i use DC++ v0.674 and Ptokax 0.3.3.0 17.05
if you could wip this script up it would be greatly appritiated.
GILLIS?
any luck? bastya_elvtars
bastya knows whats he doing :) ........ patient is a virtue :) Alot goes into some of these scripts as i am finding out. I dont think this one is something you can just sit down and write in 10 min. :)
QuoteOriginally posted by XPMAN
bastya knows whats he doing :) ........ patient is a virtue :) Alot goes into some of these scripts as i am finding out. I dont think this one is something you can just sit down and write in 10 min. :)
Question: you have an FTP root folder where all releases get uploaded?
i. e.
D:\FTPUpl\release1
D:\FTPUpl\release2
D:\FTPUpl\release3
D:\FTPUpl\release4
or so you put them into subfolders by date?
D:\FTPUpl\0401\release1
Myself , i have various folders, only 1 that they initially go into though . It would be nice to be able to specify ANY folder for it to look at though. That way if you changed the folder for a reason you could change it in the script as well :)
yes it would be something similar..
mine is :
E:\03-----------------NEWRELEASES, 0-DAY----------------------------\01.06.05-15.06.05\0603
but you get the idea.
lookin forward to this script!
Set the TimeBetweenAnnounces to 0.01 and test. It will pop up a dos window for a short time on every scan, but I will fix this. You have to change the directory it uses manually, it would way too much and inaccurate to write an autodetection routine. I wil also add a remote changing ability.
-- EggCrop by bastya_elvtars
-- some code from RabidWombat and plop
-- does the same as eggdrop for IRC
-- shows new folders from an ftp root dir
-- removes reeases older than x days, this can be set
-- How does it work?
-- It makes a dirlist from the desired directory.
---- ========= CONFIG START
DirToShow="M:/Movie" -- no \ on the end!!!!
PtokaXDir="I:/ptokax1601"
Bot="EggCrop"
TimetoLive=1 -- in days, after which releases are considered non-new
TimeBetweenAnnounces=2 -- in hours
---- ========= CONFIG END
function Main()
local f=io.open("getdirs.bat","w+")
-- create a windows BAT executable that makes a dirlist
f:write("dir \""..DirToShow.."\" /b /a:d /o:n > \""..PtokaXDir.."/scripts/ftpdirs.lst\"")
f:close()
SetTimer(TimeBetweenAnnounces*1000*3600)
StartTimer()
end
function AnnounceNew()
local list=GetList()
local msg="\r\n----------------- # Announcing latest FTP uploaded files #----------------- \r\n"
if table.getn(list)==0 then
msg=msg.."\r\nNo files. :("
else
for k=1,table.getn(list) do
msg=msg.."\r\n"..list[k]
end
end
SendToAll(Bot,msg)
end
function OnTimer()
AnnounceNew()
end
function GetList()
local tbl={}
os.execute(frmHub:GetPtokaXLocation().."/scripts/getdirs.bat")
local f=io.open("ftpdirs.lst","r")
if f then
for line in f:lines() do
table.insert(tbl,line)
end
f:close()
end
return tbl
end
function PruneList(tbl) -- not in use
local cnt,cnt2=0,0
local now=JulianDate(SplitTimeString(os.date("%Y. %m. %d. %X")))
local oldest=TimetoLive*1440 -- converting days to mins
for a,b in tbl do
cnt=cnt+1
local notnow=JulianDate(SplitTimeString(b))
local diff=now-notnow
local hours, mins= math.floor(diff) * 24 + math.floor(frac(diff) * 24), math.floor(frac(frac(diff)*24)*60)
local usrtime=hours*60+mins
if usrtime > oldest then
cnt2=cnt2+1
tbl[a]=nil
end
SaveList(tbl)
end
if cnt2~=0 then
SendToOps(Bot,cnt.." releases were parsed, and older then "..TimetoLive.." were deleted ("..cnt2").")
end
end
-- Split a specific Time string into its components
-- New Format: D. M. Y. HR:MN:SC" - 24hr time
-- return: Y,M,D,HR,MN,SC HR is in 24hr string.format
function SplitTimeString(TimeString) --
local D,M,Y,HR,MN,SC
if string.find(TimeString,"/") then
if not string.find (TimeString,"[AP]M") then
_,_,D,M,Y,HR,MN,SC=string.find(TimeString,"([^/]+).([^/]+).(%S+) ([^:]+).([^:]+).(%S+)")
else
if string.find (TimeString,"PM") then
_,_,D,M,Y,hr,MN,SC=string.find(TimeString,"([^/]+).([^/]+).(%S+) ([^:]+).([^:]+).(%S+)")
HR=tostring(tonumber(hr)+12)
else
_,_,D,M,Y,HR,MN,SC=string.find(TimeString,"([^/]+).([^/]+).(%S+) ([^:]+).([^:]+).(%S+)")
end
end
elseif string.find (TimeString,"%d%-%d") then
_,_,Y,M,D,HR,MN,SC = string.find(TimeString, "([^-]+).([^-]+).(%S+) ([^:]+).([^:]+).(%S+)")
elseif string.find (TimeString,"%d%d.%d%d.%d%d%d%d%s+") then
_,_,D,M,Y,HR,MN,SC = string.find(TimeString, "([^.]+).([^.]+).(%S+). ([^:]+).([^:]+).(%S+)")
else
_,_,Y,M,D,HR,MN,SC = string.find(TimeString, "([^.]+).([^.]+).([^.]+). ([^:]+).([^:]+).(%S+)")
end
D = tonumber(D)
M = tonumber(M)
Y = tonumber(Y)
HR = tonumber(HR)
--assert(HR < 24)
MN = tonumber(MN)
--assert(MN < 60)
SC = tonumber(SC)
--assert(SC < 60)
assert(HR < 24);
assert(MN < 60);
assert(SC < 60);
return D,M,Y,HR,MN,SC
end
function JulianDate(DAY, MONTH, YEAR, HOUR, MINUTE, SECOND) -- HOUR is 24hr string.format
local jy, ja, jm;
assert(YEAR ~= 0);
assert(YEAR ~= 1582 or MONTH ~= 10 or DAY < 4 or DAY > 15);
--The dates 5 through 14 October, 1582, do not exist in the Gregorian system!");
if(YEAR < 0 ) then
YEAR = YEAR + 1;
end
if( MONTH > 2) then
jy = YEAR;
jm = MONTH + 1;
else
jy = YEAR - 1;
jm = MONTH + 13;
end
local intgr = math.floor( math.floor(365.25*jy) + math.floor(30.6001*jm) + DAY + 1720995 );
--check for switch to Gregorian calendar
local gregcal = 15 + 31*( 10 + 12*1582 );
if(DAY + 31*(MONTH + 12*YEAR) >= gregcal ) then
ja = math.floor(0.01*jy);
intgr = intgr + 2 - ja + math.floor(0.25*ja);
end
--correct for half-day offset
local dayfrac = HOUR / 24 - 0.5;
if( dayfrac < 0.0 ) then
dayfrac = dayfrac + 1.0;
intgr = intgr - 1;
end
--now set the fraction of a day
local frac = dayfrac + (MINUTE + SECOND/60.0)/60.0/24.0;
--round to nearest second
local jd0 = (intgr + frac)*100000;
local jd = math.floor(jd0);
if( jd0 - jd > 0.5 ) then jd = jd + 1 end
return jd/100000;
end
function frac(num)
return num - math.floor(num);
end
seems fine, no errors,
but it doesnt seem to be reading files.. i get :
----------------- # Announcing latest FTP uploaded files #-----------------
No files. :(
i have my the dir in | DirToShow="here" | with no "/" at the end. and i changed TimeBetweenAnnounces to 0.01
i was hoping it would automaticly announce them as they were uploaded, like as a new folder is uploaded to the current dir it would annouce it.
thanks, it seems to be coming along very nicely
QuoteOriginally posted by GILLIS
seems fine, no errors,
but it doesnt seem to be reading files.. i get :
----------------- # Announcing latest FTP uploaded files #-----------------
No files. :(
i have my the dir in | DirToShow="here" | with no "/" at the end. and i changed TimeBetweenAnnounces to 0.01
Absolute path is needed, i. e.: C:/Program Files/FTPSERVER"
QuoteOriginally posted by GILLIS
i was hoping it would automaticly announce them as they were uploaded, like as a new folder is uploaded to the current dir it would annouce it.
That's only possible if it scans the dir al the time. However it can be done.
ok, sounds good. mine is set like this and still isnt reading folders..
---- ========= CONFIG START
DirToShow="E:\03-----------------NEWRELEASES, 0-DAY----------------------------\01.06.05-15.06.05\0604" -- no \ on the end!!!!
PtokaXDir="C:\PtokaX"
Bot="?0Day-Dump?"
TimetoLive=1 -- in days, after which releases are considered non-new
TimeBetweenAnnounces=0.01 -- in hours
---- ========= CONFIG END
bastya_elvtars:
Got the same problem here. I can only get it to work if I use bouble \ in the path.
and change this
/scripts/ftpdirs.lst
to
\\scripts\\ftpdirs.lst
//Star
QuoteOriginally posted by Star
bastya_elvtars:
Got the same problem here. I can only get it to work if I use bouble \ in the path.
and change this
/scripts/ftpdirs.lst
to
\\scripts\\ftpdirs.lst
//Star
It is working perfect here. What OS are you runnig this on? I tested on Xp SP2
yes works great now, thanks very much.
now the dir change could be changed so it might be easier to change it daily, and if its not going to auto read folders when they get uploaded, maybe a toggle on/off switch for the script?
just puttin ideas out, let me know how it works out.
thanks
i am using Xp pro SP2
worked fine after the "//" change in dir and "//scripts//ftpdirs.lst\"
GILLIS?
XP pro SP2, PtokaX 17.09
i have an idea...if you set the script TimeBetweenAnnounces at every 5mins it would work, but after the releases that have been posted in that 5min frame would never get posted again. only that once...then the next five mins it wouldnt post the ones it posted already, just the newer folders, and if theres no new folders it just doesnt post anything. get my drift?
let me know if it would work or if its even possible, if it is possible it would be flawless.
or have it announce a folder as it gets uploaded to the dir.
thanks again.
GILLIS?
QuoteOriginally posted by GILLIS
i have an idea...if you set the script TimeBetweenAnnounces at every 5mins it would work, but after the releases that have been posted in that 5min frame would never get posted again. only that once...then the next five mins it wouldnt post the ones it posted already, just the newer folders, and if theres no new folders it just doesnt post anything. get my drift?
let me know if it would work or if its even possible, if it is possible it would be flawless.
or have it announce a folder as it gets uploaded to the dir.
thanks again.
GILLIS?
Nice idea. 1 more: is the folder is the same that files are uploaded to?
no it would be ..
E:\NEWRELEASES, 0-DAY\01.06.05-15.06.05\0604
E:\NEWRELEASES, 0-DAY\01.06.05-15.06.05\0605 and so on..
QuoteOriginally posted by GILLIS
no it would be ..
E:\NEWRELEASES, 0-DAY\01.06.05-15.06.05\0604
E:\NEWRELEASES, 0-DAY\01.06.05-15.06.05\0605 and so on..
OK, i understand releases are in daily folders. BUT, the files are uploaded to release folders directly?
yes the releases are uploaded in to 0604 ..
E:\NEWRELEASES, 0-DAY\01.06.05-15.06.05\0604\RELEASEFOLDER#1\blahblah.mp3
E:\NEWRELEASES, 0-DAY\01.06.05-15.06.05\0604\RELEASEFOLDER#2\blahblah2.mp3
got another idea..after it announces the releases after 5min time frame or what ever it happens to be, it saves it to a .txt for use later, say a user wasnt in the hub when it got announced. there could be a quick command like !rls or something. that would be fantastic.
or have the script mimic what eggdrop does, and just add the feature as the releases are uploaded to the ftp and announced in dc it saves the text in a .txt file for later access.
thanks again
GILLIS?
QuoteSure, but can also be done for BCDC++/DCDM++.
Could you modify it to work on BCDC? I think alot of people will have use for it, including me ;P
is there progression? or did you forget about me.
let me know.
theres no rush.
GILLIS?
-click- (http://board.univ-angers.fr/thread.php?threadid=3769&boardid=26&styleid=1&page=4)
lawmaker?
is anyone going to help me out on this one?
QuoteOriginally posted by bastya_elvtars
Hmm, yesterday after replacing my CPU fan the motherboard refused to live any longer. This introduces a major fallback and LawMaker will porobably NOT be released till Sep. I feel terribly sorry for this too, as I cannot access my data, since there no other computers here that could read 200G HDDs. X(
Take care, and wish me luck! ;)
i dont see how lawmaker has anything to do with the ftp dir announcer script. does it?
GILLIS?
well read a bit further than just till the lawmaker info and then you shall see the reason
thanks i will wait.
QuoteOriginally posted by GILLIS
thanks i will wait.
I am sure you understand that this is not a pleasure for me either.
What i have to do for more as one directory?
DirToShow="D:\\stuff\\[1]" -- no \ on the end!!!!
DirToShow2="D:\\stuff\\[2]" -- no \ on the end!!!!
DirToShow3="D:\\stuff\\[3]" -- no \ on the end!!!!
for example. Please telle anyone ;-)
Greets
bastya_elvtars, just checking on you, hopefully your pc will be fixed soon and we can make some modifications to this magnificent script you wrote.
just for reminders:
if possible have the "TimeBetweenAnnounces" on all the time, and once a folder is uploaded to the ftp's dir the script would announce it in main, as well as add the release (folder text) to a *.txt file for later access, such as a release bot command to access it.
no rush...
GILLIS?
hey bastya_elvtars, long time no talk. hoping you have your pc up and running agian! If so maybe you could find some time to write this script for me. if you need anymore info on what the script should be, details etc. please ask :)
GILLIS?
Problem is that i could not find a way to see whether a folder is uploaded completely.
my sfv checker makes a folder similar to this one in every complete upload. "-[100%]--[All-files-CRC-OK]--[2-files]--[BBF]-" in the releases folder example "E:\=MP3=\1013\Beliver-The_World-CDR-2005-USF\-[100%]--[All-files-CRC-OK]--[2-files]--[BBF]-"
if you can some how scan for folders with "-[100%]--[All-files-CRC-OK] this would tell the script that the upload is complete :)
what if you could make the script scan for new dir theads in a ftp .txt upload log file? would that be possible?
the thread in the log file for a new dir is "[2] Sat 15Oct05 14:01:30 - (000069) MKD /=MP3=/1015/Habit-Kaos_Karl_K_and_Jae_Kennedy-HBT009-Vinyl-2005-TrT"
so it would be different every day, but the command to make a new dir is "MKD" so if you could get it to scan the .txt in real time for the text "MKD" and announce the thread containing "MKD" it would work!
please get back at me.
thanks...
GILLIS