You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(7) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(4) |
Feb
(56) |
Mar
(10) |
Apr
(1) |
May
(6) |
Jun
(5) |
Jul
(2) |
Aug
|
Sep
(22) |
Oct
(7) |
Nov
(1) |
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
2006 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Johnjohn <jj...@us...> - 2004-03-17 10:23:49
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv856/ngetsuite Modified Files: core.rb downloader.rb group.rb Log Message: deleting a group deletes everything related to it in the database added a field 'ignoreregex' in groups, can be set using -I ; will prevent nget to download articles which subject matches that (using nget's -R) added a fiels 'category' for groups, can be set using -S ; actually unused Index: downloader.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/downloader.rb,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** downloader.rb 14 Mar 2004 22:32:33 -0000 1.28 --- downloader.rb 17 Mar 2004 10:14:19 -0000 1.29 *************** *** 179,183 **** Db.dbh.do "update queue set `status`='PROCESSING', `date_started`=NOW() where `queueindex`='#{@queueindex}'" Db.dbh.do 'unlock tables' ! @io = IO.popen("nice -n#{$config['nice_nget_download']} -- #{$config['nget']} -q -I -G #{@group} -r '#{@value}' 2>&1") @t = Thread.new(@io, self){ |io, parent| begin --- 179,189 ---- Db.dbh.do "update queue set `status`='PROCESSING', `date_started`=NOW() where `queueindex`='#{@queueindex}'" Db.dbh.do 'unlock tables' ! ignoreme = (Db.dbh.select_one "select `ignoreregex` from `groups` where `groupindex`='#{Group.getindex(@group)}'")[0] ! if ignoreme and ignoreme.length > 0 ! downloadexpr = "-R 'subject #{@value} == subject #{ignoreme} != &&'" ! else ! downloadexpr = "-r '#{@value}'" ! end ! @io = IO.popen("nice -n#{$config['nice_nget_download']} -- #{$config['nget']} -q -I -G #{@group} #{downloadexpr} 2>&1") @t = Thread.new(@io, self){ |io, parent| begin Index: group.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/group.rb,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** group.rb 14 Mar 2004 22:32:33 -0000 1.42 --- group.rb 17 Mar 2004 10:14:19 -0000 1.43 *************** *** 31,34 **** --- 31,43 ---- def Group.delete(index) + ql = Db.dbh.select_all "select `queueindex` from `queue` where `groupindex`='#{index}'" + ql.each { |r| + i=r[0] + Db.dbh.do "delete from `queue_files` where `queueindex`='#{i}'" + } + Db.dbh.do "delete from `queue` where `groupindex`='#{index}'" + Db.dbh.do "delete from `releases` where `groupindex`='#{index}'" + Db.dbh.do "delete from `nfos` where `groupindex`='#{index}'" + Db.dbh.do "delete from `articles` where `groupindex`='#{index}'" Db.dbh.do "delete from `groups` where `groupindex`='#{index}'" end *************** *** 68,77 **** def Group.show(onlyactive = false) ! labels = Array['Added' , 'Last update' , 'Directory', 'Active'] ! keys = Array['date_added', 'date_updated', 'directory', 'active'] req = '' req = " where `active`='yes' " if onlyactive ! req += 'order by `date_added`' GroupList.new(req).each { |group| --- 77,86 ---- def Group.show(onlyactive = false) ! labels = Array['Category', 'Added' , 'Last update' , 'Directory', 'Active', 'Ignoring'] ! keys = Array['category', 'date_added', 'date_updated', 'directory', 'active', 'ignoreregex'] req = '' req = " where `active`='yes' " if onlyactive ! req += 'order by `groupindex`' GroupList.new(req).each { |group| *************** *** 81,87 **** puts "<#{idx}> [#{name}] (#{sname})" labels.each_index { |i| ! label, value = Utils.green(labels[i]), ! Utils.yellow(group.method('_'+keys[i]).call) ! puts "\t#{label} : #{value}" } puts --- 90,95 ---- puts "<#{idx}> [#{name}] (#{sname})" labels.each_index { |i| ! value = group.method('_'+keys[i]).call.to_s ! puts "\t#{Utils.green(labels[i])} : #{Utils.yellow(value)}" if value.length > 0 } puts *************** *** 149,152 **** --- 157,161 ---- def queue_regexp(regexp, prio=nil, period=nil, subpath=nil) q = RegexpQueue.new(nil, false, @_groupindex, regexp, prio, period, subpath) + q._date_added = Db.now q._status = NgetSuite::PENDING Index: core.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/core.rb,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** core.rb 15 Mar 2004 10:13:21 -0000 1.37 --- core.rb 17 Mar 2004 10:14:19 -0000 1.38 *************** *** 119,123 **** end ! def queue_regexp(groupid, regexp, prio='5', period='0', subpath='') begin n = Integer(prio) --- 119,135 ---- end ! def group_set_ignore_regexp(groupid, regexp='') ! g = Group.getgroup(groupid) ! g._ignoreregex = regexp ! g.sync_to_db ! end ! ! def group_set_category(groupid, category) ! g = Group.getgroup(groupid) ! g._category = category ! g.sync_to_db ! end ! ! def queue_regexp(groupid, regexp, prio='5', period='0', subpath=nil) begin n = Integer(prio) *************** *** 197,206 **** when 'add-group' args = arg.split(',') ! size = args.size ! if ((size >= 1) && (size <= 4)) ! add_group(*args); ! else ! raise ArgumentError.new("Incorrect args : #{arg}") ! end when 'delete-group' delete_group(arg) --- 209,213 ---- when 'add-group' args = arg.split(',') ! add_group(*args); when 'delete-group' delete_group(arg) *************** *** 209,212 **** --- 216,225 ---- when 'update-all-groups' update_group + when 'set-group-category' + args = arg.split(',') + group_set_category(*args) + when 'set-ignore-regexp' + args = arg.split(',') + group_set_ignore_regexp(*args) when 'list-nfos' list_nfos(arg) *************** *** 215,240 **** when 'show-nfo' args = arg.split(',') ! size = args.size ! if ((size >= 1) && (size <= 2)) ! show_nfo(*args) ! else ! raise ArgumentError.new("Incorrect args : #{arg}") ! end when 'queue-article' args = arg.split(',') ! size = args.size ! if ((size >= 2) && (size <= 3)) ! queue_article(*args) ! else ! raise ArgumentError.new("Incorrect args : #{arg}") ! end when 'queue-regexp' args = arg.split(',') ! size = args.size ! if ((size >= 2) && (size <= 5)) ! queue_regexp(*args) ! else ! raise ArgumentError.new("Incorrect args : #{arg}") ! end when 'delete-queue' Queue.delete(arg, true) --- 228,238 ---- when 'show-nfo' args = arg.split(',') ! show_nfo(*args) when 'queue-article' args = arg.split(',') ! queue_article(*args) when 'queue-regexp' args = arg.split(',') ! queue_regexp(*args) when 'delete-queue' Queue.delete(arg, true) *************** *** 248,254 **** when 'search' args = arg.split(',') ! if (args.size == 2) ! search_group(*args) ! end when 'search-releases' args = arg.split(',') --- 246,250 ---- when 'search' args = arg.split(',') ! search_group(*args) when 'search-releases' args = arg.split(',') *************** *** 256,278 **** when 'set-period' args = arg.split(',') ! if (args.size == 2) ! set_period(*args) ! else ! raise ArgumentError.new("Incorrect args : #{arg}") ! end when 'set-priority' args = arg.split(',') ! if (args.size == 2) ! set_priority(*args) ! else ! raise ArgumentError.new("Incorrect args : #{arg}") ! end when 'set-status' args = arg.split(',') ! if (args.size == 2) ! set_status(*args) ! else ! raise ArgumentError.new("Incorrect args : #{arg}") ! end when 'set-limit' begin --- 252,262 ---- when 'set-period' args = arg.split(',') ! set_period(*args) when 'set-priority' args = arg.split(',') ! set_priority(*args) when 'set-status' args = arg.split(',') ! set_status(*args) when 'set-limit' begin |
From: YS <ys...@us...> - 2004-03-16 22:31:05
|
Update of /cvsroot/ngetsuite/ngetsuite/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25509/web Modified Files: group.rhtml top.rhtml Log Message: fixed stupid bugs in UI Index: group.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/group.rhtml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** group.rhtml 21 Feb 2004 15:58:34 -0000 1.6 --- group.rhtml 16 Mar 2004 22:21:40 -0000 1.7 *************** *** 28,32 **** # row["graphmap"] = "<table class=\"rlsmap\" cellspacing=\"1\"><tr>" row["graphmap"] = "<div class=\"rlsmap\">#{row["nbactual"]}/#{row["nbexpected"]} " ! if row["rlsmap"] != "" for i in 0..row["rlsmap"].size-1 if row["rlsmap"][i] == "#"[0] then --- 28,32 ---- # row["graphmap"] = "<table class=\"rlsmap\" cellspacing=\"1\"><tr>" row["graphmap"] = "<div class=\"rlsmap\">#{row["nbactual"]}/#{row["nbexpected"]} " ! if row["rlsmap"] and row["rlsmap"] != "" for i in 0..row["rlsmap"].size-1 if row["rlsmap"][i] == "#"[0] then Index: top.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/top.rhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** top.rhtml 21 Feb 2004 15:58:34 -0000 1.2 --- top.rhtml 16 Mar 2004 22:21:43 -0000 1.3 *************** *** 78,82 **** <a href="group.rhtml?group=<%= web.group._fullname %>&date=<%=iso%>" target="left"><%=display%></a> | <% } %> ! <a href="group.rhtml?group=<%= web.group._fullname %>&date=any">any</a> <% end %> </td> --- 78,82 ---- <a href="group.rhtml?group=<%= web.group._fullname %>&date=<%=iso%>" target="left"><%=display%></a> | <% } %> ! <a href="group.rhtml?group=<%= web.group._fullname %>&date=any" target="left">any</a> <% end %> </td> |
From: <ys...@us...> - 2004-03-15 10:22:28
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31021/ngetsuite Modified Files: core.rb Log Message: typo in delete_group Index: core.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/core.rb,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** core.rb 5 Mar 2004 15:28:04 -0000 1.36 --- core.rb 15 Mar 2004 10:13:21 -0000 1.37 *************** *** 78,82 **** def delete_group(id) ! Group.delete(Groupe.getindex(id)) end --- 78,82 ---- def delete_group(id) ! Group.delete(Group.getindex(id)) end |
From: <jj...@us...> - 2004-03-14 23:01:46
|
Update of /cvsroot/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8909 Modified Files: HOWTO Log Message: minor update in the HOWTO Index: HOWTO =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/HOWTO,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HOWTO 6 Feb 2004 23:46:58 -0000 1.4 --- HOWTO 14 Mar 2004 22:52:45 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- ------------------------------------------ Before everything, start the daemon and optionnaly the httpd (see configfile) + (notice that the httpd is the recommanded interface) + You can leave the daemon run on a console, which will tell you what is going on if you have set 'debug' or 'daemon_debug' in the config. + ./daemon.rb & disown -a *************** *** 42,51 **** you must regularly update the news reader cache with for example a crontab like this : ! 10 5 * * * ~/ngetupdate.sh ! ! content of ~/ngetupdate.sh : ! #!/bin/sh ! cd ~/ngetsuite ! ./ngetsuite.rb -v This will fetch the headers from the news server, parse the cache file and --- 45,49 ---- you must regularly update the news reader cache with for example a crontab like this : ! 10 5 * * * /home/me/ngetsuite/ngetsuite.rb -v This will fetch the headers from the news server, parse the cache file and *************** *** 64,74 **** matching some regexp (download queue). You add a queue with -r : ! ./ngetsuite.rb -r groupid,regexp,prio ie : ./ngetsuite.rb -r linux-pics,penguin,7 ! Finally, you must start the monitoring with ./ngetsuite.rb -m : the daemon will ! then look for the queue with a 'PENDING' status and the greatest priority, mark this queue as 'PROCESSING' and start a nget instance with the corresponding regexp. --- 62,73 ---- matching some regexp (download queue). You add a queue with -r : ! ./ngetsuite.rb -r groupid,regexp[,prio,period,directory] ie : ./ngetsuite.rb -r linux-pics,penguin,7 ! Finally, you must start the monitoring with ./ngetsuite.rb -m (the appropriate ! config option 'daemon_autostart' can avoid this step). The daemon will then ! look for the queue with a 'PENDING' status and the greatest priority, mark this queue as 'PROCESSING' and start a nget instance with the corresponding regexp. *************** *** 82,86 **** ./ngetsuite.rb -x 23 ! If you want to start processing this queue again (because of a network failure, repost..), you just have to change the status of the queue to 'PENDING' with : ./ngetsuite.rb -i 23,PENDING --- 81,85 ---- ./ngetsuite.rb -x 23 ! If you want to start processing this queue again (because of a nget failure, repost..), you just have to change the status of the queue to 'PENDING' with : ./ngetsuite.rb -i 23,PENDING |
From: <jj...@us...> - 2004-03-14 22:41:35
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4596/ngetsuite Modified Files: downloader.rb group.rb Log Message: misc daemon fix, -G prints the date, reset fix for an empty base Index: downloader.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/downloader.rb,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** downloader.rb 5 Mar 2004 15:28:04 -0000 1.27 --- downloader.rb 14 Mar 2004 22:32:33 -0000 1.28 *************** *** 49,53 **** line.chomp! case line ! when /^(\d+) \((\d+)\/(\d+)\): (\d+)\/(\d+)L (\d+)\/(\d+)B (\d+)% (\d+)B\/s (\w+) (\d+)\/(\d+) (\w+)$/ part, size, speed, filenb = $2, $7, $9, $12 ldebug "#{green $5+'L'}(#{green $7+'B'}) at #{$9+'B/s'} [#{blue $2}/#{blue $3}] [#{yellow $11}/#{yellow $12}]", false --- 49,53 ---- line.chomp! case line ! when /^(\d+) \((\d+)\/(\d+)\): (\d+)\/(\d+)L (\d+)\/(\d+)B\s+(\d+)% (\d+)B\/s (\w+) (\d+)\/(\d+) (\w+)$/ part, size, speed, filenb = $2, $7, $9, $12 ldebug "#{green $5+'L'}(#{green $7+'B'}) at #{$9+'B/s'} [#{blue $2}/#{blue $3}] [#{yellow $11}/#{yellow $12}]", false *************** *** 157,164 **** when /^doarticle \d+: \d+!=\d+ \|\| \d+!=\d+$/ when /^unequal line count (\d+) should equal (\d+)$/ ! ldebug "unequal line count (#{$1} != #{$2})" when />> \d\d\d/, /<< (GROUP|AUTHINFO)/ ! when /^(?:OK:(.*))?(?:WARNINGS:(.*))?(?:ERRORS:(.*))?$/ return unless $1 or $2 or $3 ok,warn,errs = $1, $2, $3 --- 157,164 ---- when /^doarticle \d+: \d+!=\d+ \|\| \d+!=\d+$/ when /^unequal line count (\d+) should equal (\d+)$/ ! ldebug "unequal line count (#{$1} != #{$2})", false when />> \d\d\d/, /<< (GROUP|AUTHINFO)/ ! when /^(?:OK:(.*?))?(?:WARNINGS:(.*?))?(?:ERRORS:(.*?))?$/ return unless $1 or $2 or $3 ok,warn,errs = $1, $2, $3 Index: group.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/group.rb,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** group.rb 5 Mar 2004 15:28:04 -0000 1.41 --- group.rb 14 Mar 2004 22:32:33 -0000 1.42 *************** *** 118,127 **** def search_releases(filter) ! sth = Db.dbh.execute('select articles.subject,releases.rlsmap,releases.nbactual,releases.nbexpected from releases,articles where articles.artindex = releases.artindex and articles.groupindex = ? and articles.subject RLIKE ? order by articles.time desc', @_groupindex, filter) i = 0 ! subj, rlsmap, nbact, nbtot = nil sth.fetch do |row| ! subj, rlsmap, nbact, nbtot = *row ! puts "#{yellow nbact}/#{yellow nbtot} [#{green rlsmap}] \"#{subj}\"" i += 1 end --- 118,127 ---- def search_releases(filter) ! sth = Db.dbh.execute('select articles.subject,releases.rlsmap,releases.nbactual,releases.nbexpected,releases.time from releases,articles where articles.artindex = releases.artindex and articles.groupindex = ? and articles.subject RLIKE ? order by articles.time desc', @_groupindex, filter) i = 0 ! subj, rlsmap, nbact, nbtot, time = nil sth.fetch do |row| ! subj, rlsmap, nbact, nbtot, time = *row ! puts "#{time} #{yellow nbact}/#{yellow nbtot} [#{green rlsmap}] \"#{subj}\"" i += 1 end |
From: <jj...@us...> - 2004-03-14 22:41:34
|
Update of /cvsroot/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4596 Modified Files: resetdb.rb Log Message: misc daemon fix, -G prints the date, reset fix for an empty base Index: resetdb.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/resetdb.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** resetdb.rb 27 Feb 2004 13:12:06 -0000 1.4 --- resetdb.rb 14 Mar 2004 22:32:33 -0000 1.5 *************** *** 6,12 **** require 'ngetsuite/db' ! savedgroups = Db.dbh.select_all('select `fullname`,`shortname`,`directory`,`active`,`date_added`,`description` from `groups` order by `groupindex`') ! savedqueues = Db.dbh.select_all('select * from `queue`') ! puts "Queues (to restore manually)" + savedqueues.map{ |q| "\n"+q.map{|e| e.to_s }.join(', ') }.join sqlfile = File.open('ngetcache.sql') --- 6,17 ---- require 'ngetsuite/db' ! backupped = true ! begin ! savedgroups = Db.dbh.select_all('select `fullname`,`shortname`,`directory`,`active`,`date_added`,`description` from `groups` order by `groupindex`') ! savedqueues = Db.dbh.select_all('select * from `queue`') ! puts "Queues (to restore manually)" + savedqueues.map{ |q| "\n"+q.map{|e| e.to_s }.join(', ') }.join ! rescue Object ! backupped = false ! end sqlfile = File.open('ngetcache.sql') *************** *** 25,33 **** } ! puts 'Restoring groups...' ! sth = Db.dbh.prepare "insert into `groups` (`fullname`,`shortname`,`directory`,`active`,`date_added`,`description`) values (?,?,?,?,?,?)" ! savedgroups.each { |g| ! sth.execute(*g) ! } Db.dbh.disconnect --- 30,40 ---- } ! if backupped ! puts 'Restoring groups...' ! sth = Db.dbh.prepare "insert into `groups` (`fullname`,`shortname`,`directory`,`active`,`date_added`,`description`) values (?,?,?,?,?,?)" ! savedgroups.each { |g| ! sth.execute(*g) ! } ! end Db.dbh.disconnect |
From: <jj...@us...> - 2004-03-05 22:45:10
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15909/ngetsuite Modified Files: articles.rb Log Message: release detection fix&enhancement Index: articles.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/articles.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** articles.rb 5 Mar 2004 15:28:04 -0000 1.7 --- articles.rb 5 Mar 2004 22:30:46 -0000 1.8 *************** *** 44,48 **** def Release.indexes(subject) ! if subject =~/[\[\(](\d{1,3})\/(\d{1,3})[\]\)]/ return $1.to_i, $2.to_i, $2.length elsif subject =~ /(\d{1,3}) *of *(\d{1,3})/ --- 44,50 ---- def Release.indexes(subject) ! if subject =~ /[\[\(](\d{1,3})\/(\d{1,3})[\]\)]/ ! return $1.to_i, $2.to_i, $2.length ! elsif subject =~ /[^\d](\d{1,3})\/(\d{1,3})[^\d]/ return $1.to_i, $2.to_i, $2.length elsif subject =~ /(\d{1,3}) *of *(\d{1,3})/ *************** *** 82,86 **** if rls.poster == art._from if rls._nbactual == 1 ! # create regex match = '' (0..(rls.noidxregex.length)).each { |i| --- 84,91 ---- if rls.poster == art._from if rls._nbactual == 1 ! # create regex ! if rls.noidxregex == art._subject ! rls.noidxregex = Regexp.new '^'+Regexp.escape(art._subject) ! else match = '' (0..(rls.noidxregex.length)).each { |i| *************** *** 89,96 **** } match.sub!(/\d*$/, '') ! rls.noidxregex = Regexp.new '^'+Regexp.escape(match)+'(\d+)' end if art._subject =~ rls.noidxregex ! cur = $1.to_i rls.pushart(art, cur) else --- 94,114 ---- } match.sub!(/\d*$/, '') ! tstre = '^' + Regexp.escape(match.sub(/\.[^\.]*$/, '.')) ! tstre += '(?:par2?|rar|r\d\d|p\d\d|vol\d+\+\d+\.par2|\d\d\d|part\d+\.rar|sfv|nfo)\W' ! tstre = Regexp.new(tstre, Regexp::IGNORECASE) ! if art._subject =~ tstre and rls.noidxregex =~ tstre ! rls.noidxregex = tstre ! else ! rls.noidxregex = Regexp.new '^'+Regexp.escape(match)+'(\d{1,3})[^\d]' ! end ! end end if art._subject =~ rls.noidxregex ! if $1 ! cur = $1.to_i ! else ! cur = rls._nbactual + 1 ! end ! #NgetSuite::Utils.debug "add {#{art._subject}} (#{cur})" rls.pushart(art, cur) else *************** *** 104,107 **** --- 122,126 ---- end unless @@rls[0] + #NgetSuite::Utils.debug "creat {#{art._subject}}" rls = @@rls[0] = Release.new(art._groupindex, art._artindex) cur = 1 *************** *** 119,123 **** if (rls.poster==art._from) and (rls._nbexpected==total)#and ((rls.lastnb<cur) or (rls.lastnb==1 and cur==1)) if rls._rlsmap[cur-1] == '#' ! NgetSuite::Utils.debug "#{cat}: part #{cur} already there {#{art._subject}}" end # another art for this release --- 138,142 ---- if (rls.poster==art._from) and (rls._nbexpected==total)#and ((rls.lastnb<cur) or (rls.lastnb==1 and cur==1)) if rls._rlsmap[cur-1] == '#' ! #NgetSuite::Utils.debug "#{cat}: part #{cur} already there {#{art._subject}}" end # another art for this release |
From: <jj...@us...> - 2004-03-05 15:42:51
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18152/ngetsuite Modified Files: articles.rb core.rb downloader.rb group.rb Log Message: added -T option (for test) 31337 release detection Index: articles.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/articles.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** articles.rb 20 Feb 2004 16:44:39 -0000 1.6 --- articles.rb 5 Mar 2004 15:28:04 -0000 1.7 *************** *** 38,156 **** Db.autotable(Release, 'releases') - - def initialize(groupindex, artindex, fetch_from_db = false ) - @files = Array.new - @_artindex = artindex - @_groupindex = groupindex - @_size = 0 - @_nbexpected = 0 - @_nbactual = 0 - @lastnb = 0 - @_time = Time.gm('1980') - update_from_db if fetch_from_db - end ! def pushart(art, pos) ! art._rlsnb = pos ! art._rlsartindex = @_artindex ! @_size += art._size ! @_nbactual += 1 ! @_time = art._time if art._time > @_time ! @_completeness = @_nbactual.to_f / @_nbexpected.to_f * 100.to_f if @_nbexpected > 0 and @_nbactual <= @_nbexpected ! ! if @_rlsmap ! @_rlsmap[pos-1] = '#' if pos > 0 and pos <= @_rlsmap.size end - @files.push art - end - - # Returns the index of current file/nb of files - # if guessed from the subject (0 if not) - def Release.filenb_from_subject(subject) - subject =~ /[\[\(]?(\d+)(?:[\/]|\s*of\s*)(\d+)[\]\)]?/ - - return [$1.to_i, $2.to_i] end ! # Returns the common part between this subject and ! # the reference subject. We work with arrays of words ! def compare_subjects(subject) ! common = Array.new ! i = 0 ! while @refsubject[i] != nil and ! subject[i] != nil and ! @refsubject[i] == subject[i] ! common.push subject[i] ! i += 1 end ! return common ! end ! ! # Magic function to tell if an article belongs to a release ! # It adds it and return true if it does, return false if not ! def add?(art) ! fn = Release.filenb_from_subject(art._subject) ! ! if !@files.empty? ! # Deal with trivial cases ! # if the file sequence number is present and ! # seems correct, we can add the article without ! # further investigation ! return false if art._from != @poster ! if fn[1] > 0 and fn[0] > 0 ! return false if fn[1] != @_nbexpected ! return false if fn[0] < @lastnb ! pushart(art,fn[0]) ! return true end ! else ! # First article: add it, ! # and keep the subject's words ! @refsubject = art._subject.split(' ') ! @poster = art._from ! @_nbexpected = fn[1] if fn[1] > 0 ! @lastnb = fn[0] if fn[0] > 0 ! @_rlsmap = '_' * @_nbexpected ! pushart(art,fn[0]) ! return true end ! # If we're here, the file sequence number ! # ("[xx/xx]"-like thing) was not found in the subject ! # We have to compare it with the reference subject ! # This is ugly and *a little* error prone, but hell... ! ! if @files.size == 1 ! # Second article: update the reference by storing ! # only the common words between the 2 subjects, ! # and add the article if there are any of these ! @refsubject = compare_subjects(art._subject.split(' ')) ! if @refsubject.size > 0 ! pushart(art,fn[0]) ! return true else ! return false end else ! # Already 2 or more articles in the release ! # Add the article if the common words between ! # its subject and the reference *is* the reference ! ! if compare_subjects(art._subject.split(' ')) == @refsubject ! pushart(art,fn[0]) ! return true ! else ! return false ! end end end def insert_to_db(only_mandatory = false) # A release contains at least 3 articles ! return if @files.size < 3 super(only_mandatory) --- 38,177 ---- Db.autotable(Release, 'releases') ! @@rls = nil ! ! attr_accessor :poster, :noidxregex ! ! def Release.indexes(subject) ! if subject =~/[\[\(](\d{1,3})\/(\d{1,3})[\]\)]/ ! return $1.to_i, $2.to_i, $2.length ! elsif subject =~ /(\d{1,3}) *of *(\d{1,3})/ ! return $1.to_i, $2.to_i, $2.length end end ! # construct releases, returns number of releases inserted ! # keeps a list of releases 'in construction' indexed by the number of digits of the expected number of articles (to be able to merge '00'->'09' with '10'->'19' if we encounter '1' beetween) ! # cat 0 is for files with no index found ! def Release.mkreleases(art) ! nb_ins = 0 ! # group begin: initialize ! if art == true ! @@rls = [nil, nil, nil, nil] ! return 0 end ! # group end: terminate ! if art == false ! @@rls.compact.each { |r| ! nb_ins += 1 if r.insert_to_db ! } ! @@rls = nil ! return nb_ins ! end ! # parse subject (to get the article category) ! cur, total, cat = Release.indexes(art._subject) ! # index not found: abracadabra! ! if not cat ! if rls = @@rls[0] ! # if this is the second file, calculate the regex ! # otherwise match against it ! if rls.poster == art._from ! if rls._nbactual == 1 ! # create regex ! match = '' ! (0..(rls.noidxregex.length)).each { |i| ! break unless rls.noidxregex[i] == art._subject[i] ! match += rls.noidxregex[i].chr ! } ! match.sub!(/\d*$/, '') ! rls.noidxregex = Regexp.new '^'+Regexp.escape(match)+'(\d+)' ! end ! if art._subject =~ rls.noidxregex ! cur = $1.to_i ! rls.pushart(art, cur) ! else ! nb_ins += 1 if rls.insert_to_db ! @@rls[0] = nil ! end ! else ! nb_ins += 1 if rls.insert_to_db ! @@rls[0] = nil ! end end ! unless @@rls[0] ! rls = @@rls[0] = Release.new(art._groupindex, art._artindex) ! cur = 1 ! cur = $1.to_i if art._subject =~ /(1\d*)/ ! rls.poster = art._from ! rls.noidxregex = art._subject ! @@rls[0].pushart(art,1) ! end ! return nb_ins end ! # look for an existing release which could accept this article ! # (same poster, nbexpected, and file not already seen) ! if rls = @@rls[cat] ! if (rls.poster==art._from) and (rls._nbexpected==total)#and ((rls.lastnb<cur) or (rls.lastnb==1 and cur==1)) ! if rls._rlsmap[cur-1] == '#' ! NgetSuite::Utils.debug "#{cat}: part #{cur} already there {#{art._subject}}" ! end ! # another art for this release ! rls.pushart(art,cur) else ! # new release: commit this one ! nb_ins += 1 if rls.insert_to_db ! @@rls[cat] = nil end + end + + # if there is no release in this category (or if we just erased it), create a new one with the current article as reference + unless @@rls[cat] + @@rls[cat] = Release.new(art._groupindex, art._artindex) + @@rls[cat].poster = art._from + @@rls[cat]._nbexpected = total + @@rls[cat]._rlsmap = '_' * total + @@rls[cat].pushart(art,cur) + end + return nb_ins + end + + + def initialize(groupindex, artindex, fetch_from_db = false ) + @files = Array.new + @poster = nil + @noidxregex = nil + @_artindex = artindex + @_groupindex = groupindex + if fetch_from_db + update_from_db else ! @_size = 0 ! @_nbactual = 0 ! @_nbexpected = 0 ! @_rlsmap = nil ! @_time = Time.gm('1980') end end + def pushart(art, pos) + art._rlsnb = pos + art._rlsartindex = @_artindex + @_size += art._size + @_nbactual += 1 + @_time = art._time if art._time > @_time + @_completeness = @_nbactual.to_f / @_nbexpected.to_f * 100.to_f if @_nbexpected > 0 and @_nbactual <= @_nbexpected + + @_rlsmap[pos-1]='#' if pos>0 and @_rlsmap and pos<=@_rlsmap.size + @files.push art + end + def insert_to_db(only_mandatory = false) # A release contains at least 3 articles ! return false if @_nbactual < 3 super(only_mandatory) *************** *** 160,163 **** --- 181,185 ---- art.sync_to_db } + return true end *************** *** 180,184 **** sth.fetch do |row| subj, grpidx, rlsmap, nbact, nbtot = *row ! puts "[#{Utils.blue i}] #{Utils.yellow nbact}/#{Utils.yellow nbtot} [#{Utils.green rlsmap}] \"#{subj}\"" i += 1 end --- 202,206 ---- sth.fetch do |row| subj, grpidx, rlsmap, nbact, nbtot = *row ! puts "[#{Utils.blue i}] #{Utils.yellow nbact}/#{Utils.yellow nbtot} [#{Utils.green rlsmap if rlsmap}] \"#{subj}\"" i += 1 end *************** *** 188,192 **** def to_s ! "#{Utils.green @_artindex}: #{@_nbactual}/#{@_nbexpected} [#{Utils.yellow @_rlsmap}]" end end --- 210,214 ---- def to_s ! "#{Utils.green @_artindex}: #{@_nbactual}/#{@_nbexpected} [#{Utils.yellow @_rlsmap if @_rlsmap}]" end end Index: core.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/core.rb,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** core.rb 25 Feb 2004 22:37:10 -0000 1.35 --- core.rb 5 Mar 2004 15:28:04 -0000 1.36 *************** *** 81,84 **** --- 81,88 ---- end + def test(gid) + Group.getgroup(gid).recognizereleases + end + def update_group(groupid = nil) if !groupid *************** *** 187,190 **** --- 191,196 ---- when 'write-config' $config.save(arg) + when 'test' + test(arg) when 'show-groups' Group.show Index: downloader.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/downloader.rb,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** downloader.rb 27 Feb 2004 13:12:07 -0000 1.26 --- downloader.rb 5 Mar 2004 15:28:04 -0000 1.27 *************** *** 140,146 **** ldebug "Connection to #{$1}..", false when />> 200/ ! ldebug green('Connected') when />> 400/ ! ldebug red('Disconnected') when /<< QUIT/ ldebug blue('Quitted') --- 140,146 ---- ldebug "Connection to #{$1}..", false when />> 200/ ! ldebug green('Connected'), false when />> 400/ ! ldebug red('Disconnected'), false when /<< QUIT/ ldebug blue('Quitted') *************** *** 148,155 **** when 'ignored error (nntp_getline: connection closed unexpectedly)' ldebug "#{red 'Lost connection'}. Reconnecting..." ! when /close\(fast\)$/ when /^error, will try .* again \(server says byebye: (.*)\)/ ! ldebug red("Disconnected (#{$1})") + '. Reconnecting...', false when /^nntp_doarticle: try again./ when /^make_connection/ --- 148,155 ---- when 'ignored error (nntp_getline: connection closed unexpectedly)' ldebug "#{red 'Lost connection'}. Reconnecting..." ! when /close\(fast\)$/ when /^error, will try .* again \(server says byebye: (.*)\)/ ! ldebug red("Disconnected (#{$1})") + '. Reconnecting...' when /^nntp_doarticle: try again./ when /^make_connection/ Index: group.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/group.rb,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** group.rb 27 Feb 2004 13:12:07 -0000 1.40 --- group.rb 5 Mar 2004 15:28:04 -0000 1.41 *************** *** 267,285 **** articles = ArticleList.new("where `groupindex`='#{@_groupindex}' order by `subject`") ! rls = nil ! nb_releases = 0 articles.each { |art| ! rls = Release.new(art._groupindex, art._artindex) if !rls ! if rls.add?(art) == false then ! # New release! Commit the current one to the db ! rls.insert_to_db ! nb_releases += 1 ! ! # And make another ! rls = NgetSuite::Release.new(art._groupindex, art._artindex) ! rls.add? art ! end } ! rls.insert_to_db debug "#{nb_releases} releases inserted in #{Utils.cooltime(Time.now-t)}" --- 267,275 ---- articles = ArticleList.new("where `groupindex`='#{@_groupindex}' order by `subject`") ! nb_releases = Release.mkreleases(true) articles.each { |art| ! nb_releases += Release.mkreleases(art) } ! nb_releases += Release.mkreleases(false) debug "#{nb_releases} releases inserted in #{Utils.cooltime(Time.now-t)}" |
From: <jj...@us...> - 2004-03-05 15:42:38
|
Update of /cvsroot/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18152 Modified Files: ngetsuite.rb Log Message: added -T option (for test) 31337 release detection Index: ngetsuite.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite.rb,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ngetsuite.rb 27 Feb 2004 13:12:06 -0000 1.20 --- ngetsuite.rb 5 Mar 2004 15:28:04 -0000 1.21 *************** *** 14,17 **** --- 14,18 ---- # end of options, begin of actions nil, + [ '--test', '-T', GetoptLong::REQUIRED_ARGUMENT, 'test_data', 'test mode'], [ '--show-groups', '-s', GetoptLong::NO_ARGUMENT, 'List all known groups'], [ '--add-group', '-a', GetoptLong::REQUIRED_ARGUMENT, 'fullname[,alias,dir,desc]', 'Add a group'], |
From: <jj...@us...> - 2004-02-27 13:20:49
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10822/ngetsuite Modified Files: downloader.rb group.rb ngetcache.rb queue.rb utils.rb Log Message: even more sexier daemon, unified colors (blue: info, green: success, yellow: error in nget, red: error in ngetsuite) added an arg for Utils.debug to allow \r instead of \n, used it everywhere Index: downloader.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/downloader.rb,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** downloader.rb 25 Feb 2004 22:37:10 -0000 1.25 --- downloader.rb 27 Feb 2004 13:12:07 -0000 1.26 *************** *** 42,47 **** end ! def ldebug(str) ! debug "(#{white @queueindex})" + str end --- 42,47 ---- end ! def ldebug(str, linefeed=true) ! debug "(#{white @queueindex})" + str, linefeed end *************** *** 51,62 **** when /^(\d+) \((\d+)\/(\d+)\): (\d+)\/(\d+)L (\d+)\/(\d+)B (\d+)% (\d+)B\/s (\w+) (\d+)\/(\d+) (\w+)$/ part, size, speed, filenb = $2, $7, $9, $12 ! ldebug "#{yellow $5+'L'}(#{yellow $7+'B'}) at #{red $9+'B/s'} [#{blue $2}/#{blue $3}] [#{green $11}/#{green $12}]" @curfile.update(part, speed, filenb, size) ! when /^uu_msg\(\d+\):Loaded from (.*): '.*' \((.*)\): (.*) part (\d+)\s+begin\s+(yEnc|UUdata|Base64|XXdata|BinHex|plaintext|qptext|unknown)$/ artfile, base, filename, nb, enc = $1, $2, $3, $4, $5 ! ldebug "decoding filename : #{blue filename}, encoding : #{yellow enc}" ! artfile.sub!(/^.*\/([^\/]*)$/, '\1') ! ldebug "loaded #{green artfile}" @curfile._filename = filename @curfile.encoding = enc --- 51,60 ---- when /^(\d+) \((\d+)\/(\d+)\): (\d+)\/(\d+)L (\d+)\/(\d+)B (\d+)% (\d+)B\/s (\w+) (\d+)\/(\d+) (\w+)$/ part, size, speed, filenb = $2, $7, $9, $12 ! ldebug "#{green $5+'L'}(#{green $7+'B'}) at #{$9+'B/s'} [#{blue $2}/#{blue $3}] [#{yellow $11}/#{yellow $12}]", false @curfile.update(part, speed, filenb, size) ! when /^uu_msg\(\d+\):Loaded from (.*): '.*' \((.*)\): (.*) part (\d+)\s+begin\s+(?:end\s+)?(yEnc|UUdata|Base64|XXdata|BinHex|plaintext|qptext|unknown)$/ artfile, base, filename, nb, enc = $1, $2, $3, $4, $5 ! ldebug "#{blue 'Decoding'} #{filename} (encoding : #{enc})", false @curfile._filename = filename @curfile.encoding = enc *************** *** 66,70 **** # basename artfile.sub!(/^.*\/([^\/]*)$/, '\1') ! ldebug "loaded #{green artfile} (last)" when /^uu_msg\(\d+\):Loaded from (.*): '.*' \(.*\):.*part (\d+)\s+(yEnc|UUdata|Base64|XXdata|BinHex|plaintext|qptext|unknown)$/ --- 64,68 ---- # basename artfile.sub!(/^.*\/([^\/]*)$/, '\1') ! ldebug "#{blue 'Loaded'} #{artfile} (last)", false when /^uu_msg\(\d+\):Loaded from (.*): '.*' \(.*\):.*part (\d+)\s+(yEnc|UUdata|Base64|XXdata|BinHex|plaintext|qptext|unknown)$/ *************** *** 72,84 **** # basename artfile.sub!(/^.*\/([^\/]*)$/, '\1') ! ldebug "loaded #{green artfile}" - when /^already have article (<.*>) \(.*\/([^\/]*)\)$/ - ldebug "already have #{green $1} in #{blue $2}" - @nbfiles += 1 - when /^Retrieving: (\d+).*\t(\d+)l\t(\d+T\d+)\t(.*)\t(.*)\t(<.*>)$/ parts, nblines, date, subject, from, mid = $1, $2, $3, $4, $5, $6 ! ldebug "Retrieving #{blue subject}" artindex = Db.dbh.select_one("select `artindex` from `articles` where `mid`='#{mid}'") unless artindex --- 70,78 ---- # basename artfile.sub!(/^.*\/([^\/]*)$/, '\1') ! ldebug "#{blue 'Loaded'} #{artfile}", false when /^Retrieving: (\d+).*\t(\d+)l\t(\d+T\d+)\t(.*)\t(.*)\t(<.*>)$/ parts, nblines, date, subject, from, mid = $1, $2, $3, $4, $5, $6 ! ldebug "#{blue 'Retrieving'} #{subject}" artindex = Db.dbh.select_one("select `artindex` from `articles` where `mid`='#{mid}'") unless artindex *************** *** 100,117 **** @curfile.update_from_db end ! when /^already have (.*)$/ ! ldebug "already have '#{blue $1}'" # What is autopar ? when /^autopar: (.*) seems like a (par2?) \((.*)\)/ subject, ft, base = $1, $2, $3 ! ldebug "#{yellow 'autopar'}: found a #{ft} file: " + blue(base.length > 4 ? base : subject) when /^autopar: .* matches local (par2?)set \((.*)\)$/ ! ldebug "#{yellow 'autopar'}: got a #{$1}, set #{green $2}" when /^decoded ok/ ! ldebug 'file decoded' @curfile.finish_success @finish_status = 'FINISHED' --- 94,115 ---- @curfile.update_from_db end ! ! when /^already have article (<.*>) \(.*\/([^\/]*)\)$/ ! ldebug "#{blue 'found'} #{$1} in #{$2}", false ! @nbfiles += 1 ! when /^already have (.*)$/ ! ldebug "#{green 'Already have'} '#{$1}'" # What is autopar ? when /^autopar: (.*) seems like a (par2?) \((.*)\)/ subject, ft, base = $1, $2, $3 ! # ldebug "#{blue 'autopar'}: found a #{ft} file: " + blue(base.length > 4 ? base : subject) when /^autopar: .* matches local (par2?)set \((.*)\)$/ ! # ldebug "#{blue 'autopar'}: got a #{$1}, set #{blue $2}" when /^decoded ok/ ! ldebug "#{green 'Decoded'} #{@curfile._filename}" @curfile.finish_success @finish_status = 'FINISHED' *************** *** 120,135 **** when 'download error occured, keeping temp files.' ! ldebug "error while downloading #{@curfile._filename}" @curfile.finish_err @finish_status = 'FAILED' ! log "Download failed for #{@curfile._filename}, queue #{@value}" @curfile = nil # same as below when /^couldn't get (<.*>) from anywhere$/ ! ldebug "#{red 'Couldn\'t download mid '} #{$1}" when / decoding errors occured, keeping temp files\.$/ ! ldebug "error while decoding #{@curfile._filename}" @curfile.finish_err_dec @finish_status = 'FAILED' --- 118,135 ---- when 'download error occured, keeping temp files.' ! ldebug "#{yellow 'Error'} while downloading" @curfile.finish_err @finish_status = 'FAILED' ! # we do not know the file name ! # log "Download failed for #{@curfile._filename}, queue #{@value}" @curfile = nil # same as below when /^couldn't get (<.*>) from anywhere$/ ! ldebug "#{yellow 'Error'}: couldn't get #{$1}" ! @finish_status = 'FAILED' when / decoding errors occured, keeping temp files\.$/ ! ldebug "#{yellow 'Error'} while decoding #{@curfile._filename}" @curfile.finish_err_dec @finish_status = 'FAILED' *************** *** 138,151 **** when /^Connecting to (.*)$/ ! ldebug "Connection to #{$1}.." when />> 200/ ! ldebug 'Connected' when />> 400/ ! ldebug 'Disconnected' when /<< QUIT/ ! ldebug 'Quitted' when /^doarticle \d+: \d+!=\d+ \|\| \d+!=\d+$/ ! when /^unequal line count \d+ should equal \d+$/ ! ldebug 'unequal line count' when />> \d\d\d/, /<< (GROUP|AUTHINFO)/ --- 138,161 ---- when /^Connecting to (.*)$/ ! ldebug "Connection to #{$1}..", false when />> 200/ ! ldebug green('Connected') when />> 400/ ! ldebug red('Disconnected') when /<< QUIT/ ! ldebug blue('Quitted') ! ! when 'ignored error (nntp_getline: connection closed unexpectedly)' ! ldebug "#{red 'Lost connection'}. Reconnecting..." ! ! when /close\(fast\)$/ ! when /^error, will try .* again \(server says byebye: (.*)\)/ ! ldebug red("Disconnected (#{$1})") + '. Reconnecting...', false ! when /^nntp_doarticle: try again./ ! when /^make_connection/ ! when /^doarticle \d+: \d+!=\d+ \|\| \d+!=\d+$/ ! when /^unequal line count (\d+) should equal (\d+)$/ ! ldebug "unequal line count (#{$1} != #{$2})" when />> \d\d\d/, /<< (GROUP|AUTHINFO)/ *************** *** 154,160 **** ok,warn,errs = $1, $2, $3 @finish_status = (errs ? 'FAILED' : 'FINISHED') ! ldebug "Finished: ok#{green ok} warnings#{blue warn} errors#{red errs}" else ! ldebug blue('unhandled msg: ') + line end end --- 164,170 ---- ok,warn,errs = $1, $2, $3 @finish_status = (errs ? 'FAILED' : 'FINISHED') ! ldebug "Finished:#{' ok'+green(ok) if ok}#{' warnings'+yellow(warn) if warn}#{' errors'+red(errs) if errs}" else ! ldebug blue('unhandled: ') + line end end Index: group.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/group.rb,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** group.rb 25 Feb 2004 22:37:10 -0000 1.39 --- group.rb 27 Feb 2004 13:12:07 -0000 1.40 *************** *** 159,175 **** n = rand(900000)+100000 ! $stdout.sync = true if $stdout.isatty begin ! IO.popen("nice -n#{$config['nice_nget_update']} -- #{$config['nget']} -g #{@_fullname} -cr '^#{n}Dummy' 2>&1").each("\r") do |line| ! print "progress#{yellow $1} speed#{blue $2} ETA #{$3} \r" if line =~ /Retrieving headers \d+-\d+ : \d+\/\d+\/\d+(\s+\d+%)(\s+\d+B\/s)(.*s)/ and $stdout.isatty ! end rescue print "\nInterrupted" end - print "\n" if $stdout.isatty - $stdout.sync = false if $stdout.isatty - debug "Updatengetcache finished in #{Utils.cooltime(Time.now-t)}" end --- 159,172 ---- n = rand(900000)+100000 ! cmdline = "nice -n#{$config['nice_nget_update']} -- #{$config['nget']} -g #{@_fullname} -cr '^#{n}Dummy' 2>&1" begin ! IO.popen(cmdline).each("\r") { |line| ! debug("progress#{yellow $1} speed#{blue $2} ETA #{$3}", false) if line =~ /Retrieving headers \d+-\d+ : \d+\/\d+\/\d+(\s+\d+%)(\s+\d+B\/s)(.*s)/ ! } rescue print "\nInterrupted" end debug "Updatengetcache finished in #{Utils.cooltime(Time.now-t)}" end *************** *** 180,184 **** nb_rows = Db.dbh.do "delete from `articles` where `groupindex`='#{@_groupindex}'" - # and `artindex` < '#{@_cache_low}' debug "#{nb_rows} articles deleted" --- 177,180 ---- *************** *** 210,214 **** cache.parse(filecallback) @_cache_low,@_cache_high = cache.servers[0].low, cache.servers[0].high ! debug "Parsengetcache done in #{Utils.cooltime(Time.now-t)}" end --- 206,211 ---- cache.parse(filecallback) @_cache_low,@_cache_high = cache.servers[0].low, cache.servers[0].high ! nb_rows = Db.dbh.select_one("select count(*) from `articles` where `groupindex`='#{@_groupindex}'")[0] ! debug "#{nb_rows} articles inserted in #{Utils.cooltime(Time.now-t)}" end *************** *** 259,263 **** end ! debug "Indexed #{nb_nfos} nfos in #{Utils.cooltime(Time.now-t)}" end --- 256,260 ---- end ! debug "#{nb_nfos} nfos indexed in #{Utils.cooltime(Time.now-t)}" end *************** *** 286,290 **** rls.insert_to_db ! debug "Inserted #{nb_releases} releases in #{Utils.cooltime(Time.now-t)}" end --- 283,287 ---- rls.insert_to_db ! debug "#{nb_releases} releases inserted in #{Utils.cooltime(Time.now-t)}" end Index: ngetcache.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/ngetcache.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ngetcache.rb 20 Feb 2004 16:44:39 -0000 1.8 --- ngetcache.rb 27 Feb 2004 13:12:07 -0000 1.9 *************** *** 10,16 **** class NgetCache require 'zlib' attr_reader :servers, :files, :sane, :lineno, :groupname ! attr_accessor :writeoldformat, :printadvance CacheServer = Struct.new('CacheServer', 'serverid', 'high', 'low', 'num') --- 10,28 ---- class NgetCache require 'zlib' + begin + require 'ngetsuite/utils' + rescue LoadError => e + module NgetSuite + class Utils + def Utils.debug(arg, booh) + print "\r"+' '*80+"\r"+arg + $stdout.flush + end + end + end + end attr_reader :servers, :files, :sane, :lineno, :groupname ! attr_accessor :writeoldformat CacheServer = Struct.new('CacheServer', 'serverid', 'high', 'low', 'num') *************** *** 25,29 **** @groupname = groupname @path = path - @printadvance = $stdout.isatty and false # parse the file head --- 37,40 ---- *************** *** 89,93 **** break if @limit and ((@limit -= 1) < 0) end - print "\rFinished \n" if @printadvance end --- 100,103 ---- *************** *** 134,138 **** end @partscountcurrent += 1 ! print "#{@partscountcurrent}/#{@partscounttotal}\r" if @printadvance and @partscountcurrent % 20 == 0 part end --- 144,148 ---- end @partscountcurrent += 1 ! NgetSuite::Utils.debug "#{@partscountcurrent}/#{@partscounttotal}", false if @partscountcurrent % 20 == 0 part end Index: queue.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/queue.rb,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** queue.rb 20 Feb 2004 16:44:39 -0000 1.24 --- queue.rb 27 Feb 2004 13:12:07 -0000 1.25 *************** *** 135,139 **** s += ", started #{@_date_started.strftime('%d/%m %H:%M:%S')}" else ! s += ", #{@_status.downcase} since #{@_date_finished.strftime('%d/%m %H:%M:%S')}" end if @_period != 0 --- 135,140 ---- s += ", started #{@_date_started.strftime('%d/%m %H:%M:%S')}" else ! s += ", #{@_status.downcase}" ! s += " since #{@_date_finished.strftime('%d/%m %H:%M:%S')}" if @_date_finished end if @_period != 0 Index: utils.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/utils.rb,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** utils.rb 23 Feb 2004 17:08:08 -0000 1.15 --- utils.rb 27 Feb 2004 13:12:07 -0000 1.16 *************** *** 18,28 **** WHITE_BG = 47 # print +message+ if debugging is enabled ! def debug(message=nil) ! Utils.debug message end ! def Utils.debug(message=nil) ! puts "#{green 'D'}: #{message}" if $config['debug'] and message end --- 18,42 ---- WHITE_BG = 47 + @@clearlastdebugline = false + # print +message+ if debugging is enabled ! def debug(message=nil, linefeed=true) ! Utils.debug message, linefeed end ! def Utils.debug(message=nil, linefeed=true) ! return unless $config['debug'] and message ! return if not linefeed and not $stdout.isatty ! msg = "#{green 'D'}: #{message}" ! # TODO: $stdout.tty.length ! msg = ' ' * 80 + "\r" + msg if @@clearlastdebugline ! if linefeed or not $stdout.isatty ! @@clearlastdebugline = false ! puts msg ! else ! @@clearlastdebugline = true ! print msg + "\r" ! $stdout.flush ! end end |
From: <jj...@us...> - 2004-02-27 13:20:49
|
Update of /cvsroot/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10822 Modified Files: daemon.rb ngetsuite.rb resetdb.rb Log Message: even more sexier daemon, unified colors (blue: info, green: success, yellow: error in nget, red: error in ngetsuite) added an arg for Utils.debug to allow \r instead of \n, used it everywhere Index: daemon.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/daemon.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** daemon.rb 20 Feb 2004 14:42:43 -0000 1.13 --- daemon.rb 27 Feb 2004 13:12:06 -0000 1.14 *************** *** 1,5 **** #!/usr/bin/env ruby ! $wd = __FILE__.sub(/\/[^\/]*$/, '') $wd = Dir::pwd if $wd == '.' or not FileTest.directory? $wd Dir.chdir($wd) --- 1,5 ---- #!/usr/bin/env ruby ! $wd = __FILE__.sub(/^(.*)\/[^\/]*$/, '\1') $wd = Dir::pwd if $wd == '.' or not FileTest.directory? $wd Dir.chdir($wd) Index: ngetsuite.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite.rb,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ngetsuite.rb 9 Feb 2004 21:34:49 -0000 1.19 --- ngetsuite.rb 27 Feb 2004 13:12:06 -0000 1.20 *************** *** 1,5 **** #!/usr/bin/env ruby ! wd = __FILE__.sub(/\/[^\/]*$/, '') Dir.chdir(wd) if FileTest.directory? wd --- 1,5 ---- #!/usr/bin/env ruby ! wd = __FILE__.sub(/^(.*)\/[^\/]*$/, '\1') Dir.chdir(wd) if FileTest.directory? wd Index: resetdb.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/resetdb.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** resetdb.rb 20 Feb 2004 14:42:43 -0000 1.3 --- resetdb.rb 27 Feb 2004 13:12:06 -0000 1.4 *************** *** 6,10 **** require 'ngetsuite/db' ! savedgroups = Db.dbh.select_all('select `fullname`,`shortname`,`directory`,`active`,`date_added`,`description` from `groups`') savedqueues = Db.dbh.select_all('select * from `queue`') puts "Queues (to restore manually)" + savedqueues.map{ |q| "\n"+q.map{|e| e.to_s }.join(', ') }.join --- 6,10 ---- require 'ngetsuite/db' ! savedgroups = Db.dbh.select_all('select `fullname`,`shortname`,`directory`,`active`,`date_added`,`description` from `groups` order by `groupindex`') savedqueues = Db.dbh.select_all('select * from `queue`') puts "Queues (to restore manually)" + savedqueues.map{ |q| "\n"+q.map{|e| e.to_s }.join(', ') }.join |
From: <jj...@us...> - 2004-02-25 22:44:46
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20904/ngetsuite Modified Files: core.rb downloader.rb downloadmanager.rb group.rb queue_file.rb Log Message: queue_file should work now the daemon puts the queues processing into PENDING if it is killed Index: core.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/core.rb,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** core.rb 20 Feb 2004 16:44:39 -0000 1.34 --- core.rb 25 Feb 2004 22:37:10 -0000 1.35 *************** *** 138,142 **** def set_period(queueindex, newperiod) q = Queue.getqueue(queueindex) ! q._period = period q.sync_to_db end --- 138,142 ---- def set_period(queueindex, newperiod) q = Queue.getqueue(queueindex) ! q._period = newperiod q.sync_to_db end Index: downloader.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/downloader.rb,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** downloader.rb 23 Feb 2004 17:08:08 -0000 1.24 --- downloader.rb 25 Feb 2004 22:37:10 -0000 1.25 *************** *** 49,60 **** line.chomp! case line when /^already have article (<.*>) \(.*\/([^\/]*)\)$/ ldebug "already have #{green $1} in #{blue $2}" @nbfiles += 1 ! when /^Retrieving: (\d+).*\t(\d+)l.*(<.*>)$/ ! parts, nblines, mid = $1, $2, $3 artindex = Db.dbh.select_one("select `artindex` from `articles` where `mid`='#{mid}'") unless artindex ! puts "No such article: #{mid}" artindex = [nil] end --- 49,87 ---- line.chomp! case line + when /^(\d+) \((\d+)\/(\d+)\): (\d+)\/(\d+)L (\d+)\/(\d+)B (\d+)% (\d+)B\/s (\w+) (\d+)\/(\d+) (\w+)$/ + part, size, speed, filenb = $2, $7, $9, $12 + ldebug "#{yellow $5+'L'}(#{yellow $7+'B'}) at #{red $9+'B/s'} [#{blue $2}/#{blue $3}] [#{green $11}/#{green $12}]" + @curfile.update(part, speed, filenb, size) + + when /^uu_msg\(\d+\):Loaded from (.*): '.*' \((.*)\): (.*) part (\d+)\s+begin\s+(yEnc|UUdata|Base64|XXdata|BinHex|plaintext|qptext|unknown)$/ + artfile, base, filename, nb, enc = $1, $2, $3, $4, $5 + ldebug "decoding filename : #{blue filename}, encoding : #{yellow enc}" + artfile.sub!(/^.*\/([^\/]*)$/, '\1') + ldebug "loaded #{green artfile}" + @curfile._filename = filename + @curfile.encoding = enc + + when /^uu_msg\(\d+\):Loaded from (.*): '.*' \(.*\):.*part (\d+)\s+end\s+(yEnc|UUdata|Base64|XXdata|BinHex|plaintext|qptext|unknown)$/ + artfile, nb = $1, $3 + # basename + artfile.sub!(/^.*\/([^\/]*)$/, '\1') + ldebug "loaded #{green artfile} (last)" + + when /^uu_msg\(\d+\):Loaded from (.*): '.*' \(.*\):.*part (\d+)\s+(yEnc|UUdata|Base64|XXdata|BinHex|plaintext|qptext|unknown)$/ + artfile, nb = $1, $3 + # basename + artfile.sub!(/^.*\/([^\/]*)$/, '\1') + ldebug "loaded #{green artfile}" + when /^already have article (<.*>) \(.*\/([^\/]*)\)$/ ldebug "already have #{green $1} in #{blue $2}" @nbfiles += 1 ! ! when /^Retrieving: (\d+).*\t(\d+)l\t(\d+T\d+)\t(.*)\t(.*)\t(<.*>)$/ ! parts, nblines, date, subject, from, mid = $1, $2, $3, $4, $5, $6 ! ldebug "Retrieving #{blue subject}" artindex = Db.dbh.select_one("select `artindex` from `articles` where `mid`='#{mid}'") unless artindex ! ldebug "#{red 'BUG'}: No such article in db.articles: #{mid}" artindex = [nil] end *************** *** 64,100 **** Db.dbh.do "update `queue` set `nbfiles`='#{@nbfiles}' where `queueindex`='#{@queueindex}'" @curfile = QueueFile.new(@queueindex, artindex, false, parts, nblines, @nbfiles) if not QueueFile.already_in_db(@queueindex, artindex) @curfile.insert_to_db else @curfile.update_from_db - ldebug (red "Article already in database") end ! when /^(\d+) \((\d+)\/(\d+)\): (\d+)\/(\d+)L (\d+)\/(\d+)B (\d+)% (\d+)B\/s (\w+) (\d+)\/(\d+) (\w+)$/ ! part, size, speed, filenb = $2, $7, $9, $12 ! ldebug "#{yellow $5+'L'}(#{yellow $7+'B'}) at #{red $9+'B/s'} [#{blue $2}/#{blue $3}] [#{green $11}/#{green $12}]" ! @curfile.update(part, speed, filenb, size) ! when /\d+ \((\d+)\/\d+\).*\d+\/(\d+)B.* (\d+)B\/s \w+ (\d+)\/(\d+) \w+$/ ! ldebug (red "ERR the previous regexp should have been matched instead of this one") ! part, size, speed, filenb = $1, $2, $3, $4 ! @curfile.update(part, speed, filenb, size) ! when /^autopar.*seems like a (par2?) \((.*)\)/ ! ldebug "#{yellow 'autopar'}: found a #{$1} file for " + blue($2) when /^already have (.*)$/ ! ldebug "already have the file '#{blue $1}'" when /^autopar: .* matches local (par2?)set \((.*)\)$/ ! ldebug "#{yellow 'autopar'}: got a #{$1} for the set #{blue $2}" ! when /^uu_msg\(\d+\):Loaded from .*: '.*' \(.*\): (.*) part \d+.*end (.*)$/ ! ldebug "decoding filename : #{blue $1}, encoding : #{yellow $2}" ! @curfile._filename = $1 ! @curfile.encoding = $2 ! when /^uu_msg\(\d+\):Loaded from (.*): '.*' \(.*\): (.*) part (\d+).*$/ ! file, dfile, nb = $1, $2, $3 ! ldebug "loaded #{green file.sub(/^.*\/([^\/]*)$/, '\1')} (n° #{yellow nb} for #{blue dfile})" when /^decoded ok/ ldebug 'file decoded' ! @curfile.finish(true) @finish_status = 'FINISHED' log "Download finished for file #{@curfile._filename}, queue #{@value}" when /^Connecting to (.*)$/ ldebug "Connection to #{$1}.." --- 91,140 ---- Db.dbh.do "update `queue` set `nbfiles`='#{@nbfiles}' where `queueindex`='#{@queueindex}'" + ldebug "#{red 'BUG'}: Old queue_file present while creating new" if @curfile + @curfile.finish_err if @curfile @curfile = QueueFile.new(@queueindex, artindex, false, parts, nblines, @nbfiles) if not QueueFile.already_in_db(@queueindex, artindex) @curfile.insert_to_db else + ldebug 'Queue_file already in db' @curfile.update_from_db end ! when /^already have (.*)$/ ! ldebug "already have '#{blue $1}'" ! ! # What is autopar ? ! when /^autopar: (.*) seems like a (par2?) \((.*)\)/ ! subject, ft, base = $1, $2, $3 ! ldebug "#{yellow 'autopar'}: found a #{ft} file: " + blue(base.length > 4 ? base : subject) ! when /^autopar: .* matches local (par2?)set \((.*)\)$/ ! ldebug "#{yellow 'autopar'}: got a #{$1}, set #{green $2}" ! when /^decoded ok/ ldebug 'file decoded' ! @curfile.finish_success @finish_status = 'FINISHED' log "Download finished for file #{@curfile._filename}, queue #{@value}" + @curfile = nil + + when 'download error occured, keeping temp files.' + ldebug "error while downloading #{@curfile._filename}" + @curfile.finish_err + @finish_status = 'FAILED' + log "Download failed for #{@curfile._filename}, queue #{@value}" + @curfile = nil + + # same as below + when /^couldn't get (<.*>) from anywhere$/ + ldebug "#{red 'Couldn\'t download mid '} #{$1}" + + when / decoding errors occured, keeping temp files\.$/ + ldebug "error while decoding #{@curfile._filename}" + @curfile.finish_err_dec + @finish_status = 'FAILED' + log "Download finished, decoding failed for #{@curfile._filename}, queue #{@value}" + @curfile = nil + when /^Connecting to (.*)$/ ldebug "Connection to #{$1}.." *************** *** 109,117 **** ldebug 'unequal line count' when />> \d\d\d/, /<< (GROUP|AUTHINFO)/ ! # nothing ! when 'download error occured, keeping temp files.' ! # same as below ! when /^couldn't get (<.*>) from anywhere$/ ! ldebug red("Couldn't download mid ") + green($1) when /^(?:OK:(.*))?(?:WARNINGS:(.*))?(?:ERRORS:(.*))?$/ return unless $1 or $2 or $3 --- 149,153 ---- ldebug 'unequal line count' when />> \d\d\d/, /<< (GROUP|AUTHINFO)/ ! when /^(?:OK:(.*))?(?:WARNINGS:(.*))?(?:ERRORS:(.*))?$/ return unless $1 or $2 or $3 *************** *** 147,152 **** puts 'Error message: ' + e.errstr parent.stop ! rescue Object parent.stop end } --- 183,190 ---- puts 'Error message: ' + e.errstr parent.stop ! rescue Object => e ! puts 'Exception while parsing nget output: '+e.class.to_s + "\n" + e.backtrace.join("\n") parent.stop + raise end } *************** *** 162,167 **** # oh no they killed kenny ! ldebug red('dlder.stop') ! @finish_status = command ? 'STOPPED' : 'FAILED' ! newstat = "`status`='#{finish_status}',`date_finished`=NOW()" newstat += ",`period`='0'" if command Db.dbh.do 'lock tables queue write' --- 200,205 ---- # oh no they killed kenny ! ldebug red('dlder.stop') ! @finish_status = (command ? 'STOPPED' : 'PENDING') ! newstat = "`status`='#{@finish_status}',`date_finished`=NOW()" newstat += ",`period`='0'" if command Db.dbh.do 'lock tables queue write' Index: downloadmanager.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/downloadmanager.rb,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** downloadmanager.rb 20 Feb 2004 16:44:39 -0000 1.23 --- downloadmanager.rb 25 Feb 2004 22:37:10 -0000 1.24 *************** *** 61,67 **** def start_new_downloader row = Db.dbh.select_one("select * from `queue` where `status`='PENDING' order by `priority` desc limit 1") ! row = Db.dbh.select_one("select * from `queue` where (`status`='FINISHED' and (`period` != 0) and ((NOW()-`date_finished`) > `period`)) order by `priority` desc limit 1") if not row and $config['resume_downloads'] ! row = Db.dbh.select_one("select * from `queue` where (`status`='STOPPED' and (`period` != 0) and ((NOW()-`date_finished`) > `period`)) order by `priority` desc limit 1") if not row and $config['resume_downloads'] ! row = Db.dbh.select_one("select * from `queue` where (`status`='FAILED' and ((NOW()-`date_finished`) > '7200')) order by `priority` desc limit 1") if not row and $config['resume_downloads'] return false if row == nil --- 61,67 ---- def start_new_downloader row = Db.dbh.select_one("select * from `queue` where `status`='PENDING' order by `priority` desc limit 1") ! row = Db.dbh.select_one("select * from `queue` where (`status`='FINISHED' and (`period`!='0') and ((NOW()-`date_finished`) > `period`)) order by `priority` desc limit 1") if not row and $config['resume_downloads'] ! row = Db.dbh.select_one("select * from `queue` where (`status`='STOPPED' and (`period`!='0') and ((NOW()-`date_finished`) > `period`)) order by `priority` desc limit 1") if not row and $config['resume_downloads'] ! row = Db.dbh.select_one("select * from `queue` where (`status`='FAILED' and (`period`!='0') and ((NOW()-`date_finished`) > 'period')) order by `priority` desc limit 1") if not row and $config['resume_downloads'] return false if row == nil Index: group.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/group.rb,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** group.rb 23 Feb 2004 17:08:08 -0000 1.38 --- group.rb 25 Feb 2004 22:37:10 -0000 1.39 *************** *** 188,193 **** lasthigh = @_cache_high filecallback = Proc.new { |f| ! if f.req >= 1 ! # and f.parts.articles.artnum.each > lasthigh partcnt = 0 size = 0 --- 188,197 ---- lasthigh = @_cache_high filecallback = Proc.new { |f| ! if f.req >= 1 and not f.parts.empty? and not f.parts[0].articles.empty? ! p = f.parts[0] ! artidx = p.articles[0].articlenum ! artmid = p.mid ! artdate = p.date ! partcnt = 0 size = 0 *************** *** 195,206 **** f.parts.each { |p| next if p.articles.empty? ! a = p.articles[0] ! size += a.bytes.to_i partcnt += 1 if partcnt >= f.req ! sth.execute(a.articlenum, p.mid, f.req, size, f.subject, f.author, p.date) end - # free mem - p.articles = nil } f.parts = nil --- 199,207 ---- f.parts.each { |p| next if p.articles.empty? ! size += p.articles[0].bytes.to_i partcnt += 1 if partcnt >= f.req ! sth.execute(artidx, artmid, f.req, size, f.subject, f.author, artdate) end } f.parts = nil Index: queue_file.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/queue_file.rb,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** queue_file.rb 20 Feb 2004 16:44:39 -0000 1.16 --- queue_file.rb 25 Feb 2004 22:37:17 -0000 1.17 *************** *** 41,45 **** def update(part, speed, filenb, size) - #puts "begin update : part = #{part}, speed = #{speed}, filenb = #{filenb}, size = #{size}" @part = part @_filenumber = filenb --- 41,44 ---- *************** *** 57,69 **** @_avgspeed = 0 if (@_avgspeed == nil) @_filename = 'not found' if (@_filename == nil) - @_date_finished = Db.now ! ! if res ! @_status = 'FINISHED' ! else ! @_status = 'ERROR_DECODING' ! end ! if @encoding == 'yEnc' @_size = @_size / YENC_OVERHEAD --- 56,61 ---- @_avgspeed = 0 if (@_avgspeed == nil) @_filename = 'not found' if (@_filename == nil) @_date_finished = Db.now ! @_status = res if @encoding == 'yEnc' @_size = @_size / YENC_OVERHEAD *************** *** 75,78 **** --- 67,82 ---- end + def finish_success + finish('FINISHED') + end + + def finish_err_dec + finish('ERROR_DECODING') + end + + def finish_err + finish('ERROR_RETRIEVING') + end + def to_s "-- #{@_filename} : [#{@part}/#{@dlparts}], speed = #{@_avgspeed}" |
From: <jj...@us...> - 2004-02-23 20:02:17
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29689/ngetsuite Modified Files: config.rb downloader.rb group.rb utils.rb Log Message: misc bugfix, fixed base changing function, added 'nice_nget_update' and 'nice_nget_download' config options Index: config.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/config.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** config.rb 6 Feb 2004 23:46:59 -0000 1.4 --- config.rb 23 Feb 2004 17:08:08 -0000 1.5 *************** *** 28,31 **** --- 28,33 ---- debug = false daemon_debug = false + nice_nget_update = 0 + nice_nget_download = 0 extern_headers_update = '' extern_nfos_fetch = '' Index: downloader.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/downloader.rb,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** downloader.rb 20 Feb 2004 16:44:39 -0000 1.23 --- downloader.rb 23 Feb 2004 17:08:08 -0000 1.24 *************** *** 80,84 **** @curfile.update(part, speed, filenb, size) when /^autopar.*seems like a (par2?) \((.*)\)/ ! ldebug "autopar: found a #{$1} file for " + blue($2) when /^already have (.*)$/ ldebug "already have the file '#{blue $1}'" --- 80,84 ---- @curfile.update(part, speed, filenb, size) when /^autopar.*seems like a (par2?) \((.*)\)/ ! ldebug "#{yellow 'autopar'}: found a #{$1} file for " + blue($2) when /^already have (.*)$/ ldebug "already have the file '#{blue $1}'" *************** *** 133,137 **** Db.dbh.do "update queue set `status`='PROCESSING', `date_started`=NOW() where `queueindex`='#{@queueindex}'" Db.dbh.do 'unlock tables' ! @io = IO.popen("#{$config['nget']} -q -I -G #{@group} -r '#{@value}' 2>&1") @t = Thread.new(@io, self){ |io, parent| begin --- 133,137 ---- Db.dbh.do "update queue set `status`='PROCESSING', `date_started`=NOW() where `queueindex`='#{@queueindex}'" Db.dbh.do 'unlock tables' ! @io = IO.popen("nice -n#{$config['nice_nget_download']} -- #{$config['nget']} -q -I -G #{@group} -r '#{@value}' 2>&1") @t = Thread.new(@io, self){ |io, parent| begin Index: group.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/group.rb,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** group.rb 20 Feb 2004 16:44:39 -0000 1.37 --- group.rb 23 Feb 2004 17:08:08 -0000 1.38 *************** *** 162,167 **** begin ! IO.popen("nice -n19 #{$config['nget']} -g #{@_fullname} -cr '^#{n}Dummy' 2>&1").each("\r") do |line| ! print "progress#{red $1} speed#{blue $2} ETA#{green $3} \r" if line =~ /Retrieving headers \d+-\d+ : \d+\/\d+\/\d+(\s+\d+%)(\s+\d+B\/s)(.*s)/ and $stdout.isatty end rescue --- 162,167 ---- begin ! IO.popen("nice -n#{$config['nice_nget_update']} -- #{$config['nget']} -g #{@_fullname} -cr '^#{n}Dummy' 2>&1").each("\r") do |line| ! print "progress#{yellow $1} speed#{blue $2} ETA #{$3} \r" if line =~ /Retrieving headers \d+-\d+ : \d+\/\d+\/\d+(\s+\d+%)(\s+\d+B\/s)(.*s)/ and $stdout.isatty end rescue *************** *** 172,176 **** $stdout.sync = false if $stdout.isatty ! debug "Updatengetcache finished in #{Time.now-t}s" end --- 172,176 ---- $stdout.sync = false if $stdout.isatty ! debug "Updatengetcache finished in #{Utils.cooltime(Time.now-t)}" end *************** *** 209,213 **** cache.parse(filecallback) @_cache_low,@_cache_high = cache.servers[0].low, cache.servers[0].high ! debug "Parsengetcache done in #{Time.now-t}s" end --- 209,213 ---- cache.parse(filecallback) @_cache_low,@_cache_high = cache.servers[0].low, cache.servers[0].high ! debug "Parsengetcache done in #{Utils.cooltime(Time.now-t)}" end *************** *** 230,237 **** begin # fetches the nfos, w/o decoding ! `nice -n19 #{$config['nget']} --path #{tempdir} -G #{@_fullname} -K -L 150 -r '\\.nfo|\\.txt' 2>&1` # but mark them for nget as if we didn't download them ! `#{$config['nget']} --path #{tempdir} -qq -G #{@_fullname} -U -r '\\.nfo|\\.txt' 2>&1` ! debug "Fetchnfos: #{Dir['ngettemp-*'].length} files downloaded in #{Time.now-t}s" nb_nfos = 0 --- 230,237 ---- begin # fetches the nfos, w/o decoding ! `nice -n#{$config['nice_nget_update']} -- #{$config['nget']} --path #{tempdir} -G #{@_fullname} -K -L 150 -r '\\.nfo|\\.txt' 2>&1` # but mark them for nget as if we didn't download them ! `nice -n#{$config['nice_nget_update']} -- #{$config['nget']} --path #{tempdir} -qq -G #{@_fullname} -U -r '\\.nfo|\\.txt' 2>&1` ! debug "Fetchnfos: #{Dir['ngettemp-*'].length} files downloaded in #{Utils.cooltime(Time.now-t)}" nb_nfos = 0 *************** *** 258,262 **** end ! debug "Indexed #{nb_nfos} nfos in #{Time.now-t}s" end --- 258,262 ---- end ! debug "Indexed #{nb_nfos} nfos in #{Utils.cooltime(Time.now-t)}" end *************** *** 285,289 **** rls.insert_to_db ! debug "Inserted #{nb_releases} releases in #{Time.now-t}s" end --- 285,289 ---- rls.insert_to_db ! debug "Inserted #{nb_releases} releases in #{Utils.cooltime(Time.now-t)}" end Index: utils.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/utils.rb,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** utils.rb 21 Feb 2004 15:58:18 -0000 1.14 --- utils.rb 23 Feb 2004 17:08:08 -0000 1.15 *************** *** 89,111 **** end ! def Utils.spreadbase(value, base, nbunits, delimiters) return '-1' unless value last = delimiters.pop ! arr = delimiters.map { |d| v = value % base value /= base ! "#{v}#{d}" ! } << "#{value}#{last}" ! ! a = arr.last ! while a.to_i == 0 ! a = arr.pop ! end ! ! return arr.reverse[0..nbunits-1].join(' ') end def Utils.cooltime(seconds) ! Utils.spreadbase(seconds.to_i, 60, 2, ['s', 'm', 'h']) end def cooltime(seconds) --- 89,108 ---- end ! def Utils.spreadbase(value, base, nbshow, delimiters) return '-1' unless value last = delimiters.pop ! arr = Array.new ! arr.concat delimiters.map { |d| v = value % base value /= base ! "#{v}#{d}" if v != 0 ! }.compact ! arr << "#{value}#{last}" if value != 0 ! arr << "0#{delimiters[0]}" if arr.empty? ! return arr.reverse[0..nbshow-1].join(' ') end def Utils.cooltime(seconds) ! Utils.spreadbase(seconds.to_i, 60, 3, ['s', 'm', 'h']) end def cooltime(seconds) *************** *** 114,120 **** def Utils.pretty_size(size) ! Utils.spreadbase(size.to_i, 1024, 1, ['b', 'kb', 'Mb']) end - def pretty_size(asize) Utils.pretty_size(asize) --- 111,116 ---- def Utils.pretty_size(size) ! Utils.spreadbase(size.to_i, 1024, 1, ['b', 'kb', 'Mb', 'Gb']) end def pretty_size(asize) Utils.pretty_size(asize) |
From: <ys...@us...> - 2004-02-21 16:11:11
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15352/ngetsuite Modified Files: utils.rb web.rb Log Message: UI somewhat "improved", fixed ugly pretty_size Index: utils.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/utils.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** utils.rb 20 Feb 2004 16:44:39 -0000 1.13 --- utils.rb 21 Feb 2004 15:58:18 -0000 1.14 *************** *** 89,93 **** end ! def Utils.spreadbase(value, base, delimiters) return '-1' unless value last = delimiters.pop --- 89,93 ---- end ! def Utils.spreadbase(value, base, nbunits, delimiters) return '-1' unless value last = delimiters.pop *************** *** 97,105 **** "#{v}#{d}" } << "#{value}#{last}" ! return arr.reverse[0..1].join(' ') end def Utils.cooltime(seconds) ! Utils.spreadbase(seconds.to_i, 60, ['s', 'm', 'h']) end def cooltime(seconds) --- 97,111 ---- "#{v}#{d}" } << "#{value}#{last}" ! ! a = arr.last ! while a.to_i == 0 ! a = arr.pop ! end ! ! return arr.reverse[0..nbunits-1].join(' ') end def Utils.cooltime(seconds) ! Utils.spreadbase(seconds.to_i, 60, 2, ['s', 'm', 'h']) end def cooltime(seconds) *************** *** 108,113 **** def Utils.pretty_size(size) ! Utils.spreadbase(size.to_i, 1024, ['b', 'kb', 'Mb', 'Gb']) end def pretty_size(asize) Utils.pretty_size(asize) --- 114,120 ---- def Utils.pretty_size(size) ! Utils.spreadbase(size.to_i, 1024, 1, ['b', 'kb', 'Mb']) end + def pretty_size(asize) Utils.pretty_size(asize) Index: web.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/web.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** web.rb 20 Feb 2004 23:07:45 -0000 1.7 --- web.rb 21 Feb 2004 15:58:18 -0000 1.8 *************** *** 115,118 **** --- 115,127 ---- end + def Web.date_str(isodate) + if isodate == "any" + "All articles" + else + y, m, d = isodate.split('-') + Time.local(y,m,d).strftime("%A, %B %d") + end + end + end #class |
Update of /cvsroot/ngetsuite/ngetsuite/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15352/web Modified Files: group.rhtml index.rhtml ngetsuite.css release.rhtml top.rhtml Added Files: cyan.png green.png grouphome.rhtml red.png Log Message: UI somewhat "improved", fixed ugly pretty_size --- NEW FILE: cyan.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: green.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: grouphome.rhtml --- <% require 'ngetsuite/db' require 'ngetsuite/utils' require 'ngetsuite/web' web = NgetSuite::Web.new(servlet_request) web.handle_args web.update_queue class GroupStats def initialize(groupindex) statsq = "select DATE_FORMAT(`time`,'%Y-%m-%d') as isodate, COUNT(distinct a.`rlsartindex`) as nbrls, COUNT(a.`artindex`) as nbarticles, COUNT(n.`text`) as nbnfos, SUM(a.`size`) as size from `articles` a left join `nfos` n using (`artindex`,`groupindex`) where a.`groupindex`='#{groupindex}' group by isodate order by isodate desc" @sth = NgetSuite::Db.dbh.execute statsq end def each_date return unless @sth @sth.fetch { |row| yield row } end end %> <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <link href="ngetsuite.css" rel="stylesheet" type="text/css"> <title>Group home</title> </head> <body> <div class="sectiontitle"><%= web.group._fullname %></div> <p>Added <b><%= web.group._date_added %></b></p> <p>Last updated <b><%= web.group._date_updated %></b></p> <p>Default download directory: <b><%= web.group._directory %></b></p> <% stats = GroupStats.new(web.group._groupindex) %> <ul> <% stats.each_date { |row| %> <li><b><%= NgetSuite::Web.date_str(row["isodate"]) %></b><br> <%= row["nbarticles"] %> articles posted, taking up <%= NgetSuite::Utils.pretty_size(row["size"]) %><br> <a href="group.rhtml?group=<%= web.group._fullname %>&date=<%= row["isodate"] %>"><%= row["nbrls"] %> releases</a><br> <a href="nfolist.rhtml?group=<%= web.group._fullname %>&date=<%= row["isodate"] %>"><%= row["nbnfos"] %> text files (nfos) retrieved</a><br><br> <% } %> </ul> </body> </html> --- NEW FILE: red.png --- (This appears to be a binary file; contents omitted.) Index: group.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/group.rhtml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** group.rhtml 20 Feb 2004 16:44:40 -0000 1.5 --- group.rhtml 21 Feb 2004 15:58:34 -0000 1.6 *************** *** 10,27 **** web.update_queue - class GroupDates - def initialize(groupindex) - datesq = "select DATE_FORMAT(`time`,'%Y-%m-%d') as isodate, DATE_FORMAT(`time`, '%d/%m') from `articles` where `groupindex`='#{groupindex}' group by isodate order by isodate desc" - @sth = NgetSuite::Db.dbh.execute datesq - end - - def each - return unless @sth - @sth.fetch { |row| - yield row[0], row[1] - } - end - end - class Releases def initialize(groupindex,date) --- 10,13 ---- *************** *** 40,64 **** return unless @sth @sth.fetch_hash { |row| ! row["graphmap"] = "" if row["rlsmap"] != "" for i in 0..row["rlsmap"].size-1 if row["rlsmap"][i] == "#"[0] then ! row["graphmap"] += "<font class=\"greenbox\">#{i+1}</font>" else ! row["graphmap"] += "<font class=\"redbox\">#{i+1}</font>" end ! row["graphmap"] += "<br>" if i % 25 == 24 end - row["graphmap"] += "<br>" else for i in 1..row["nbactual"] ! row["graphmap"] += "<font class=\"cyanbox\">#{i}</font>" ! row["graphmap"] += "<br>" if i % 25 == 24 end - row["graphmap"] += "<br>" end yield row } --- 26,54 ---- return unless @sth @sth.fetch_hash { |row| ! # row["graphmap"] = "<table class=\"rlsmap\" cellspacing=\"1\"><tr>" ! row["graphmap"] = "<div class=\"rlsmap\">#{row["nbactual"]}/#{row["nbexpected"]} " if row["rlsmap"] != "" for i in 0..row["rlsmap"].size-1 if row["rlsmap"][i] == "#"[0] then ! row["graphmap"] += "<img src=\"green.png\" width=\"3\" height=\"5\">" ! # row["graphmap"] += "<td class=\"greenbox\">#{i+1}</td>" else ! row["graphmap"] += "<img src=\"red.png\" width=\"3\" height=\"5\">" ! # row["graphmap"] += "<td class=\"redbox\">#{i+1}</td>" end ! # row["graphmap"] += "</tr><tr>" if i % 20 == 19 end else for i in 1..row["nbactual"] ! row["graphmap"] += "<img src=\"cyan.png\" width=\"3\" height=\"5\">" ! # row["graphmap"] += "<td class=\"cyanbox\">#{i}</td>" ! # row["graphmap"] += "</tr><tr>" if i % 20 == 19 end end + row["graphmap"] += "</div>" + # row["graphmap"] += "</tr></table>" yield row } *************** *** 76,87 **** <body> - <% dates = GroupDates.new(web.group._groupindex) - - dates.each { |iso,display| %> - <a href="group.rhtml?group=<%= web.group._fullname %>&date=<%=iso%>"><%=display%></a> | - <% } %> - <a href="group.rhtml?group=<%= web.group._fullname %>&date=any">any</a> ! <div class="group"><%= web.date_str %></div> <% releases = Releases.new(web.group._groupindex, web.date) %> --- 66,71 ---- <body> ! <div class="sectiontitle"><%= web.date_str %></div> <% releases = Releases.new(web.group._groupindex, web.date) %> *************** *** 93,105 **** <% releases.each { |rls| %> ! <tr> ! <td><i><%= NgetSuite::Utils.pretty_date(rls["time"]).split(" ")[1] %></i><br> <b><%= NgetSuite::Utils.pretty_size(rls["size"]) %><b></td> ! <td><a class="rlslink" target="right" href="release.rhtml?group=<%= web.group._fullname %>&rlsartind=<%= rls["artindex"].to_s %>"><%= rls["subject"] %></a><br> <%= rls["graphmap"] %> </tr> ! <tr> <td class="linesep" colspan="2"></td> ! </tr> <% } %> --- 77,89 ---- <% releases.each { |rls| %> ! <tr class="article"> ! <td class="time"><i><%= NgetSuite::Utils.pretty_date(rls["time"]).split(" ")[1] %></i><br> <b><%= NgetSuite::Utils.pretty_size(rls["size"]) %><b></td> ! <td class="subject"><a class="rlslink" target="right" href="release.rhtml?group=<%= web.group._fullname %>&rlsartind=<%= rls["artindex"].to_s %>"><%= rls["subject"] %></a><br> <%= rls["graphmap"] %> </tr> ! <!-- <tr> <td class="linesep" colspan="2"></td> ! </tr> --> <% } %> Index: index.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/index.rhtml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** index.rhtml 20 Feb 2004 16:44:40 -0000 1.4 --- index.rhtml 21 Feb 2004 15:58:34 -0000 1.5 *************** *** 11,15 **** url_top += "?group=#{group}" if group ! url_left = (group) ? "group.rhtml?group=#{group}" : "welcome.rhtml" url_right = "queueview.rhtml" --- 11,15 ---- url_top += "?group=#{group}" if group ! url_left = (group) ? "grouphome.rhtml?group=#{group}" : "welcome.rhtml" url_right = "queueview.rhtml" Index: ngetsuite.css =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/ngetsuite.css,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ngetsuite.css 20 Feb 2004 23:07:45 -0000 1.11 --- ngetsuite.css 21 Feb 2004 15:58:34 -0000 1.12 *************** *** 26,29 **** --- 26,41 ---- } + a.sidelink { + font-size: 8pt; + font-weight: bold; + text-decoration: none; + color: black; + } + + a.sidelink:hover { + color: red; + text-decoration: none; + } + table.banner { border: 1px solid black; *************** *** 140,143 **** --- 152,163 ---- } + div.sectiontitle { + border: 1px solid gray; + margin: 0; + padding: 5px; + background-color: rgb(235, 235, 235); + } + + div.search { border: 1px solid gray; *************** *** 218,243 **** } ! font.greenbox { ! font-family: mono; padding: 1px; ! border: 1px solid #000000; ! background-color: #00FF00; ! font-size: 7pt; } ! font.redbox { ! font-family: mono; padding: 1px; ! border: 1px solid #000000; ! background-color: #FF0000; ! font-size: 7pt; } ! font.cyanbox { ! font-family: mono; padding: 1px; ! border: 1px solid #000000; background-color: #44DDFF; font-size: 7pt; } --- 238,304 ---- } ! table.rlsmap { ! padding: 0px; ! margin: 0px; ! text-align: center; ! } ! ! td.greenbox { padding: 1px; ! border: 1px outset; ! background-color: #008000; ! color: #FFFFFF; ! font-size: 5pt; } ! td.redbox { padding: 1px; ! border: 1px outset; ! background-color: #800000; ! color: #FFFFFF; ! font-size: 5pt; } ! td.cyanbox { padding: 1px; ! border: 1px outset; background-color: #44DDFF; + color: #000000; + font-size: 5pt; + } + + td.greenbar { + width: 1px; + height: 8px; + border: 1px outset; + background-color: #008000; + color: #FFFFFF; + font-size: 5pt; + } + + td.redbar { + width: 1px; + height: 8px; + border: 1px outset; + background-color: #800000; + color: #FFFFFF; + font-size: 5pt; + } + + td.cyanbar { + width: 1px; + height: 8px; + border: 1px outset; + background-color: #44DDFF; + color: #000000; + font-size: 5pt; + } + + + div.rlsmap { + padding: 2px; + background-color: #DDDDDD; font-size: 7pt; + font-weight: bold; } Index: release.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/release.rhtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** release.rhtml 20 Feb 2004 16:44:40 -0000 1.3 --- release.rhtml 21 Feb 2004 15:58:34 -0000 1.4 *************** *** 46,51 **** <body> - <a href="queue.rhtml?group=<%= web.group._fullname %>">return to queue list</a> - <% rls = ReleaseArticles.new(web.group._groupindex, web.rlsartind, web.date) %> --- 46,49 ---- *************** *** 84,102 **** <a name="artlist"></a> ! <div class="group">Articles list</div> ! <table class='articles'> ! <tr class='headers'> ! <th>Date/Size</th><th>Subject</th> </tr> <% rls.articles.each { |art| %> ! <tr> ! <td><i><%= NgetSuite::Utils.pretty_date(art["time"]) %></i><br> ! <b><%= NgetSuite::Utils.pretty_size(art["size"]) %><b></td> ! <td><%= art["subject"] %></td> ! </tr> ! <tr> ! <td class="linesep" colspan="2"></td> </tr> <% } %> --- 82,97 ---- <a name="artlist"></a> ! <div class="sectiontitle">Articles list</div> ! <table class="articles"> ! <tr class="headers"> ! <th>Date</th><th>Subject</th><th>Size</th> </tr> <% rls.articles.each { |art| %> ! <tr class="article"> ! <td class="time"><%= NgetSuite::Utils.pretty_date(art["time"]) %></td> ! <td class="subject"><%= art["subject"] %></td> ! <td class="size"><%= NgetSuite::Utils.pretty_size(art["size"]) %></td> </tr> <% } %> Index: top.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/top.rhtml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** top.rhtml 9 Nov 2003 01:25:33 -0000 1.1 --- top.rhtml 21 Feb 2004 15:58:34 -0000 1.2 *************** *** 10,13 **** --- 10,41 ---- #web.update_queue + if web.group then + leftlinks = [["summary", "grouphome.rhtml?group=#{web.group._fullname}"], + ["nfos", "nfolist.rhtml?group=#{web.group._fullname}"], + ["log", "log.rhtml?group=#{web.group._fullname}"]] + rightlinks = [["queue", "queueview.rhtml?group=#{web.group._fullname}"], + ["search", "search.rhtml?group=#{web.group._fullname}"]] + else + leftlinks = [["welcome", "welcome.rhtml"], + ["log", "log.rhtml"]] + rightlinks = [["queue", "queueview.rhtml"], + ["search", "search.rhtml"]] + end + + class GroupDates + def initialize(groupindex) + datesq = "select DATE_FORMAT(`time`,'%Y-%m-%d') as isodate, DATE_FORMAT(`time`, '%d/%m') from `articles` where `groupindex`='#{groupindex}' group by isodate order by isodate desc" + @sth = NgetSuite::Db.dbh.execute datesq + end + + def each + return unless @sth + @sth.fetch { |row| + yield row[0], row[1] + } + end + end + + %> <?xml version="1.0" encoding="ISO-8859-1"?> *************** *** 22,31 **** <table class="banner" width="100%" height="58" cellspacing="0" cellpadding="0"> <tr> ! <td width="100%" height="58" valign="top" align="center"> <table> <tr> <% NgetSuite::GroupList.new("order by `shortname`").each { |group| %> ! <td class="<%= (servlet_request.query["group"] == group._fullname) ? "grouptabsel" : "grouptab" %>"><a href="index.rhtml?group=<%= group._fullname %>" target="_top"><%= group._shortname %></a> ! <% } %> </td> </tr> --- 50,83 ---- <table class="banner" width="100%" height="58" cellspacing="0" cellpadding="0"> <tr> ! <td width="150" height="58" rowspan="2" align="left"> ! <% leftlinks.each { |link| %> ! <a class="sidelink" href="<%= link[1] %>" target="left"><%= link[0] %></a><br> ! <% } %> ! </td> ! <td width="100%" height="29" align="center"> <table> <tr> <% NgetSuite::GroupList.new("order by `shortname`").each { |group| %> ! <td class="<%= (servlet_request.query["group"] == group._fullname) ? "grouptabsel" : "grouptab" %>"><a href="index.rhtml?group=<%= group._fullname %>" target="_top"><%= group._shortname %></a></td> ! <% } %> ! </tr> ! </table> ! </td> ! <td width="150" height="58" rowspan="2" align="right"> ! <% rightlinks.each { |link| %> ! <a class="sidelink" href="<%= link[1] %>" target="right"><%= link[0] %></a><br> ! <% } %> ! </td> ! </tr> ! <tr> ! <td width="100%" height="27" align="center"> ! <% if web.group ! dates = GroupDates.new(web.group._groupindex) ! ! dates.each { |iso,display| %> ! <a href="group.rhtml?group=<%= web.group._fullname %>&date=<%=iso%>" target="left"><%=display%></a> | ! <% } %> ! <a href="group.rhtml?group=<%= web.group._fullname %>&date=any">any</a> ! <% end %> </td> </tr> |
From: <bla...@us...> - 2004-02-20 23:46:50
|
Update of /cvsroot/ngetsuite/ngetsuite/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10159 Modified Files: queueview.rhtml Log Message: stupid fix Index: queueview.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/queueview.rhtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** queueview.rhtml 20 Feb 2004 23:07:46 -0000 1.3 --- queueview.rhtml 20 Feb 2004 23:35:17 -0000 1.4 *************** *** 89,95 **** <% } %> </select></td> ! <td><%= q._date_added.strftime("%d/%m/%y %H:%M") %></td> ! <td><%= q._date_started.strftime("%d/%m/%y %H:%M") %></td> ! <td><%= q._date_finished.strftime("%d/%m/%y %H:%M") %></td> <td><input type='checkbox' name='toremove' value='<%= q._queueindex %>'></td> </tr> --- 89,95 ---- <% } %> </select></td> ! <td><%= q._date_added ? q._date_added.strftime("%d/%m/%y %H:%M") : "N/A" %></td> ! <td><%= q._date_started ? q._date_started.strftime("%d/%m/%y %H:%M") : "N/A" %></td> ! <td><%= q._date_finished ? q._date_finished.strftime("%d/%m/%y %H:%M") : "N/A" %></td> <td><input type='checkbox' name='toremove' value='<%= q._queueindex %>'></td> </tr> |
From: <bla...@us...> - 2004-02-20 23:19:23
|
Update of /cvsroot/ngetsuite/ngetsuite/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4854/web Modified Files: ngetsuite.css queueview.rhtml Log Message: fix removing and updating queues Index: ngetsuite.css =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/ngetsuite.css,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ngetsuite.css 4 Feb 2004 03:07:57 -0000 1.10 --- ngetsuite.css 20 Feb 2004 23:07:45 -0000 1.11 *************** *** 219,240 **** font.greenbox { padding: 1px; border: 1px solid #000000; background-color: #00FF00; ! font-size: 5pt; } font.redbox { padding: 1px; border: 1px solid #000000; background-color: #FF0000; ! font-size: 5pt; } font.cyanbox { padding: 1px; border: 1px solid #000000; background-color: #44DDFF; ! font-size: 5pt; } --- 219,243 ---- font.greenbox { + font-family: mono; padding: 1px; border: 1px solid #000000; background-color: #00FF00; ! font-size: 7pt; } font.redbox { + font-family: mono; padding: 1px; border: 1px solid #000000; background-color: #FF0000; ! font-size: 7pt; } font.cyanbox { + font-family: mono; padding: 1px; border: 1px solid #000000; background-color: #44DDFF; ! font-size: 7pt; } Index: queueview.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/queueview.rhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** queueview.rhtml 20 Feb 2004 16:44:40 -0000 1.2 --- queueview.rhtml 20 Feb 2004 23:07:46 -0000 1.3 *************** *** 85,95 **** </select></td> <td class='status'><select name='status'> ! <% ['PENDING', 'PROCESSING', 'FINISHED', 'STOPPED'].each { |item| %> <option <%= "selected" if q._status == item %> value='<%= item %>'><%= item %> <% } %> </select></td> ! <td><%= NgetSuite::Utils.pretty_date q._date_added %></td> ! <td><%= NgetSuite::Utils.pretty_date q._date_started %></td> ! <td><%= NgetSuite::Utils.pretty_date q._date_finished %></td> <td><input type='checkbox' name='toremove' value='<%= q._queueindex %>'></td> </tr> --- 85,95 ---- </select></td> <td class='status'><select name='status'> ! <% ['PENDING', 'PROCESSING', 'FINISHED', 'STOPPED', 'FAILED'].each { |item| %> <option <%= "selected" if q._status == item %> value='<%= item %>'><%= item %> <% } %> </select></td> ! <td><%= q._date_added.strftime("%d/%m/%y %H:%M") %></td> ! <td><%= q._date_started.strftime("%d/%m/%y %H:%M") %></td> ! <td><%= q._date_finished.strftime("%d/%m/%y %H:%M") %></td> <td><input type='checkbox' name='toremove' value='<%= q._queueindex %>'></td> </tr> |
From: <bla...@us...> - 2004-02-20 23:19:22
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4854/ngetsuite Modified Files: web.rb Log Message: fix removing and updating queues Index: web.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/web.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** web.rb 20 Feb 2004 16:44:39 -0000 1.6 --- web.rb 20 Feb 2004 23:07:45 -0000 1.7 *************** *** 15,27 **** @date = "any" ! @ids = @query['id' ].list() if @query.has_key? 'id' ! @selected = @query['selected'].list() if @query.has_key? 'selected' ! @toremove = @query['toremove'].list() if @query.has_key? 'toremove' ! @prio = @query['prio' ].list() if @query.has_key? 'prio' ! @status = @query['status' ].list() if @query.has_key? 'status' ! @value = @query['value' ].list() if @query.has_key? 'value' ! @filter = @query['filter' ].to_s if @query.has_key? 'filter' ! @date = @query['date' ].to_s if @query.has_key? 'date' ! @rlsartind= @query['rlsartind'].to_s if @query.has_key? 'rlsartind' @group = NgetSuite::Group.getgroup(@query['group'].to_s) if @query.has_key? 'group' --- 15,27 ---- @date = "any" ! @queueindex = @query['queueindex'].list() if @query.has_key? 'queueindex' ! @selected = @query['selected' ].list() if @query.has_key? 'selected' ! @toremove = @query['toremove' ].list() if @query.has_key? 'toremove' ! @prio = @query['prio' ].list() if @query.has_key? 'prio' ! @status = @query['status' ].list() if @query.has_key? 'status' ! @value = @query['value' ].list() if @query.has_key? 'value' ! @filter = @query['filter' ].to_s if @query.has_key? 'filter' ! @date = @query['date' ].to_s if @query.has_key? 'date' ! @rlsartind = @query['rlsartind' ].to_s if @query.has_key? 'rlsartind' @group = NgetSuite::Group.getgroup(@query['group'].to_s) if @query.has_key? 'group' *************** *** 76,80 **** # cgi def update_queue ! if @ids != nil and @toremove != nil @toremove.each { |item| q = Queue.getqueue(item) --- 76,80 ---- # cgi def update_queue ! if @queueindex != nil and @toremove != nil @toremove.each { |item| q = Queue.getqueue(item) *************** *** 82,88 **** } end ! if @ids != nil and @selected != nil i = 0 ! @ids.each { |item| if @selected.include?(item) if (@toremove != nil) and @toremove.include?(item) --- 82,88 ---- } end ! if @queueindex != nil and @selected != nil i = 0 ! @queueindex.each { |item| if @selected.include?(item) if (@toremove != nil) and @toremove.include?(item) |
From: <jj...@us...> - 2004-02-20 16:56:08
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20763/ngetsuite Modified Files: articles.rb core.rb db.rb downloader.rb downloadmanager.rb group.rb nfo.rb ngetcache.rb queue.rb queue_file.rb utils.rb web.rb Log Message: db structure adaptation Index: articles.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/articles.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** articles.rb 17 Feb 2004 14:56:31 -0000 1.5 --- articles.rb 20 Feb 2004 16:44:39 -0000 1.6 *************** *** 16,23 **** Db.autotable(Article, 'articles') ! def initialize(group, mid, fetch_from_db = false, nbparts = 0, rlsnb = 0, ! size = 0, subject = nil, from = nil, time = nil, release = nil) ! @_mid = mid ! @_group = group @_nbparts = nbparts @_size = size --- 16,22 ---- Db.autotable(Article, 'articles') ! def initialize(artindex, groupindex, fetch_from_db = false, nbparts = 0, rlsnb = 0, size = 0, subject = nil, from = nil, time = nil, rlsartindex = nil) ! @_artindex = artindex ! @_groupindex = groupindex @_nbparts = nbparts @_size = size *************** *** 25,29 **** @_from = from @_time = time ! @_release = release update_from_db if fetch_from_db end --- 24,28 ---- @_from = from @_time = time ! @_rlsartindex = rlsartindex update_from_db if fetch_from_db end *************** *** 40,52 **** Db.autotable(Release, 'releases') ! def initialize(group, mid, fetch_from_db = false ) @files = Array.new ! @_mid = mid ! @_group = group @_size = 0 @_nbexpected = 0 @_nbactual = 0 @lastnb = 0 ! @_time = Time.gm("1980") update_from_db if fetch_from_db end --- 39,51 ---- Db.autotable(Release, 'releases') ! def initialize(groupindex, artindex, fetch_from_db = false ) @files = Array.new ! @_artindex = artindex ! @_groupindex = groupindex @_size = 0 @_nbexpected = 0 @_nbactual = 0 @lastnb = 0 ! @_time = Time.gm('1980') update_from_db if fetch_from_db end *************** *** 54,58 **** def pushart(art, pos) art._rlsnb = pos ! art._release = @_mid @_size += art._size @_nbactual += 1 --- 53,57 ---- def pushart(art, pos) art._rlsnb = pos ! art._rlsartindex = @_artindex @_size += art._size @_nbactual += 1 *************** *** 164,172 **** def Release.list(groupid = '') ! req = 'select articles.subject,articles.group,releases.rlsmap,releases.nbactual,releases.nbexpected from releases,articles where articles.mid = releases.mid' if (groupid != '') ! name = Group.getname(groupid) ! req += " and articles.group = '#{name}'" end --- 163,172 ---- def Release.list(groupid = '') ! req = 'select articles.subject,articles.groupindex,releases.rlsmap,releases.nbactual,releases.nbexpected ! from releases,articles where articles.artindex = releases.artindex and articles.groupindex = releases.groupindex' if (groupid != '') ! groupindex = Group.getindex(groupid) ! req += " and releases.groupindex='#{groupindex}'" end *************** *** 176,197 **** i = 0 ! subj, grp, rlsmap, nbact, nbtot = nil #rls = nil sth.fetch do |row| ! #rls = Release.new(name, row[2].to_s, true) ! #puts "[#{i}] #{rls} (#{row[0]})" ! subj, grp, rlsmap, nbact, nbtot = *row puts "[#{Utils.blue i}] #{Utils.yellow nbact}/#{Utils.yellow nbtot} [#{Utils.green rlsmap}] \"#{subj}\"" i += 1 end sth.finish ! puts "No release found." if i == 0 end def to_s ! "#{Utils.green @_mid}: #{@_nbactual}/#{@_nbexpected} [#{Utils.yellow @_rlsmap}]" end - end - end --- 176,193 ---- i = 0 ! subj, grpidx, rlsmap, nbact, nbtot = nil #rls = nil sth.fetch do |row| ! subj, grpidx, rlsmap, nbact, nbtot = *row puts "[#{Utils.blue i}] #{Utils.yellow nbact}/#{Utils.yellow nbtot} [#{Utils.green rlsmap}] \"#{subj}\"" i += 1 end sth.finish ! puts 'No release found.' if i == 0 end def to_s ! "#{Utils.green @_artindex}: #{@_nbactual}/#{@_nbexpected} [#{Utils.yellow @_rlsmap}]" end end end Index: core.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/core.rb,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** core.rb 9 Feb 2004 21:34:49 -0000 1.33 --- core.rb 20 Feb 2004 16:44:39 -0000 1.34 *************** *** 63,88 **** end ! def search_group(groupid, filter) ! g = Group.getgroup(groupid) ! g.search(filter) end ! def search_releases(groupid, filter) ! g = Group.getgroup(groupid) ! g.search_releases(filter) end def add_group(groupname, shortname = nil, dir = nil, desc = nil) ! g = Group.new(groupname, false, shortname, dir, true, desc) g.insert_to_db ! begin ! Dir.mkdir(g._directory) ! rescue Errno::EEXIST => e ! debug g._directory + ' already exists' ! end end ! def delete_group(groupid) ! Group.delete(groupid) end --- 63,82 ---- end ! def search_group(groupindex, filter) ! Group.getgroup(groupindex).search(filter) end ! def search_releases(groupindex, filter) ! Group.getgroup(groupindex).search_releases(filter) end def add_group(groupname, shortname = nil, dir = nil, desc = nil) ! g = Group.new(nil, false, groupname, shortname, dir, true, desc) g.insert_to_db ! Dir.mkdir(g._directory) unless FileTest.exists? g._directory end ! def delete_group(id) ! Group.delete(Groupe.getindex(id)) end *************** *** 91,102 **** puts "Update all groups" Group.getallactive.each do |group| ! name = group.to_s ! puts "Updating #{name}" ! g = Group.new(name,true) g.update end else ! g = Group.getgroup(groupid) ! g.update end end --- 85,94 ---- puts "Update all groups" Group.getallactive.each do |group| ! g = Group.new(group[0], true) ! puts "Updating #{g._fullname}" g.update end else ! Group.getgroup(groupid).update end end *************** *** 107,112 **** def show_nfo(nb_nfo, groupid = '') ! n = Integer(nb_nfo) ! puts Nfo.get(n, groupid) end --- 99,103 ---- def show_nfo(nb_nfo, groupid = '') ! puts Nfo.get(Integer(nb_nfo), groupid) end *************** *** 115,119 **** end ! def queue_article(groupid, article_id, prio = '5') begin n = Integer(prio) --- 106,110 ---- end ! def queue_article(groupid, articleindex, prio = '5') begin n = Integer(prio) *************** *** 130,137 **** n = 5 end ! ! name = Group.getname(groupid) ! g = Group.new(name) ! g.queue_regexp(regexp, n, period, subpath) end --- 121,125 ---- n = 5 end ! Group.getgroup(groupid).queue_regexp(regexp, n, period, subpath) end *************** *** 145,154 **** def show_status ! m = get_manager ! puts m.status end ! def set_period(queueid, period) ! q = Queue.getqueue(queueid) q._period = period q.sync_to_db --- 133,141 ---- def show_status ! puts get_manager.status end ! def set_period(queueindex, newperiod) ! q = Queue.getqueue(queueindex) q._period = period q.sync_to_db *************** *** 197,201 **** $config['debug']=true when 'no-debug' ! $config['no-debug']=false when 'write-config' $config.save(arg) --- 184,188 ---- $config['debug']=true when 'no-debug' ! $config['debug']=false when 'write-config' $config.save(arg) Index: db.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/db.rb,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** db.rb 6 Feb 2004 23:46:59 -0000 1.23 --- db.rb 20 Feb 2004 16:44:39 -0000 1.24 *************** *** 98,101 **** --- 98,102 ---- end + # The class having a list must have a constructor whose required arguments are the PRImary keys *in the same order* class DbList include Db *************** *** 138,141 **** --- 139,147 ---- return @@db_handler end + + def Db.now + #Db.dbh.select_one('select NOW()')[0] + return Time.now + end ## Database registry Index: downloader.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/downloader.rb,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** downloader.rb 6 Feb 2004 23:46:59 -0000 1.22 --- downloader.rb 20 Feb 2004 16:44:39 -0000 1.23 *************** *** 9,17 **** include Utils ! # the id as defined in the database ! attr_reader :id attr_reader :start_time # the status attr_reader :status # single or regexp attr_reader :type --- 9,18 ---- include Utils ! # the queueindex as defined in the database ! attr_reader :queueindex attr_reader :start_time # the status attr_reader :status + attr_accessor :finish_status # single or regexp attr_reader :type *************** *** 29,34 **** attr_reader :nbfiles ! def initialize(id, type, value, group, dest, prio) ! @id = id @type = type @value = value --- 30,35 ---- attr_reader :nbfiles ! def initialize(queueindex, type, value, group, dest, prio) ! @queueindex = queueindex @type = type @value = value *************** *** 42,46 **** def ldebug(str) ! debug "(#{white @id})" + str end --- 43,47 ---- def ldebug(str) ! debug "(#{white @queueindex})" + str end *************** *** 53,79 **** when /^Retrieving: (\d+).*\t(\d+)l.*(<.*>)$/ parts, nblines, mid = $1, $2, $3 @nbfiles += 1 ! Db.dbh.do "update queue set `nbfiles`='#{@nbfiles}' where `id`='#{@id}'" ! @curfile = QueueFile.new(@id, mid, false, parts, nblines, @nbfiles) ! if not QueueFile.already_in_db(@id, $3) @curfile.insert_to_db else @curfile.update_from_db ! ldebug (Utils.red "already in database") end when /^(\d+) \((\d+)\/(\d+)\): (\d+)\/(\d+)L (\d+)\/(\d+)B (\d+)% (\d+)B\/s (\w+) (\d+)\/(\d+) (\w+)$/ ! part = $2 ! size = $7 ! speed = $9 ! filenb = $12 ldebug "#{yellow $5+'L'}(#{yellow $7+'B'}) at #{red $9+'B/s'} [#{blue $2}/#{blue $3}] [#{green $11}/#{green $12}]" @curfile.update(part, speed, filenb, size) when /\d+ \((\d+)\/\d+\).*\d+\/(\d+)B.* (\d+)B\/s \w+ (\d+)\/(\d+) \w+$/ ! ldebug (Utils.red "the previous regexp should have been matched instead of this one") ! part = $1 ! size = $2 ! speed = $3 ! filenb = $4 @curfile.update(part, speed, filenb, size) when /^autopar.*seems like a (par2?) \((.*)\)/ --- 54,81 ---- when /^Retrieving: (\d+).*\t(\d+)l.*(<.*>)$/ parts, nblines, mid = $1, $2, $3 + artindex = Db.dbh.select_one("select `artindex` from `articles` where `mid`='#{mid}'") + unless artindex + puts "No such article: #{mid}" + artindex = [nil] + end + artindex = artindex[0] + @nbfiles += 1 ! Db.dbh.do "update `queue` set `nbfiles`='#{@nbfiles}' where `queueindex`='#{@queueindex}'" ! @curfile = QueueFile.new(@queueindex, artindex, false, parts, nblines, @nbfiles) ! if not QueueFile.already_in_db(@queueindex, artindex) @curfile.insert_to_db else @curfile.update_from_db ! ldebug (red "Article already in database") end when /^(\d+) \((\d+)\/(\d+)\): (\d+)\/(\d+)L (\d+)\/(\d+)B (\d+)% (\d+)B\/s (\w+) (\d+)\/(\d+) (\w+)$/ ! part, size, speed, filenb = $2, $7, $9, $12 ldebug "#{yellow $5+'L'}(#{yellow $7+'B'}) at #{red $9+'B/s'} [#{blue $2}/#{blue $3}] [#{green $11}/#{green $12}]" @curfile.update(part, speed, filenb, size) when /\d+ \((\d+)\/\d+\).*\d+\/(\d+)B.* (\d+)B\/s \w+ (\d+)\/(\d+) \w+$/ ! ldebug (red "ERR the previous regexp should have been matched instead of this one") ! part, size, speed, filenb = $1, $2, $3, $4 @curfile.update(part, speed, filenb, size) when /^autopar.*seems like a (par2?) \((.*)\)/ *************** *** 93,97 **** ldebug 'file decoded' @curfile.finish(true) ! @finish_status = 'FINISHED' log "Download finished for file #{@curfile._filename}, queue #{@value}" when /^Connecting to (.*)$/ --- 95,99 ---- ldebug 'file decoded' @curfile.finish(true) ! @finish_status = 'FINISHED' log "Download finished for file #{@curfile._filename}, queue #{@value}" when /^Connecting to (.*)$/ *************** *** 103,106 **** --- 105,111 ---- when /<< QUIT/ ldebug 'Quitted' + when /^doarticle \d+: \d+!=\d+ \|\| \d+!=\d+$/ + when /^unequal line count \d+ should equal \d+$/ + ldebug 'unequal line count' when />> \d\d\d/, /<< (GROUP|AUTHINFO)/ # nothing *************** *** 109,120 **** when /^couldn't get (<.*>) from anywhere$/ ldebug red("Couldn't download mid ") + green($1) ! when /^ERRORS: (.*)$/ ! ldebug red("Finished, got errors (#{$1})") ! @finish_status = 'FAILED' else ! #TODO : handle decoding failures (=> @curfile.finish(false)) ! ldebug "unhandled msg : #{blue line}" end - #debug (Utils.red "end update_status") end --- 114,125 ---- when /^couldn't get (<.*>) from anywhere$/ ldebug red("Couldn't download mid ") + green($1) ! when /^(?:OK:(.*))?(?:WARNINGS:(.*))?(?:ERRORS:(.*))?$/ ! return unless $1 or $2 or $3 ! ok,warn,errs = $1, $2, $3 ! @finish_status = (errs ? 'FAILED' : 'FINISHED') ! ldebug "Finished: ok#{green ok} warnings#{blue warn} errors#{red errs}" else ! ldebug blue('unhandled msg: ') + line end end *************** *** 122,132 **** File.makedirs(@dest) Dir.chdir(@dest) @start_time = Time.new @status = 'PROCESSING' Db.dbh.do 'lock tables queue write' ! Db.dbh.do "update queue set `status` = 'PROCESSING', `date_started`= NOW() where `id` = '#{@id}'" Db.dbh.do 'unlock tables' ! @io = IO.popen("#{$nget} -q -G #{@group} -r '#{@value}'") ! @t = Thread.new(@io) { |io| begin io.each { |line| --- 127,138 ---- File.makedirs(@dest) Dir.chdir(@dest) + # unused @start_time = Time.new @status = 'PROCESSING' Db.dbh.do 'lock tables queue write' ! Db.dbh.do "update queue set `status`='PROCESSING', `date_started`=NOW() where `queueindex`='#{@queueindex}'" Db.dbh.do 'unlock tables' ! @io = IO.popen("#{$config['nget']} -q -I -G #{@group} -r '#{@value}' 2>&1") ! @t = Thread.new(@io, self){ |io, parent| begin io.each { |line| *************** *** 135,149 **** rescue IOError puts 'nget got killed!' ! ! rescue Exception => e ! puts "Exception : #{e.class} => " + e.message ! print e.backtrace.join("\n") ! rescue Error => e ! puts 'Error : ' + e ! print e.backtrace.join("\n") rescue DBI::DatabaseError => e ! puts 'An error occurred' puts 'Error code: ' + e.err puts 'Error message: ' + e.errstr end } --- 141,152 ---- rescue IOError puts 'nget got killed!' ! parent.stop rescue DBI::DatabaseError => e ! puts 'A DB error occurred' puts 'Error code: ' + e.err puts 'Error message: ' + e.errstr + parent.stop + rescue Object + parent.stop end } *************** *** 156,164 **** end ! def stop # oh no they killed kenny ! ldebug red('dlder.stop') Db.dbh.do 'lock tables queue write' ! Db.dbh.do "update `queue` set `status` = 'STOPPED', `date_finished`=NOW() where `id` = '#{@id}'" Db.dbh.do 'unlock tables' --- 159,170 ---- end ! def stop(command=false) # oh no they killed kenny ! ldebug red('dlder.stop') + @finish_status = command ? 'STOPPED' : 'FAILED' + newstat = "`status`='#{finish_status}',`date_finished`=NOW()" + newstat += ",`period`='0'" if command Db.dbh.do 'lock tables queue write' ! Db.dbh.do "update `queue` set #{newstat} where `queueindex`='#{@queueindex}'" Db.dbh.do 'unlock tables' *************** *** 181,185 **** # newstatus = success ? 'FINISHED' : 'FAILED' newstatus = @finish_status ! Db.dbh.do "update queue set `status` = '#{newstatus}', `date_finished`=NOW() where `id` = '#{@id}'" Db.dbh.do 'unlock tables' ldebug "Download #{newstatus.downcase} for #{green @value}" --- 187,191 ---- # newstatus = success ? 'FINISHED' : 'FAILED' newstatus = @finish_status ! Db.dbh.do "update queue set `status`='#{newstatus}', `date_finished`=NOW() where `queueindex`='#{@queueindex}'" Db.dbh.do 'unlock tables' ldebug "Download #{newstatus.downcase} for #{green @value}" *************** *** 188,192 **** def status ! "[#{@id}] -- #{@value} (#{@status})" end end --- 194,198 ---- def status ! "[#{@queueindex}] -- #{@value} (#{@status})" end end Index: downloadmanager.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/downloadmanager.rb,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** downloadmanager.rb 9 Feb 2004 21:34:49 -0000 1.22 --- downloadmanager.rb 20 Feb 2004 16:44:39 -0000 1.23 *************** *** 1,4 **** --- 1,5 ---- require 'ngetsuite/db' require 'ngetsuite/downloader' + require 'ngetsuite/group' require 'ngetsuite/utils' *************** *** 59,73 **** def start_new_downloader ! row = Db.dbh.select_one("select * from queue where `status`='PENDING' order by `priority` desc limit 1") ! row = Db.dbh.select_one("select * from queue where (`status`='STOPPED' and (`period` != 0) and ((NOW()-`date_finished`) > `period`)) order by `priority` desc limit 1") if not row and $config['resume_downloads'] ! row = Db.dbh.select_one("select * from queue where (`status`='FAILED' and (`period` != 0) and ((NOW()-`date_finished`) > `period`)) order by `priority` desc limit 1") if not row and $config['resume_downloads'] return false if row == nil @current_dlers += 1 ! id, group, type, value, subdir, prio = row.values_at(0, 1, 2, 3, 4, 5) log "found /#{value}/ for group #{group}\n" ! dler = Downloader.new(id, type, value, group, @basedir + File::Separator + subdir, prio) ! @dlers[id] = dler dler.start --- 60,76 ---- def start_new_downloader ! row = Db.dbh.select_one("select * from `queue` where `status`='PENDING' order by `priority` desc limit 1") ! row = Db.dbh.select_one("select * from `queue` where (`status`='FINISHED' and (`period` != 0) and ((NOW()-`date_finished`) > `period`)) order by `priority` desc limit 1") if not row and $config['resume_downloads'] ! row = Db.dbh.select_one("select * from `queue` where (`status`='STOPPED' and (`period` != 0) and ((NOW()-`date_finished`) > `period`)) order by `priority` desc limit 1") if not row and $config['resume_downloads'] ! row = Db.dbh.select_one("select * from `queue` where (`status`='FAILED' and ((NOW()-`date_finished`) > '7200')) order by `priority` desc limit 1") if not row and $config['resume_downloads'] return false if row == nil @current_dlers += 1 ! queueindex, groupindex, type, value, subdir, prio = row.values_at(0, 1, 2, 3, 4, 5) ! group = Group.getname(groupindex) log "found /#{value}/ for group #{group}\n" ! dler = Downloader.new(queueindex, type, value, group, @basedir + File::Separator + subdir, prio) ! @dlers[queueindex] = dler dler.start *************** *** 79,83 **** if @dlers.has_key? id dler = @dlers.delete(id) ! dler.stop @current_dlers -= 1 else --- 82,86 ---- if @dlers.has_key? id dler = @dlers.delete(id) ! dler.stop(true) @current_dlers -= 1 else *************** *** 121,125 **** "Maximum of parallel downloads is #{@max_dlers}\n" + "There are currently #{@current_dlers} downloads running\n" ! @dlers.each {|id, dler| res += dler.status + '\n'} else res = 'Stopped' --- 124,128 ---- "Maximum of parallel downloads is #{@max_dlers}\n" + "There are currently #{@current_dlers} downloads running\n" ! @dlers.each {|id, dler| res += dler.status + "\n"} else res = 'Stopped' Index: group.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/group.rb,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** group.rb 9 Feb 2004 21:34:49 -0000 1.36 --- group.rb 20 Feb 2004 16:44:39 -0000 1.37 *************** *** 7,18 **** class NoSuchGroupException < Exception ! attr_reader :groupid ! def initialize(groupid) ! @groupid = groupid end def message ! "No such group : #{groupid}" end end --- 7,18 ---- class NoSuchGroupException < Exception ! attr_reader :groupindex ! def initialize(groupindex) ! @groupindex = groupindex end def message ! "No such group : #{groupindex}" end end *************** *** 30,74 **** Db.autotable(Group, 'groups') ! def Group.delete(id) ! Db.dbh.do "delete from `groups` where `fullname` = '#{Group.getname(id)}'" end ! def Group.getname(id) begin ! n = Integer(id) ! groups = Db.dbh.select_all 'select fullname from `groups` order by date_added' ! if ((n < groups.size) && (n>=0)) ! return groups[n].to_s ! else ! raise NoSuchGroupException.new(id) ! end rescue ArgumentError - # id is not an integer, it must be the abbreviated name or the full - # name - groups = Db.dbh.select_all "select fullname from `groups` where `shortname` = '#{id}'" - case groups.size - when 0 - # id is not a shortname, maybe it is a fullname - fullnames = Db.dbh.select_all "select fullname from `groups` where `fullname` = '#{id}'" - if (fullnames.size == 1) - # Got it - return id - else - raise NoSuchGroupException.new(id) - end - when 1 - return groups.to_s - else - raise NoSuchGroupException.new(id) - end end end def Group.getallactive ! Db.dbh.select_all "select `fullname` from `groups` where active='yes'" end def Group.getgroup(id) ! Group.new(Group.getname(id), true) end --- 30,68 ---- Db.autotable(Group, 'groups') ! def Group.delete(index) ! Db.dbh.do "delete from `groups` where `groupindex`='#{index}'" end ! def Group.getindex(id) ! id = id.to_s begin ! index = Integer(id) ! groups = Db.dbh.select_one("select `groupindex` from `groups` where `groupindex`='#{index}'") ! return groups[0] if groups and groups.length == 1 rescue ArgumentError end + + # id is not an integer, it must be a shortname + groups = Db.dbh.select_all("select `groupindex` from `groups` where `shortname`='#{id}'") + return groups[0] if groups and groups.length == 1 + + # or a fullname + groups = Db.dbh.select_all("select `groupindex` from `groups` where `fullname`='#{id}'") + return groups[0] if groups and groups.length == 1 + + # none of these => error + raise NoSuchGroupException.new(id) + end + + def Group.getname(id) + Db.dbh.select_one("select `fullname` from `groups` where `groupindex`='#{Group.getindex(id)}'")[0] end def Group.getallactive ! Db.dbh.select_all "select `groupindex` from `groups` where `active`='yes'" end def Group.getgroup(id) ! Group.new(Group.getindex(id), true) end *************** *** 78,88 **** req = '' ! req = " where `active` = 'yes' " if onlyactive req += 'order by `date_added`' GroupList.new(req).each { |group| name = Utils.red group._fullname sname = Utils.blue group._shortname ! puts "[#{name}] (#{sname})" labels.each_index { |i| label, value = Utils.green(labels[i]), --- 72,83 ---- req = '' ! req = " where `active`='yes' " if onlyactive req += 'order by `date_added`' GroupList.new(req).each { |group| + idx = Utils.green group._groupindex name = Utils.red group._fullname sname = Utils.blue group._shortname ! puts "<#{idx}> [#{name}] (#{sname})" labels.each_index { |i| label, value = Utils.green(labels[i]), *************** *** 94,98 **** end ! def initialize(fullname, fetch_from_db = false, shortname = nil, directory = nil, active = true, description = nil) @_fullname = fullname @_shortname = shortname --- 89,94 ---- end ! def initialize(index=nil, fetch_from_db=false, fullname=nil, shortname=nil, directory=nil, active=true, description=nil) ! @_groupindex = index @_fullname = fullname @_shortname = shortname *************** *** 101,107 **** @_description = description @_date_added = Time.now - @nget = $config['nget'] - @yydecode = $config['yydecode'] - @cachedir = $config['cachedir'] update_from_db if fetch_from_db end --- 97,100 ---- *************** *** 112,120 **** def _shortname ! if (@_shortname == nil) ! @_shortname = @_fullname.to_s.split('.').map {|item| item[0].chr }.join('') ! end ! ! return @_shortname end --- 105,110 ---- def _shortname ! return @_shortname if @_shortname ! @_shortname = @_fullname.to_s.split('.').map {|item| item[0].chr }.join('') end *************** *** 128,132 **** def search_releases(filter) ! sth = Db.dbh.execute('select articles.subject,releases.rlsmap,releases.nbactual,releases.nbexpected from releases,articles where articles.mid = releases.mid and articles.group = ? and articles.subject RLIKE ? order by articles.time desc', @_fullname, filter) i = 0 subj, rlsmap, nbact, nbtot = nil --- 118,122 ---- def search_releases(filter) ! sth = Db.dbh.execute('select articles.subject,releases.rlsmap,releases.nbactual,releases.nbexpected from releases,articles where articles.artindex = releases.artindex and articles.groupindex = ? and articles.subject RLIKE ? order by articles.time desc', @_groupindex, filter) i = 0 subj, rlsmap, nbact, nbtot = nil *************** *** 141,147 **** def search(filter) ! sth = Db.dbh.execute('select * from `articles` where `group` = ? and `subject` RLIKE ? order by `time` desc', @_fullname, filter) ! sth.fetch_hash do |row| ! puts row['subject'] end sth.finish --- 131,137 ---- def search(filter) ! sth = Db.dbh.execute("select `subject` from `articles` where `groupindex`='#{@_groupindex}' and `subject` RLIKE ? order by `time` desc", filter) ! sth.fetch do |row| ! puts row[0] end sth.finish *************** *** 150,185 **** def update updatengetcache unless $config['extern_headers_update'].split(',').include?(@_shortname) - clear_articles parsengetcache - - clear_releases recognizereleases - - clear_nfos fetchnfos unless $config['extern_nfos_fetch'].split(',').include?(@_shortname) - @_date_updated = Time.now sync_to_db end ! def clear_articles ! nb_rows = Db.dbh.do "delete from `articles` where `group` = '#{@_fullname}'" ! debug "#{nb_rows} articles deleted" ! end ! ! def clear_nfos ! nb_rows = Db.dbh.do "delete from `nfos` where `group` = '#{@_fullname}'" ! debug "#{nb_rows} nfos deleted" ! end ! ! def clear_releases ! nb_rows = Db.dbh.do "delete from `releases` where `group` = '#{@_fullname}'" ! debug "#{nb_rows} releases deleted" ! ! end ! ! def queue_regexp(regexp, prio, period=0, subpath='') ! q = RegexpQueue.new(nil, false, @_fullname, regexp, prio, period, subpath) ! q._date_added = Time.now q._status = NgetSuite::PENDING q.insert_to_db --- 140,153 ---- def update updatengetcache unless $config['extern_headers_update'].split(',').include?(@_shortname) parsengetcache recognizereleases fetchnfos unless $config['extern_nfos_fetch'].split(',').include?(@_shortname) @_date_updated = Time.now sync_to_db end ! def queue_regexp(regexp, prio=nil, period=nil, subpath=nil) ! q = RegexpQueue.new(nil, false, @_groupindex, regexp, prio, period, subpath) ! q._date_added = Db.now q._status = NgetSuite::PENDING q.insert_to_db *************** *** 189,203 **** t = Time.now debug "Beginning updatengetcache at #{t.strftime('%H:%M:%S')}" n = rand(900000)+100000 $stdout.sync = true if $stdout.isatty begin ! IO.popen("nice -n19 #{@nget} -g #{@_fullname} -cr '^#{n}Dummy'").each("\r") { |line| print "progress#{red $1} speed#{blue $2} ETA#{green $3} \r" if line =~ /Retrieving headers \d+-\d+ : \d+\/\d+\/\d+(\s+\d+%)(\s+\d+B\/s)(.*s)/ and $stdout.isatty ! } rescue ! puts "\nInterrupted" end print "\n" if $stdout.isatty $stdout.sync = false if $stdout.isatty debug "Updatengetcache finished in #{Time.now-t}s" end --- 157,175 ---- t = Time.now debug "Beginning updatengetcache at #{t.strftime('%H:%M:%S')}" + n = rand(900000)+100000 $stdout.sync = true if $stdout.isatty + begin ! IO.popen("nice -n19 #{$config['nget']} -g #{@_fullname} -cr '^#{n}Dummy' 2>&1").each("\r") do |line| print "progress#{red $1} speed#{blue $2} ETA#{green $3} \r" if line =~ /Retrieving headers \d+-\d+ : \d+\/\d+\/\d+(\s+\d+%)(\s+\d+B\/s)(.*s)/ and $stdout.isatty ! end rescue ! print "\nInterrupted" end + print "\n" if $stdout.isatty $stdout.sync = false if $stdout.isatty + debug "Updatengetcache finished in #{Time.now-t}s" end *************** *** 206,223 **** t = Time.now debug "Beginning parsengetcache at #{t.strftime('%H:%M:%S')}" ! sth = Db.dbh.prepare 'insert into articles (`group`, `mid`, `nbparts`, `size`, `subject`, `from`, `time`) values (?, ?, ?, ?, ?, ?, FROM_UNIXTIME(?))' filecallback = Proc.new { |f| if f.req >= 1 partcnt = 0 size = 0 a = nil f.parts.each { |p| ! unless p.articles.empty? a = p.articles[0] ! size += a.bytes / ( a.bytes < 100*a.lines ? 1.39 : 1.0334 ) partcnt += 1 if partcnt >= f.req ! sth.execute(@_fullname, p.mid, f.req, size, f.subject, f.author, p.date) ! end end # free mem --- 178,203 ---- t = Time.now debug "Beginning parsengetcache at #{t.strftime('%H:%M:%S')}" ! ! nb_rows = Db.dbh.do "delete from `articles` where `groupindex`='#{@_groupindex}'" ! # and `artindex` < '#{@_cache_low}' ! debug "#{nb_rows} articles deleted" ! ! cache = NgetCache.new(@_fullname, $config['cachedir']) ! ! sth = Db.dbh.prepare "insert into articles (`groupindex`, `artindex`, `mid`, `nbparts`, `size`, `subject`, `from`, `time`) values ('#{@_groupindex}', ?, ?, ?, ?, ?, ?, FROM_UNIXTIME(?))" ! lasthigh = @_cache_high filecallback = Proc.new { |f| if f.req >= 1 + # and f.parts.articles.artnum.each > lasthigh partcnt = 0 size = 0 a = nil f.parts.each { |p| ! next if p.articles.empty? a = p.articles[0] ! size += a.bytes.to_i partcnt += 1 if partcnt >= f.req ! sth.execute(a.articlenum, p.mid, f.req, size, f.subject, f.author, p.date) end # free mem *************** *** 227,232 **** end } ! ! NgetCache.new(@_fullname, @cachedir, nil, filecallback) debug "Parsengetcache done in #{Time.now-t}s" end --- 207,212 ---- end } ! cache.parse(filecallback) ! @_cache_low,@_cache_high = cache.servers[0].low, cache.servers[0].high debug "Parsengetcache done in #{Time.now-t}s" end *************** *** 235,238 **** --- 215,222 ---- t = Time.now debug "Beginning fetchnfos at #{t.strftime('%H:%M:%S')}" + + nb_rows = Db.dbh.do "delete from `nfos` where `groupindex`='#{@_groupindex}'" + debug "#{nb_rows} nfos deleted" + tempdir = $config['tempdir'] + File::Separator + "ngetupdate.#{@_shortname}.#{Process.pid}" if FileTest.exists? tempdir *************** *** 243,255 **** pwd = Dir.pwd Dir.chdir(tempdir) begin ! # fetches the nfos ! `nice -n19 #{@nget} --path #{tempdir} -G #{@_fullname} -K -L 150 -r '\\.nfo|\\.txt'` # but mark them for nget as if we didn't download them ! `#{@nget} --path #{tempdir} -qq -G #{@_fullname} -U -r '\\.nfo|\\.txt'` debug "Fetchnfos: #{Dir['ngettemp-*'].length} files downloaded in #{Time.now-t}s" nb_nfos = 0 ! sth = Db.dbh.prepare 'insert ignore into nfos (`group`, `mid`, `text`) values (?, ?, ?)' Dir['ngettemp-*'].each { |file| File.open(file).each { |line| --- 227,240 ---- pwd = Dir.pwd Dir.chdir(tempdir) + begin ! # fetches the nfos, w/o decoding ! `nice -n19 #{$config['nget']} --path #{tempdir} -G #{@_fullname} -K -L 150 -r '\\.nfo|\\.txt' 2>&1` # but mark them for nget as if we didn't download them ! `#{$config['nget']} --path #{tempdir} -qq -G #{@_fullname} -U -r '\\.nfo|\\.txt' 2>&1` debug "Fetchnfos: #{Dir['ngettemp-*'].length} files downloaded in #{Time.now-t}s" nb_nfos = 0 ! sth = Db.dbh.prepare "insert ignore into nfos (`groupindex`, `artindex`, `text`) values (#{@_groupindex}, ?, ?)" Dir['ngettemp-*'].each { |file| File.open(file).each { |line| *************** *** 257,270 **** if $1 != nil mid = $1 ! text = `#{@yydecode} #{file} -o -`.chomp ! if text and text.length < 15000 ! sth.execute(@_fullname, mid, text) nb_nfos += 1 end - # Does not fucking work - #if text and (text.length < 15000) - # n = Nfo.new(mid, false, @_fullname, text) - # n.insert_to_db - #end break end --- 242,251 ---- if $1 != nil mid = $1 ! text = `#{$config['yydecode']} #{file} -o - 2>/dev/null `.chomp ! artindex = Db.dbh.select_one("select `artindex` from `articles` where `mid`='#{mid}'") ! if text and text.length < 15000 and text.length > 800 and artindex ! sth.execute(artindex[0], text) nb_nfos += 1 end break end *************** *** 276,279 **** --- 257,261 ---- `rm -rf #{tempdir}` end + debug "Indexed #{nb_nfos} nfos in #{Time.now-t}s" end *************** *** 282,290 **** t = Time.now debug "Recognizing releases at #{t.strftime('%H:%M:%S')}" ! articles = NgetSuite::ArticleList.new("where `group`='#{@_fullname}' order by `subject`") rls = nil nb_releases = 0 articles.each { |art| ! rls = NgetSuite::Release.new(art._group, art._mid) if !rls if rls.add?(art) == false then # New release! Commit the current one to the db --- 264,276 ---- t = Time.now debug "Recognizing releases at #{t.strftime('%H:%M:%S')}" ! ! nb_rows = Db.dbh.do "delete from `releases` where `groupindex`='#{@_groupindex}'" ! debug "#{nb_rows} releases deleted" ! ! articles = ArticleList.new("where `groupindex`='#{@_groupindex}' order by `subject`") rls = nil nb_releases = 0 articles.each { |art| ! rls = Release.new(art._groupindex, art._artindex) if !rls if rls.add?(art) == false then # New release! Commit the current one to the db *************** *** 293,302 **** # And make another ! rls = NgetSuite::Release.new(art._group, art._mid) rls.add? art end } - rls.insert_to_db debug "Inserted #{nb_releases} releases in #{Time.now-t}s" end --- 279,288 ---- # And make another ! rls = NgetSuite::Release.new(art._groupindex, art._artindex) rls.add? art end } rls.insert_to_db + debug "Inserted #{nb_releases} releases in #{Time.now-t}s" end Index: nfo.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/nfo.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nfo.rb 2 Feb 2004 02:41:57 -0000 1.4 --- nfo.rb 20 Feb 2004 16:44:39 -0000 1.5 *************** *** 11,19 **** def Nfo.get(n, groupid = '') ! req = 'select articles.mid from nfos,articles where articles.mid = nfos.mid' if (groupid != '') ! name = Group.getname(groupid) ! req += " and nfos.group = '#{name}'" end --- 11,19 ---- def Nfo.get(n, groupid = '') ! req = 'select nfos.artindex,nfos.groupindex from nfos,articles where nfos.artindex=articles.artindex and nfos.groupindex=articles.groupindex' if (groupid != '') ! name = Group.getindex(groupid) ! req += " and nfos.groupindex='#{groupindex}'" end *************** *** 25,38 **** end ! return Nfo.new(row[0], true) end def Nfo.list(groupid = '') ! req = 'select articles.subject,articles.group,articles.mid from ! nfos,articles where articles.mid = nfos.mid' if (groupid != '') ! name = Group.getname(groupid) ! req += " and articles.group = '#{name}'" end --- 25,37 ---- end ! return Nfo.new(row[0], row[1], true) end def Nfo.list(groupid = '') ! req = 'select articles.subject,nfos.groupindex,nfos.artindex from nfos,articles where articles.artindex=nfos.artindex and articles.groupindex=nfos.groupindex' if (groupid != '') ! groupindex = Group.getindex(groupid) ! req += " and nfos.groupindex='#{groupindex}'" end *************** *** 43,51 **** i = 0 sth.fetch do |row| ! puts " mid : #{row[2]}" ! nfo = Nfo.new(row[2].to_s, true) ! #puts "[#{i}] (#{row[1]}) -- #{row[0]}" ! print "[#{i}] " ! puts nfo._group i += 1 end --- 42,46 ---- i = 0 sth.fetch do |row| ! puts "[#{i}] (#{puts Group.getgroup(row[1])._shortname}) #{row[0]}" i += 1 end *************** *** 54,60 **** end ! def initialize(mid, fetch_from_db = false, group = nil, text = 'EMPTY') ! @_mid = mid ! @_group = group @_text = text update_from_db if fetch_from_db --- 49,55 ---- end ! def initialize(artindex, groupindex, fetch_from_db=false, text='EMPTY') ! @_artindex = artindex ! @_groupindex = groupindex @_text = text update_from_db if fetch_from_db Index: ngetcache.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/ngetcache.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ngetcache.rb 6 Feb 2004 23:46:59 -0000 1.7 --- ngetcache.rb 20 Feb 2004 16:44:39 -0000 1.8 *************** *** 12,16 **** attr_reader :servers, :files, :sane, :lineno, :groupname ! attr_accessor :writeoldformat CacheServer = Struct.new('CacheServer', 'serverid', 'high', 'low', 'num') --- 12,16 ---- attr_reader :servers, :files, :sane, :lineno, :groupname ! attr_accessor :writeoldformat, :printadvance CacheServer = Struct.new('CacheServer', 'serverid', 'high', 'low', 'num') *************** *** 19,35 **** CacheArticle = Struct.new('CacheArticle', 'serverid', 'articlenum', 'bytes', 'lines') ! # TODO ajouter une option pour ne parser que les nouveaux articles ? (server.index > lasttime.server.high) ! def initialize(groupname, path='.', limit=nil, filecallback=nil) @servers = Array.new @files = Array.new - @filecallback = filecallback @sane = true @groupname = groupname @path = path ! @fd = Zlib::GzipReader.open(path + File::Separator + groupname + ',cache.gz') @lineno = 0 begin ! read_all(limit) rescue BadNgetCache => e @sane = false --- 19,53 ---- CacheArticle = Struct.new('CacheArticle', 'serverid', 'articlenum', 'bytes', 'lines') ! def initialize(groupname, path='.') @servers = Array.new @files = Array.new @sane = true @groupname = groupname @path = path + @printadvance = $stdout.isatty and false + + # parse the file head + @fd = Zlib::GzipReader.open(@path + File::Separator + @groupname + ',cache.gz') + @lineno = 0 + begin + read_head + rescue BadNgetCache => e + @sane = false + puts "The cache is a invalid file (#{lineno}: #{e.msg})" + ensure + @fd.close + end + end ! def parse(filecallback=nil, limit=nil) ! @limit = limit ! @filecallback = filecallback ! ! @fd = Zlib::GzipReader.open(@path + File::Separator + @groupname + ',cache.gz') @lineno = 0 + read_head + begin ! read_body rescue BadNgetCache => e @sane = false *************** *** 38,57 **** @fd.close end - print "\n" if $stdout.isatty - # cache_check if sanitycheck and @sane end def readline raise BadNgetCache.new('unattended EOF') unless @line = @fd.gets ! @line.chomp! @lineno += 1 ! return true if @line != '.' end ! def read_all(limit) readline ! raise BadNgetCache.new('not a ngetcache file') unless @line =~ /^([^\t]*)\t(\d+) ([^\t]*)$/ ! raise BadNgetCache.new('not a ngetcache file') unless $1 == 'NGET4' and $3 == '1' @partscounttotal = $2.to_i @partscountcurrent = 0 --- 56,73 ---- @fd.close end end def readline raise BadNgetCache.new('unattended EOF') unless @line = @fd.gets ! @line.chop! @lineno += 1 ! return @line != '.' end ! def read_head readline ! raise BadNgetCache.new('invalid file format') unless @line =~ /^([^\t]*)\t(\d+) ([^\t]*)$/ ! raise BadNgetCache.new('invalid file format or version number') unless $1 == 'NGET4' and $3 == '1' @partscounttotal = $2.to_i @partscountcurrent = 0 *************** *** 61,65 **** @servers << server end ! # files list while (file = read_file) --- 77,83 ---- @servers << server end ! end ! ! def read_body # files list while (file = read_file) *************** *** 69,76 **** @files << file end ! if limit ! break if (limit -= 1) < 0 ! end end end --- 87,93 ---- @files << file end ! break if @limit and ((@limit -= 1) < 0) end + print "\rFinished \n" if @printadvance end *************** *** 109,114 **** return unless readline ! raise BadNgetCache.new('invalid part description') unless @line =~ /^(-?\d+)\t(\d+)\t([^\t]*)$/ ! part = CachePart.new($1.to_i, $2.to_i, $3, Array.new) # articles giving this part --- 126,131 ---- return unless readline ! raise BadNgetCache.new('invalid part description') unless (@linesplit = @line.split("\t")).length == 3 ! part = CachePart.new(@linesplit[0], @linesplit[1], @linesplit[2], Array.new) # articles giving this part *************** *** 117,121 **** end @partscountcurrent += 1 ! print "#{@partscountcurrent}/#{@partscounttotal}\r" if $stdout.isatty part end --- 134,138 ---- end @partscountcurrent += 1 ! print "#{@partscountcurrent}/#{@partscounttotal}\r" if @printadvance and @partscountcurrent % 20 == 0 part end *************** *** 123,132 **** def read_article return unless readline ! raise BadNgetCache.new('invalid article description') unless @line =~ /^(\d+)\t(\d+)\t(\d+)\t(\d+)$/ ! CacheArticle.new($1.to_i, $2.to_i, $3.to_i, $4.to_i) end ! def save_tofile(groupname=@groupname, path=@path) ! @fd = Zlib::GzipWriter.open(path + File::Separator + groupname + ',cache.newformat.gz') write_all @fd.close --- 140,149 ---- def read_article return unless readline ! raise BadNgetCache.new('invalid article description') unless (@linesplit = @line.split("\t")).length == 4 ! CacheArticle.new(*@linesplit) end ! def save_tofile(groupname=@groupname, path=@path, extension='cache.newformat.gz') ! @fd = Zlib::GzipWriter.open(path + File::Separator + groupname + extension) write_all @fd.close Index: queue.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/queue.rb,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** queue.rb 8 Feb 2004 12:55:48 -0000 1.23 --- queue.rb 20 Feb 2004 16:44:39 -0000 1.24 *************** *** 50,109 **** Db.autotable(Queue, 'queue') ! def Queue.getqueue(id) ! row = Db.dbh.select_one('select `type` from queue where `id` = ' + id.to_s) ! ! if row == nil ! raise NoSuchQueueException.new(id) ! end ! type = row[0] ! ! if type == SINGLE ! SingleQueue.new(id, true) ! elsif type == REGEXP ! RegexpQueue.new(id, true) else ! raise UnknownQueueTypeException.new(type) end end ! def Queue.nextid ! row = Db.dbh.select_one('select id from queue ! where `status` = \'PENDING\' or ! ((`status` = \'FINISHED\') and (`period` != 0) and ((NOW()-`date_finished`) > `period`)) ! order by `priority` desc limit 1') ! if (row == nil) ! return -1 ! end ! row[0] end def Queue.nextqueue ! id = nextid ! if (id == -1) ! return nil ! end ! getqueue(id) end ! def Queue.delete(queueid, fullclean = false) ! q = Queue.getqueue(queueid) q.delete_from_db ! QueueFile.clean(queueid) if fullclean end def Queue.show(groupid = nil, status = nil) ! filter = "" ! if groupid != nil ! name = Group.getname(groupid) ! filter += " where `group` = '#{name}' " ! end ! if status != nil ! if groupid != nil ! filter += ' and ' ! end ! filter += " `status` = '#{status}'" ! end ! QueueList.new(filter).each { |queue| puts queue --- 50,91 ---- Db.autotable(Queue, 'queue') ! def Queue.getqueue(queueindex) ! return nil if queueindex == -1 ! row = Db.dbh.select_one("select `type` from queue where `queueindex`='#{queueindex}'") ! raise NoSuchQueueException.new(queueindex) unless row ! case row[0] ! when SINGLE ! SingleQueue.new(queueindex, true) ! when REGEXP ! RegexpQueue.new(queueindex, true) else ! raise UnknownQueueTypeException.new(row[0]) end end ! def Queue.nextindex ! row = Db.dbh.select_one("select `queueindex` from `queue` ! where `status`='PENDING' or ! ((`status`='FINISHED') and (`period`!=0) and ((NOW()-`date_finished`)>`period`)) ! order by `priority` desc limit 1") ! return row ? row[0] : -1 end def Queue.nextqueue ! Queue.getqueue Queue.nextindex end ! def Queue.delete(queueindex, fullclean = false) ! q = Queue.getqueue(queueindex) q.delete_from_db ! QueueFile.clean(queueindex) if fullclean end def Queue.show(groupid = nil, status = nil) ! fg= groupid ? "`groupindex`='#{Groupe.getindex(groupid)}'" : nil ! fs= status ? "`status`='#{status}'" : nil ! # DEPLIAGE ! filter = ([fg, fs].compact.join(' and ').map{|f| 'where '+f}[0] or '') QueueList.new(filter).each { |queue| puts queue *************** *** 111,125 **** end ! def initialize(id, fetch_from_db = false, group='', value='', priority=1, period=0, subpath = '') ! @_id = id ! @_group = group @_value = value @_priority = priority @_period = period ! @_subdir = group ! if group != '' ! @_subdir = Group.getgroup(group)._directory.sub(/#{$config['basedir']}(#{File::Separator})*/, '') ! if subpath != '' ! @_subdir += File::Separator + subpath dir = $config['basedir'] + File::Separator + @_subdir if FileTest.exists? dir --- 93,109 ---- end ! def initialize(queueindex=nil, fetch_from_db=false, groupindex=nil, value=nil, priority=nil, period=nil, subdir=nil) ! @_queueindex = queueindex ! @_groupindex = groupindex @_value = value @_priority = priority @_period = period ! ! # fine-tune subdir ! @_subdir = nil ! if groupindex and not fetch_from_db ! @_subdir = Group.getgroup(groupindex)._directory.sub(/#{$config['basedir']}(#{File::Separator})*/, '') ! if subdir ! @_subdir += File::Separator + subdir dir = $config['basedir'] + File::Separator + @_subdir if FileTest.exists? dir *************** *** 134,156 **** def finish ! @status = FINISHED ! ! # TODO : sets @date_finished and use only commit_to_db ! dbh.do('update `queue` set `date_finished` = NOW() where `id` = ' + @id) sync_to_db end def to_s ! s = "#{yellow '<'}#{blue @_id}#{yellow '>'} [#{red _group}] #{yellow _value}, prio : #{_priority}, dest : #{green _subdir}, status : #{_status}" ! case @status when PENDING ! s += ", added : #{_date_added}" when PROCESSING ! s += ", started : #{_date_started}" ! when STOPPED ! s += ", finished : #{_date_finished}" end if @_period != 0 ! s += " (period = #{@_period}s)" end s --- 118,142 ---- def finish ! @_status = FINISHED ! @_date_finished = Db.now sync_to_db end + def group + Group.getname(@_groupindex) + end + def to_s ! s = "#{yellow '<'}#{blue @_queueindex}#{yellow '>'} [#{red group}] #{yellow @_value}, prio : #{@_priority}, dest : #{green @_subdir}, status : #{@_status}" ! case @_status when PENDING ! s += ", added #{@_date_added.strftime('%d/%m %H:%M:%S')}" when PROCESSING ! s += ", started #{@_date_started.strftime('%d/%m %H:%M:%S')}" ! else ! s += ", #{@_status.downcase} since #{@_date_finished.strftime('%d/%m %H:%M:%S')}" end if @_period != 0 ! s += " (period #{cooltime @_period})" end s *************** *** 158,163 **** def to_html ! "<tr class='queue'><td class='id'>#{@id}</td><td class='group'>#{@group}</td> ! <td class='prio'>#{@priority}</td><td class='status'>#{@status}</td></tr>" end end --- 144,148 ---- def to_html ! "<tr class='queue'><td class='id'>#{@_queueindex}</td><td class='group'>#{group}</td><td class='prio'>#{@_priority}</td><td class='status'>#{@_status}</td></tr>" end end *************** *** 188,191 **** end end - end --- 173,175 ---- Index: queue_file.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/queue_file.rb,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** queue_file.rb 7 Feb 2004 16:21:20 -0000 1.15 --- queue_file.rb 20 Feb 2004 16:44:39 -0000 1.16 *************** *** 14,20 **** attr_accessor :encoding ! def QueueFile.already_in_db(queueid, mid) row = Db.dbh.select_one "select * from `queue_files` where ! `queue_id` = '#{queueid}' and `mid` = '#{mid}'" return row != nil end --- 14,21 ---- attr_accessor :encoding ! def QueueFile.already_in_db(queueindex, artindex) ! return nil unless artindex row = Db.dbh.select_one "select * from `queue_files` where ! `queueindex`='#{queueindex}' and `artindex`='#{artindex}'" return row != nil end *************** *** 22,39 **** # Removes the queuefiles associated to queueid from the # database and returns the number of rows deleted ! def QueueFile.clean(queueid) ! rows = Db.dbh.do "delete from `queue_files` where `queue_id` = '#{queueid}'" return rows end ! def initialize(queueid, mid, fetch_from_db = false, parts = 0, nblines = 0, filenumber = 0, size = 0, filename = 'unknown') ! @_queue_id = queueid @dlparts = Integer(parts) @nblines = nblines ! @_mid = mid @_filenumber = filenumber @_size = size @_filename = filename ! @_date_started = Time.now update_from_db if fetch_from_db end --- 23,40 ---- # Removes the queuefiles associated to queueid from the # database and returns the number of rows deleted ! def QueueFile.clean(queueindex) ! rows = Db.dbh.do "delete from `queue_files` where `queueindex`='#{queueindex}'" return rows end ! def initialize(queueindex, artindex, fetch_from_db = false, parts = 0, nblines = 0, filenumber = 0, size = 0, filename = 'unknown') ! @_queueindex = queueindex @dlparts = Integer(parts) @nblines = nblines ! @_artindex = artindex @_filenumber = filenumber @_size = size @_filename = filename ! @_date_started = Db.now update_from_db if fetch_from_db end *************** *** 57,61 **** @_filename = 'not found' if (@_filename == nil) ! @_date_finished = Time.now if res --- 58,62 ---- @_filename = 'not found' if (@_filename == nil) ! @_date_finished = Db.now if res Index: utils.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/utils.rb,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** utils.rb 6 Feb 2004 23:46:59 -0000 1.12 --- utils.rb 20 Feb 2004 16:44:39 -0000 1.13 *************** *** 89,111 **** end ! def Utils.pretty_size(asize) ! if asize != nil ! size = asize.to_i ! if size > 4096 ! ksize = size / 1024 ! if ksize > 4096 ! msize = ksize / 1024 ! "#{msize}mb" ! else ! "#{ksize}kb" ! end ! else ! "#{size}b" ! end ! else ! "-1" ! end end - def pretty_size(asize) Utils.pretty_size(asize) --- 89,113 ---- end ! def Utils.spreadbase(value, base, delimiters) ! return '-1' unless value ! last = delimiters.pop ! arr = delimiters.map { |d| ! v = value % base ! value /= base ! "#{v}#{d}" ! } << "#{value}#{last}" ! return arr.reverse[0..1].join(' ') ! end ! ! def Utils.cooltime(seconds) ! Utils.spreadbase(seconds.to_i, 60, ['s', 'm', 'h']) ! end ! def cooltime(seconds) ! Utils.cooltime(seconds) ! end ! ! def Utils.pretty_size(size) ! Utils.spreadbase(size.to_i, 1024, ['b', 'kb', 'Mb', 'Gb']) end def pretty_size(asize) Utils.pretty_size(asize) Index: web.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/web.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** web.rb 6 Feb 2004 23:46:59 -0000 1.5 --- web.rb 20 Feb 2004 16:44:39 -0000 1.6 *************** *** 7,11 **** class Web include Utils ! attr_reader :group, :rlsmid, :offset, :articles_by_page, :filter, :date def initialize(servlet_request) --- 7,11 ---- class Web include Utils ! attr_reader :group, :rlsartind, :offset, :articles_by_page, :filter, :date def initialize(servlet_request) *************** *** 23,27 **** @filter = @query['filter' ].to_s if @query.has_key? 'filter' @date = @query['date' ].to_s if @query.has_key? 'date' ! @rlsmid = @query['rlsmid' ].to_s if @query.has_key? 'rlsmid' @group = NgetSuite::Group.getgroup(@query['group'].to_s) if @query.has_key? 'group' --- 23,27 ---- @filter = @query['filter' ].to_s if @query.has_key? 'filter' @date = @query['date' ].to_s if @query.has_key? 'date' ! @rlsartind= @query['rlsartind'].to_s if @query.has_key? 'rlsartind' @group = NgetSuite::Group.getgroup(@query['group'].to_s) if @query.has_key? 'group' |
From: <jj...@us...> - 2004-02-20 16:56:06
|
Update of /cvsroot/ngetsuite/ngetsuite/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20763/web Modified Files: articles.rhtml dump.rhtml group.rhtml index.rhtml nfo.rhtml nfoviewer.rhtml queue.rhtml queueview.rhtml release.rhtml test.rhtml webrick.rhtml Log Message: db structure adaptation Index: articles.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/articles.rhtml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** articles.rhtml 6 Feb 2004 23:46:59 -0000 1.6 --- articles.rhtml 20 Feb 2004 16:44:40 -0000 1.7 *************** *** 73,78 **** #end group = cgi.params['group'] ! req = "select `mid`, DATE_FORMAT(`time`, '%e/%c %H:%i'),`subject`, `size`,`from` ! from `articles` where `group` = '#{group}' " if cgi.params.has_key? 'filter' filter = cgi.params['filter'] --- 73,79 ---- #end group = cgi.params['group'] ! groupindex = Db.dbh.select_one("select `groupindex` from 'group' where `fullname`='#{group}'")[0] ! req = "select `artindex`, DATE_FORMAT(`time`, '%e/%c %H:%i'),`subject`, `size`,`from` ! from `articles` where `groupindex` = '#{groupindex}' " if cgi.params.has_key? 'filter' filter = cgi.params['filter'] *************** *** 83,87 **** sth = Db.dbh.execute req sth.fetch do |row| ! puts "<input type='hidden' name='mid' value='#{row[0]}'>" print "<tr class='article'>" print "<td><input type='checkbox' name='selected' value='#{row[0]}'></td>" --- 84,88 ---- sth = Db.dbh.execute req sth.fetch do |row| ! puts "<input type='hidden' name='artindex' value='#{row[0]}'>" print "<tr class='article'>" print "<td><input type='checkbox' name='selected' value='#{row[0]}'></td>" Index: dump.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/dump.rhtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dump.rhtml 4 Feb 2004 03:07:57 -0000 1.3 --- dump.rhtml 20 Feb 2004 16:44:40 -0000 1.4 *************** *** 55,59 **** # Magic function to tell if an article belongs to a release # It adds it and return true if it does, return false if not ! def add?(mid,subject,author) fn = Release.filenb_from_subject(subject) --- 55,59 ---- # Magic function to tell if an article belongs to a release # It adds it and return true if it does, return false if not ! def add?(artindex,subject,author) fn = Release.filenb_from_subject(subject) *************** *** 69,73 **** return false if fn[1] != @nbexpected return false if fn[0] <= @lastnb ! @files.push [mid,subject,fn[0]] return true end --- 69,73 ---- return false if fn[1] != @nbexpected return false if fn[0] <= @lastnb ! @files.push [artindex,subject,fn[0]] return true end *************** *** 79,83 **** @nbexpected = fn[1] if fn[1] > 0 @lastnb = fn[0] if fn[0] > 0 ! @files.push [mid,subject,fn[0]] return true end --- 79,83 ---- @nbexpected = fn[1] if fn[1] > 0 @lastnb = fn[0] if fn[0] > 0 ! @files.push [artindex,subject,fn[0]] return true end *************** *** 96,100 **** @refsubject = compare_subjects(subject.split(' ')) if @refsubject.size > 0 ! @files.push [mid,subject,fn[0]] return true else --- 96,100 ---- @refsubject = compare_subjects(subject.split(' ')) if @refsubject.size > 0 ! @files.push [artindex,subject,fn[0]] return true else *************** *** 107,111 **** if compare_subjects(subject.split(' ')) == @refsubject ! @files.push [mid,subject,fn[0]] return true else --- 107,111 ---- if compare_subjects(subject.split(' ')) == @refsubject ! @files.push [artindex,subject,fn[0]] return true else *************** *** 140,147 **** <% if web.group != nil ! req = "select articles.mid, DATE_FORMAT(`time`, '%e/%c %H:%i'), `subject`, ! `size`,`from`, nfos.mid ! from `articles` LEFT JOIN `nfos` USING (`mid`) ! where articles.group = '#{web.group._fullname}' " if web.filter != nil req += " and LOWER(`subject`) LIKE '%#{web.filter.downcase}%' " --- 140,147 ---- <% if web.group != nil ! req = "select articles.artindex, DATE_FORMAT(`time`, '%e/%c %H:%i'), `subject`, ! `size`,`from`, nfos.artindex ! from `articles` LEFT JOIN `nfos` USING (`artindex`) ! where articles.groupindex = '#{web.group._groupindex}' " if web.filter != nil req += " and LOWER(`subject`) LIKE '%#{web.filter.downcase}%' " *************** *** 167,171 **** end %> ! <b><%= row[1] %></b> <%= (row[5]) ? "<a target=\"_blank\" href=\"nfoviewer.rhtml?mid=#{WEBrick::HTTPUtils.escape(row[0])}\">#{row[2]}</a>" : row[2] %> <br /> <% end --- 167,171 ---- end %> ! <b><%= row[1] %></b> <%= (row[5]) ? "<a target=\"_blank\" href=\"nfoviewer.rhtml?artindex=#{row[0]}\">#{row[2]}</a>" : row[2] %> <br /> <% end Index: group.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/group.rhtml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** group.rhtml 17 Feb 2004 14:56:32 -0000 1.4 --- group.rhtml 20 Feb 2004 16:44:40 -0000 1.5 *************** *** 11,16 **** class GroupDates ! def initialize(group) ! datesq = "select DATE_FORMAT(`time`,'%Y-%m-%d') as isodate, DATE_FORMAT(`time`, '%d/%m') from `articles` where `group`='#{group}' group by isodate order by isodate desc" @sth = NgetSuite::Db.dbh.execute datesq end --- 11,16 ---- class GroupDates ! def initialize(groupindex) ! datesq = "select DATE_FORMAT(`time`,'%Y-%m-%d') as isodate, DATE_FORMAT(`time`, '%d/%m') from `articles` where `groupindex`='#{groupindex}' group by isodate order by isodate desc" @sth = NgetSuite::Db.dbh.execute datesq end *************** *** 25,38 **** class Releases ! def initialize(group,date) rlsq = "select r.*,a.`subject` " ! # rlsq += "(select `subject` from `articles` a where r.mid=a.mid) " ! rlsq += "from `releases` r left join `articles` a on r.mid=a.mid " ! rlsq += "where r.`group`='#{group}' " if date != "any" rlsq += "and DATE_FORMAT(r.`time`, '%Y-%m-%d')='#{date}' " end rlsq += "order by `completeness` desc, `nbactual` desc, r.`time` desc" ! puts rlsq @sth = NgetSuite::Db.dbh.execute rlsq end --- 25,37 ---- class Releases ! def initialize(groupindex,date) rlsq = "select r.*,a.`subject` " ! rlsq += "from `releases` r left join `articles` a on r.artindex=a.artindex " ! rlsq += "where r.`groupindex`='#{groupindex}' " if date != "any" rlsq += "and DATE_FORMAT(r.`time`, '%Y-%m-%d')='#{date}' " end rlsq += "order by `completeness` desc, `nbactual` desc, r.`time` desc" ! #puts rlsq @sth = NgetSuite::Db.dbh.execute rlsq end *************** *** 77,81 **** <body> ! <% dates = GroupDates.new(web.group._fullname) dates.each { |iso,display| %> --- 76,80 ---- <body> ! <% dates = GroupDates.new(web.group._groupindex) dates.each { |iso,display| %> *************** *** 86,90 **** <div class="group"><%= web.date_str %></div> ! <% releases = Releases.new(web.group._fullname, web.date) %> <table class='articles'> --- 85,89 ---- <div class="group"><%= web.date_str %></div> ! <% releases = Releases.new(web.group._groupindex, web.date) %> <table class='articles'> *************** *** 97,101 **** <td><i><%= NgetSuite::Utils.pretty_date(rls["time"]).split(" ")[1] %></i><br> <b><%= NgetSuite::Utils.pretty_size(rls["size"]) %><b></td> ! <td><a class="rlslink" target="right" href="release.rhtml?group=<%= web.group._fullname %>&rlsmid=<%= WEBrick::HTTPUtils.escape(rls["mid"]) %>"><%= rls["subject"] %></a><br> <%= rls["graphmap"] %> </tr> --- 96,100 ---- <td><i><%= NgetSuite::Utils.pretty_date(rls["time"]).split(" ")[1] %></i><br> <b><%= NgetSuite::Utils.pretty_size(rls["size"]) %><b></td> ! <td><a class="rlslink" target="right" href="release.rhtml?group=<%= web.group._fullname %>&rlsartind=<%= rls["artindex"].to_s %>"><%= rls["subject"] %></a><br> <%= rls["graphmap"] %> </tr> *************** *** 111,118 **** orphanq = "select count(*), sum(`size`) from `articles` " ! orphanq += "where `group`='#{web.group._fullname}' and `release`='' " orphanq += "and DATE_FORMAT(`time`, '%Y-%m-%d')='#{web.date}' " if web.date != "any" ! orphanq += "group by `release`" @orphsth = NgetSuite::Db.dbh.execute orphanq --- 110,117 ---- orphanq = "select count(*), sum(`size`) from `articles` " ! orphanq += "where `groupindex`='#{web.group._groupindex}' and `rlsartindex` is NULL " orphanq += "and DATE_FORMAT(`time`, '%Y-%m-%d')='#{web.date}' " if web.date != "any" ! orphanq += "group by `rlsartindex`" @orphsth = NgetSuite::Db.dbh.execute orphanq *************** *** 124,128 **** } %> ! <a target="right" href="release.rhtml?mid=&group=<%= web.group._fullname %>&date=<%= web.date %>"><%= orphans %></a> </td> </tr> --- 123,127 ---- } %> ! <a target="right" href="release.rhtml?group=<%= web.group._fullname %>&date=<%= web.date %>"><%= orphans %></a> </td> </tr> Index: index.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/index.rhtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** index.rhtml 9 Nov 2003 01:25:33 -0000 1.3 --- index.rhtml 20 Feb 2004 16:44:40 -0000 1.4 *************** *** 38,40 **** </noframes> </html> - <% NgetSuite::Db.dbh.disconnect %> --- 38,39 ---- Index: nfo.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/nfo.rhtml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** nfo.rhtml 9 Nov 2003 01:25:33 -0000 1.1 --- nfo.rhtml 20 Feb 2004 16:44:40 -0000 1.2 *************** *** 7,11 **** nfo = nil ! nfo = NgetSuite::Nfo.new(query['mid'].to_s, true) if query.has_key? 'mid' %> <?xml version="1.0" encoding="ISO-8859-1"?> --- 7,11 ---- nfo = nil ! nfo = NgetSuite::Nfo.new(query['artindex'].to_s, query['groupindex'].to_s, true) if query.has_key? 'artindex' %> <?xml version="1.0" encoding="ISO-8859-1"?> Index: nfoviewer.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/nfoviewer.rhtml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** nfoviewer.rhtml 6 Nov 2003 16:02:18 -0000 1.1 --- nfoviewer.rhtml 20 Feb 2004 16:44:40 -0000 1.2 *************** *** 7,11 **** nfo = nil ! nfo = NgetSuite::Nfo.new(query['mid'].to_s, true) if query.has_key? 'mid' %> <?xml version="1.0" encoding="ISO-8859-1"?> --- 7,11 ---- nfo = nil ! nfo = NgetSuite::Nfo.new(query['artindex'].to_s, query['groupindex'], true) if query.has_key? 'artindex' %> <?xml version="1.0" encoding="ISO-8859-1"?> Index: queue.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/queue.rhtml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** queue.rhtml 6 Feb 2004 23:46:59 -0000 1.10 --- queue.rhtml 20 Feb 2004 16:44:40 -0000 1.11 *************** *** 42,47 **** # Update the queue table in the db according to the parameters given to the # cgi ! if cgi.params.has_key?('id') && cgi.params.has_key?('selected') ! ids = cgi.params['id'] i = 0 ids.each { |item| --- 42,47 ---- # Update the queue table in the db according to the parameters given to the # cgi ! if cgi.params.has_key?('queueindex') && cgi.params.has_key?('selected') ! ids = cgi.params['queueindex'] i = 0 ids.each { |item| *************** *** 68,78 **** <table class="queuelist"> <tr class='headers'><th><input type='checkbox' name="markall" onClick="CA(document.queue);"></th> ! <th>Queue id</th><th>Group</th><th>Value</th><th>Priority</th><th>Status</th> <th>Added</th><th>Started</th><th>Finished</th> </tr> <% ! req = 'select `id` from `queue`' if cgi.params.has_key?('group') ! req += " where `group` = '#{cgi.params['group']}' " end req += ' order by `priority` desc' --- 68,78 ---- <table class="queuelist"> <tr class='headers'><th><input type='checkbox' name="markall" onClick="CA(document.queue);"></th> ! <th>Queue index</th><th>Group</th><th>Value</th><th>Priority</th><th>Status</th> <th>Added</th><th>Started</th><th>Finished</th> </tr> <% ! req = 'select `queueindex` from `queue`' if cgi.params.has_key?('group') ! req += " where `groupindex` = '#{NgetSuite::Group.getindex(cgi.params['group'])}' " end req += ' order by `priority` desc' *************** *** 81,89 **** sth.fetch do |row| q = NgetSuite::Queue.getqueue(row[0]) ! puts "<input type='hidden' name='id' value='#{q._id}'>" print "<tr class='#{q._status}'>" ! print "<td><input type='checkbox' name='selected' value='#{q._id}'></td>" ! print "<td class='id'>#{q._id}</td>" ! print "<td class='group'><a href='?group=#{q._group}'>#{q._group}</a></td>" print "<td class='value'><input type='text' name='value' value='#{q._value}'></td>" print "<td class='prio'><select name='prio'>" --- 81,89 ---- sth.fetch do |row| q = NgetSuite::Queue.getqueue(row[0]) ! puts "<input type='hidden' name='queueindex' value='#{q._queueindex}'>" print "<tr class='#{q._status}'>" ! print "<td><input type='checkbox' name='selected' value='#{q._queueindex}'></td>" ! print "<td class='id'>#{q._queueindex}</td>" ! print "<td class='group'><a href='?group=#{q.group}'>#{q.group}</a></td>" print "<td class='value'><input type='text' name='value' value='#{q._value}'></td>" print "<td class='prio'><select name='prio'>" Index: queueview.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/queueview.rhtml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** queueview.rhtml 9 Nov 2003 01:25:33 -0000 1.1 --- queueview.rhtml 20 Feb 2004 16:44:40 -0000 1.2 *************** *** 58,62 **** <tr class='headers'> <th><input type='checkbox' name="markall" onClick="CA(document.queue);"></th> ! <th>Queue id</th><th>Group</th><th>Value</th> <th>Priority</th><th>Status</th><th>Added</th> <th>Started</th><th>Finished</th><th>Delete</th> --- 58,62 ---- <tr class='headers'> <th><input type='checkbox' name="markall" onClick="CA(document.queue);"></th> ! <th>Queue index</th><th>Group</th><th>Value</th> <th>Priority</th><th>Status</th><th>Added</th> <th>Started</th><th>Finished</th><th>Delete</th> *************** *** 66,70 **** filter = "" if web.group != nil ! filter += " where `group` = '#{web.group._fullname}'" end filter += ' order by `priority` desc' --- 66,70 ---- filter = "" if web.group != nil ! filter += " where `groupindex` = '#{web.group._groupindex}'" end filter += ' order by `priority` desc' *************** *** 73,81 **** %> ! <input type='hidden' name='id' value='<%= q._id %>'> <tr class='<%= q._status %>'> ! <td><input type='checkbox' name='selected' value='<%= q._id %>'></td> ! <td class='id'><%= q._id %></td> ! <td class='group'><a href='?group=<%= q._group %>'><%= q._group %></a></td> <td class='value'><input type='text' name='value' value='<%= q._value %>'></td> <td class='prio'><select name='prio'> --- 73,81 ---- %> ! <input type='hidden' name='queueindex' value='<%= q._queueindex %>'> <tr class='<%= q._status %>'> ! <td><input type='checkbox' name='selected' value='<%= q._queueindex %>'></td> ! <td class='id'><%= q._queueindex %></td> ! <td class='group'><a href='?group=<%= q.group %>'><%= q.group %></a></td> <td class='value'><input type='text' name='value' value='<%= q._value %>'></td> <td class='prio'><select name='prio'> *************** *** 92,96 **** <td><%= NgetSuite::Utils.pretty_date q._date_started %></td> <td><%= NgetSuite::Utils.pretty_date q._date_finished %></td> ! <td><input type='checkbox' name='toremove' value='<%= q._id %>'></td> </tr> --- 92,96 ---- <td><%= NgetSuite::Utils.pretty_date q._date_started %></td> <td><%= NgetSuite::Utils.pretty_date q._date_finished %></td> ! <td><input type='checkbox' name='toremove' value='<%= q._queueindex %>'></td> </tr> Index: release.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/release.rhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** release.rhtml 17 Feb 2004 14:56:32 -0000 1.2 --- release.rhtml 20 Feb 2004 16:44:40 -0000 1.3 *************** *** 15,26 **** attr_reader :articles, :nfos ! def initialize(group,mid,date) @articles = Array.new @nfos = Array.new ! @rls = NgetSuite::Release.new(group,mid,true) if mid ! artq = "select * from `articles` a left join `nfos` n using (`mid`) " ! artq += "where a.`group`='#{group}' and `release`='#{mid}'" artq += "and DATE_FORMAT(`time`, '%Y-%m-%d')='#{date}' " if date != "any" artq += "order by `subject`" --- 15,26 ---- attr_reader :articles, :nfos ! def initialize(groupindex,artindex,date) @articles = Array.new @nfos = Array.new ! @rls = NgetSuite::Release.new(groupindex,artindex,true) if artindex ! artq = "select * from `articles` a left join `nfos` n using (`artindex`) " ! artq += "where a.groupindex='#{groupindex}' and `rlsartindex`='#{artindex}'" artq += "and DATE_FORMAT(`time`, '%Y-%m-%d')='#{date}' " if date != "any" artq += "order by `subject`" *************** *** 30,34 **** @sth.fetch_hash { |row| ! @nfos.push [row["mid"], row["subject"], row["text"]] if row["text"] @articles.push row } --- 30,34 ---- @sth.fetch_hash { |row| ! @nfos.push [row["artindex"], row["subject"], row["text"]] if row["text"] @articles.push row } *************** *** 48,55 **** <a href="queue.rhtml?group=<%= web.group._fullname %>">return to queue list</a> ! <% rls = ReleaseArticles.new(web.group._fullname, web.rlsmid, web.date) %> ! <% if web.rlsmid %> --- 48,55 ---- <a href="queue.rhtml?group=<%= web.group._fullname %>">return to queue list</a> ! <% rls = ReleaseArticles.new(web.group._groupindex, web.rlsartind, web.date) %> ! <% if web.rlsartind %> Index: test.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/test.rhtml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test.rhtml 6 Feb 2004 23:46:59 -0000 1.8 --- test.rhtml 20 Feb 2004 16:44:40 -0000 1.9 *************** *** 95,99 **** # Update the queue table in the db according to the parameters given to the # cgi ! if cgi.params.has_key?('id') and cgi.params.has_key?('toremove') cgi.params['toremove'].each { |item| q = NgetSuite::Queue.getqueue(item) --- 95,99 ---- # Update the queue table in the db according to the parameters given to the # cgi ! if cgi.params.has_key?('queueindex') and cgi.params.has_key?('toremove') cgi.params['toremove'].each { |item| q = NgetSuite::Queue.getqueue(item) *************** *** 101,107 **** } end ! if cgi.params.has_key?('id') and cgi.params.has_key?('selected') i = 0 ! cgi.params['id'].each { |item| if (not cgi.params['toremove'].include?(item)) and cgi.params['selected'].include?(item) q = NgetSuite::Queue.getqueue(item) --- 101,107 ---- } end ! if cgi.params.has_key?('queueindex') and cgi.params.has_key?('selected') i = 0 ! cgi.params['queueindex'].each { |item| if (not cgi.params['toremove'].include?(item)) and cgi.params['selected'].include?(item) q = NgetSuite::Queue.getqueue(item) *************** *** 205,210 **** <% if group != nil ! req = "select `mid`, DATE_FORMAT(`time`, '%e/%c %H:%i'),`subject`, `size`,`from` ! from `articles` where `group` = '#{group._fullname}' " if filter != nil req += " and `subject` LIKE '%#{filter}%'" --- 205,210 ---- <% if group != nil ! req = "select `artindex`, DATE_FORMAT(`time`, '%e/%c %H:%i'),`subject`, `size`,`from` ! from `articles` where `groupindex` = '#{group._groupindex}' " if filter != nil req += " and `subject` LIKE '%#{filter}%'" *************** *** 214,218 **** sth = Db.dbh.execute req sth.fetch do |row| ! puts "<input type='hidden' name='mid' value='#{row[0]}'>" print "<tr class='article'>" print "<td class='selection'><input type='checkbox' name='selected' value='#{row[0]}'></td>" --- 214,218 ---- sth = Db.dbh.execute req sth.fetch do |row| ! puts "<input type='hidden' name='artindex' value='#{row[0]}'>" print "<tr class='article'>" print "<td class='selection'><input type='checkbox' name='selected' value='#{row[0]}'></td>" *************** *** 239,250 **** <tr class='headers'> <th><input type='checkbox' name="markall" onClick="CA(document.queue);"></th> ! <th>Queue id</th><th>Group</th><th>Value</th> <th>Priority</th><th>Status</th><th>Added</th> <th>Started</th><th>Finished</th><th>Delete</th> </tr> <% ! req = 'select `id` from `queue`' if group != nil ! req += " where `group` = '#{group._fullname}' " end req += ' order by `priority` desc' --- 239,250 ---- <tr class='headers'> <th><input type='checkbox' name="markall" onClick="CA(document.queue);"></th> ! <th>Queue index</th><th>Group</th><th>Value</th> <th>Priority</th><th>Status</th><th>Added</th> <th>Started</th><th>Finished</th><th>Delete</th> </tr> <% ! req = 'select `queueindex` from `queue`' if group != nil ! req += " where `groupindex` = '#{group._groupindex}' " end req += ' order by `priority` desc' *************** *** 253,261 **** sth.fetch do |row| q = NgetSuite::Queue.getqueue(row[0]) ! puts "<input type='hidden' name='id' value='#{q._id}'>" print "<tr class='#{q._status}'>" ! print "<td><input type='checkbox' name='selected' value='#{q._id}'></td>" ! print "<td class='id'>#{q._id}</td>" ! print "<td class='group'><a href='?group=#{q._group}'>#{q._group}</a></td>" print "<td class='value'><input type='text' name='value' value='#{q._value}'></td>" print "<td class='prio'><select name='prio'>" --- 253,261 ---- sth.fetch do |row| q = NgetSuite::Queue.getqueue(row[0]) ! puts "<input type='hidden' name='queueindex' value='#{q._queueindex}'>" print "<tr class='#{q._status}'>" ! print "<td><input type='checkbox' name='selected' value='#{q._queueindex}'></td>" ! print "<td class='id'>#{q._queueindex}</td>" ! print "<td class='group'><a href='?group=#{q.group}'>#{q.group}</a></td>" print "<td class='value'><input type='text' name='value' value='#{q._value}'></td>" print "<td class='prio'><select name='prio'>" *************** *** 280,284 **** puts "<td>#{pretty_date q._date_started}</td>" puts "<td>#{pretty_date q._date_finished}</td>" ! puts "<td><input type='checkbox' name='toremove' value='#{q._id}'></td>" puts "</tr>" end --- 280,284 ---- puts "<td>#{pretty_date q._date_started}</td>" puts "<td>#{pretty_date q._date_finished}</td>" ! puts "<td><input type='checkbox' name='toremove' value='#{q._queueindex}'></td>" puts "</tr>" end Index: webrick.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/webrick.rhtml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** webrick.rhtml 2 Feb 2004 17:44:19 -0000 1.7 --- webrick.rhtml 20 Feb 2004 16:44:40 -0000 1.8 *************** *** 64,71 **** <% if web.group != nil ! req = "select articles.mid, DATE_FORMAT(`time`, '%e/%c %H:%i'), `subject`, ! `size`,`from`, nfos.mid ! from `articles` LEFT JOIN `nfos` USING (`mid`) ! where articles.group = '#{web.group._fullname}' " if web.filter != nil req += " and LOWER(`subject`) LIKE '%#{web.filter.downcase}%' " --- 64,71 ---- <% if web.group != nil ! req = "select articles.artindex, DATE_FORMAT(`time`, '%e/%c %H:%i'), `subject`, ! `size`,`from`, nfos.artindex ! from `articles` LEFT JOIN `nfos` USING (`artindex`) ! where articles.groupindex = '#{web.group._groupindex}' " if web.filter != nil req += " and LOWER(`subject`) LIKE '%#{web.filter.downcase}%' " *************** *** 75,79 **** sth = NgetSuite::Db.dbh.execute req sth.fetch do |row| %> ! <input type='hidden' name='mid' value='<%= row[0] %>'> <tr class='article'> <td class='selection'><input type='checkbox' name='selected' value='<%= row[0] %>'></td> --- 75,79 ---- sth = NgetSuite::Db.dbh.execute req sth.fetch do |row| %> ! <input type='hidden' name='artindex' value='<%= row[0] %>'> <tr class='article'> <td class='selection'><input type='checkbox' name='selected' value='<%= row[0] %>'></td> *************** *** 82,86 **** <%= if row[5].to_s != '' ! "<a href='nfoviewer.rhtml?mid=#{row[5]}'>#{row[2]}</a>" else row[2] --- 82,86 ---- <%= if row[5].to_s != '' ! "<a href='nfoviewer.rhtml?artindex=#{row[5]}&groupindex=#{web.group._groupindex}'>#{row[2]}</a>" else row[2] *************** *** 108,112 **** <tr class='headers'> <th><input type='checkbox' name="markall" onClick="CA(document.queue);"></th> ! <th>Queue id</th><th>Group</th><th>Value</th> <th>Priority</th><th>Status</th><th>Added</th> <th>Started</th><th>Finished</th><th>Delete</th> --- 108,112 ---- <tr class='headers'> <th><input type='checkbox' name="markall" onClick="CA(document.queue);"></th> ! <th>Queue index</th><th>Group</th><th>Value</th> <th>Priority</th><th>Status</th><th>Added</th> <th>Started</th><th>Finished</th><th>Delete</th> *************** *** 116,120 **** filter = "" if web.group != nil ! filter += " where `group` = '#{web.group._fullname}'" end filter += ' order by `priority` desc' --- 116,120 ---- filter = "" if web.group != nil ! filter += " where `groupindex` = '#{web.group._groupindex}'" end filter += ' order by `priority` desc' *************** *** 123,131 **** %> ! <input type='hidden' name='id' value='<%= q._id %>'> <tr class='<%= q._status %>'> ! <td><input type='checkbox' name='selected' value='<%= q._id %>'></td> ! <td class='id'><%= q._id %></td> ! <td class='group'><a href='?group=<%= q._group %>'><%= q._group %></a></td> <td class='value'><input type='text' name='value' value='<%= q._value %>'></td> <td class='prio'><select name='prio'> --- 123,131 ---- %> ! <input type='hidden' name='queueindex' value='<%= q._queueindex %>'> <tr class='<%= q._status %>'> ! <td><input type='checkbox' name='selected' value='<%= q._queueindex %>'></td> ! <td class='id'><%= q._queueindex %></td> ! <td class='group'><a href='?group=<%= q.group %>'><%= q.group %></a></td> <td class='value'><input type='text' name='value' value='<%= q._value %>'></td> <td class='prio'><select name='prio'> *************** *** 135,139 **** </select></td> <td class='status'><select name='status'> ! <% ['PENDING', 'PROCESSING', 'FINISHED', 'STOPPED'].each { |item| %> <option <%= "selected" if q._status == item %> value='<%= item %>'><%= item %> <% } %> --- 135,139 ---- </select></td> <td class='status'><select name='status'> ! <% ['PENDING', 'PROCESSING', 'FINISHED', 'FAILED', 'STOPPED'].each { |item| %> <option <%= "selected" if q._status == item %> value='<%= item %>'><%= item %> <% } %> *************** *** 142,146 **** <td><%= q._date_started.strftime("%d/%m/%y %H:%M") if q._date_started %></td> <td><%= q._date_finished.strftime("%d/%m/%y %H:%M") if q._date_finished %></td> ! <td><input type='checkbox' name='toremove' value='<%= q._id %>'></td> </tr> --- 142,146 ---- <td><%= q._date_started.strftime("%d/%m/%y %H:%M") if q._date_started %></td> <td><%= q._date_finished.strftime("%d/%m/%y %H:%M") if q._date_finished %></td> ! <td><input type='checkbox' name='toremove' value='<%= q._queueindex %>'></td> </tr> |
From: <jj...@us...> - 2004-02-20 14:53:59
|
Update of /cvsroot/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27949 Modified Files: daemon.rb ngetcache.sql resetdb.rb Log Message: new sql structure (integer indexes), misc Index: daemon.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/daemon.rb,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** daemon.rb 6 Feb 2004 23:46:59 -0000 1.12 --- daemon.rb 20 Feb 2004 14:42:43 -0000 1.13 *************** *** 1,60 **** #!/usr/bin/env ruby require 'drb' require 'ngetsuite/utils' require 'ngetsuite/config' include NgetSuite::Utils # TODO handle_opts -d -c homedir = ENV['HOME'] + File::Separator conf_file = homedir + '.ngetsuite' ! $config = NgetSuite::Config.new(conf_file) ! ! require 'ngetsuite/downloadmanager' ! ! dbuser = $config['dbuser'] ! dbname = $config['dbname'] ! $config['debug'] = true if $config['daemon_debug'] ! $nget = $config['nget'] ! basedir = $config['basedir'] ! max_dls = $config['max_dls'] ! port = $config['daemon_port'] ! logfile = $config['daemon_log'] ! ! $logger = File.new(logfile, 'a') ! def log(msg=nil) ! $logger.puts "[#{Time.now.localtime.strftime('%d/%m %H:%M:%S')}] #{msg}" if (msg) ! $logger.flush ! end ! puts "Starting daemon with log file '#{green logfile}'" ! manager = NgetSuite::DownloadManager.new(max_dls, basedir) manager.start if $config['daemon_autostart'] ! drburl = 'druby://localhost:' + port.to_s DRb.start_service(drburl, manager) - $thingsrunning = [manager] - trap('INT') { debug red('Ok, ok, i die') ; $thingsrunning.each{ |t| t.shutdown }; DRb.stop_service } - trap('TERM') { debug red('Ok, ok, i die') ; $thingsrunning.each{ |t| t.shutdown }; DRb.stop_service } - if $config['httpd_autostart'] require 'webrick' - include WEBrick port = $config['httpd_port'] puts "Starting web server on port #{port}" log 'Web server start' ! s = HTTPServer.new( :Port => port, ! :DocumentRoot => Dir::pwd + File::Separator + 'web' ) ! $thingsrunning << s ! httpThread = Thread.new { s.start ; log 'Web server down' } httpThread.join end DRb.thread.join if DRb.thread --- 1,68 ---- #!/usr/bin/env ruby + $wd = __FILE__.sub(/\/[^\/]*$/, '') + $wd = Dir::pwd if $wd == '.' or not FileTest.directory? $wd + Dir.chdir($wd) + require 'drb' require 'ngetsuite/utils' require 'ngetsuite/config' + require 'ngetsuite/db' + include NgetSuite::Utils + def log(msg=nil) + return unless msg + f = File.new($config['daemon_log'], 'a') + f.puts "[#{Time.now.localtime.strftime('%d/%m %H:%M:%S')}] #{msg}" + f.close + end + + module NgetSuite # TODO handle_opts -d -c homedir = ENV['HOME'] + File::Separator conf_file = homedir + '.ngetsuite' ! $config = Config.new(conf_file) $config['debug'] = true if $config['daemon_debug'] ! require 'ngetsuite/downloadmanager' ! $thingsrunning = Array.new ! manager = DownloadManager.new($config['max_dls'], $config['basedir']) + begin manager.start if $config['daemon_autostart'] + $thingsrunning << manager + puts 'Daemon started' ! drburl = 'druby://localhost:' + $config['daemon_port'].to_s DRb.start_service(drburl, manager) if $config['httpd_autostart'] require 'webrick' port = $config['httpd_port'] puts "Starting web server on port #{port}" log 'Web server start' ! s = WEBrick::HTTPServer.new( :Port => port, ! :DocumentRoot => $wd + File::Separator + 'web' ) ! httpThread = Thread.new { ! Dir.chdir($wd) ! $thingsrunning << s ! s.start ! log 'Web server down' ! } httpThread.join end DRb.thread.join if DRb.thread + + rescue Object => e + log "Quitting for #{e.class}::#{e}" + debug "#{red 'Quit'} #{e.class}::#{e}" + $thingsrunning.each{ |t| t.shutdown } + DRb.stop_service + end + end # module Index: ngetcache.sql =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetcache.sql,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ngetcache.sql 4 Feb 2004 03:07:56 -0000 1.10 --- ngetcache.sql 20 Feb 2004 14:42:43 -0000 1.11 *************** *** 18,31 **** CREATE TABLE `articles` ( ! `group` varchar(64) NOT NULL default '', ! `mid` varchar(128) NOT NULL default '', `nbparts` smallint(6) NOT NULL default '0', ! `rlsnb` smallint(6) NOT NULL default '0', ! `size` double NOT NULL default '0', `subject` varchar(255) NOT NULL default '', `from` varchar(128) NOT NULL default '', `time` datetime NOT NULL default '0000-00-00 00:00:00', ! `release` varchar(128) default '', ! PRIMARY KEY (`mid`,`group`) ) TYPE=MyISAM; --- 18,32 ---- CREATE TABLE `articles` ( ! `artindex` integer unsigned NOT NULL, ! `groupindex` integer unsigned NOT NULL, ! `rlsartindex` integer unsigned, ! `rlsnb` integer, ! `mid` varchar(128) NOT NULL, `nbparts` smallint(6) NOT NULL default '0', ! `size` integer NOT NULL default '0', `subject` varchar(255) NOT NULL default '', `from` varchar(128) NOT NULL default '', `time` datetime NOT NULL default '0000-00-00 00:00:00', ! PRIMARY KEY (`artindex`, `groupindex`) ) TYPE=MyISAM; *************** *** 37,42 **** CREATE TABLE `releases` ( ! `group` varchar(64) NOT NULL default '', ! `mid` varchar(128) NOT NULL default '', `nbexpected` smallint(6) NOT NULL default '0', `nbactual` smallint(6) NOT NULL default '0', --- 38,43 ---- CREATE TABLE `releases` ( ! `groupindex` integer NOT NULL, ! `artindex` integer NOT NULL, `nbexpected` smallint(6) NOT NULL default '0', `nbactual` smallint(6) NOT NULL default '0', *************** *** 45,49 **** `rlsmap` varchar(255) default NULL, `time` datetime NOT NULL default '0000-00-00 00:00:00', ! PRIMARY KEY (`mid`,`group`) ) TYPE=MyISAM; --- 46,50 ---- `rlsmap` varchar(255) default NULL, `time` datetime NOT NULL default '0000-00-00 00:00:00', ! PRIMARY KEY (`artindex`,`groupindex`) ) TYPE=MyISAM; *************** *** 55,59 **** CREATE TABLE `groups` ( ! `fullname` varchar(128) NOT NULL default '', `shortname` varchar(32) NOT NULL default '', `directory` varchar(255) NOT NULL default '', --- 56,61 ---- CREATE TABLE `groups` ( ! `groupindex` integer NOT NULL auto_increment, ! `fullname` varchar(128) NOT NULL, `shortname` varchar(32) NOT NULL default '', `directory` varchar(255) NOT NULL default '', *************** *** 62,66 **** `date_added` datetime NOT NULL default '0000-00-00 00:00:00', `date_updated` datetime default NULL, ! PRIMARY KEY (`fullname`), UNIQUE KEY `fullname` (`fullname`) ) TYPE=MyISAM; --- 64,70 ---- `date_added` datetime NOT NULL default '0000-00-00 00:00:00', `date_updated` datetime default NULL, ! `cache_low` integer NOT NULL default '0', ! `cache_high` integer NOT NULL default '0', ! PRIMARY KEY (`groupindex`), UNIQUE KEY `fullname` (`fullname`) ) TYPE=MyISAM; *************** *** 73,80 **** CREATE TABLE `nfos` ( ! `group` varchar(64) NOT NULL default '', ! `mid` varchar(128) NOT NULL default '', `text` longtext NOT NULL, ! PRIMARY KEY (`mid`), FULLTEXT KEY `text` (`text`) ) TYPE=MyISAM; --- 77,84 ---- CREATE TABLE `nfos` ( ! `groupindex` integer NOT NULL, ! `artindex` integer NOT NULL, `text` longtext NOT NULL, ! PRIMARY KEY (`artindex`, `groupindex`), FULLTEXT KEY `text` (`text`) ) TYPE=MyISAM; *************** *** 87,93 **** CREATE TABLE `queue` ( ! `id` int(6) NOT NULL auto_increment, ! `group` varchar(64) NOT NULL default '', ! `type` set('SINGLE','REGEXP') NOT NULL default '', `value` varchar(255) NOT NULL default '', `subdir` varchar(255) NOT NULL default '', --- 91,97 ---- CREATE TABLE `queue` ( ! `queueindex` integer NOT NULL auto_increment, ! `groupindex` integer NOT NULL, ! `type` set('SINGLE','REGEXP') NOT NULL default 'REGEXP', `value` varchar(255) NOT NULL default '', `subdir` varchar(255) NOT NULL default '', *************** *** 96,104 **** `date_started` datetime default NULL, `date_finished` datetime default NULL, ! `status` set('PENDING','PROCESSING','FINISHED','STOPPED', 'FAILED') NOT NULL default 'PENDING', `nbfiles` smallint(6) NOT NULL default '0', `finalword` varchar(64) default NULL, ! `period` int(11) default '0', ! PRIMARY KEY (`id`) ) TYPE=MyISAM; --- 100,108 ---- `date_started` datetime default NULL, `date_finished` datetime default NULL, ! `status` set('PENDING','PROCESSING','FINISHED','STOPPED','FAILED') NOT NULL default 'PENDING', `nbfiles` smallint(6) NOT NULL default '0', `finalword` varchar(64) default NULL, ! `period` integer default '0', ! PRIMARY KEY (`queueindex`) ) TYPE=MyISAM; *************** *** 110,115 **** CREATE TABLE `queue_files` ( ! `queue_id` int(11) NOT NULL default '0', ! `mid` varchar(128) NOT NULL default '', `date_started` datetime NOT NULL default '0000-00-00 00:00:00', `date_finished` datetime default NULL, --- 114,119 ---- CREATE TABLE `queue_files` ( ! `queueindex` integer NOT NULL, ! `artindex` integer NOT NULL auto_increment, `date_started` datetime NOT NULL default '0000-00-00 00:00:00', `date_finished` datetime default NULL, *************** *** 117,122 **** `status` set('PROCESSING','FINISHED','ERROR_DECODING','ERROR_RETRIEVING') NOT NULL default 'PROCESSING', `filename` varchar(128) NOT NULL default '', ! `size` int(11) NOT NULL default '0', `avgspeed` mediumint(9) NOT NULL default '0', ! PRIMARY KEY (`queue_id`,`mid`) ) TYPE=MyISAM; --- 121,126 ---- `status` set('PROCESSING','FINISHED','ERROR_DECODING','ERROR_RETRIEVING') NOT NULL default 'PROCESSING', `filename` varchar(128) NOT NULL default '', ! `size` integer NOT NULL default '0', `avgspeed` mediumint(9) NOT NULL default '0', ! PRIMARY KEY (`queueindex`,`artindex`) ) TYPE=MyISAM; Index: resetdb.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/resetdb.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** resetdb.rb 6 Feb 2004 23:46:59 -0000 1.2 --- resetdb.rb 20 Feb 2004 14:42:43 -0000 1.3 *************** *** 1,11 **** #!/usr/bin/env ruby conffile = ENV['HOME'] + File::Separator + '.ngetsuite' require 'ngetsuite/config' ! config = NgetSuite::Config.new(conffile) ! require 'dbi' sqlfile = File.open('ngetcache.sql') - dbh = DBI.connect("DBI:Mysql:#{config['dbname']}", config['dbuser'], config['dbpass']) cmd = '' sqlfile.each { |l| --- 1,14 ---- #!/usr/bin/env ruby + module NgetSuite conffile = ENV['HOME'] + File::Separator + '.ngetsuite' require 'ngetsuite/config' ! $config = Config.new(conffile) ! require 'ngetsuite/db' ! savedgroups = Db.dbh.select_all('select `fullname`,`shortname`,`directory`,`active`,`date_added`,`description` from `groups`') ! savedqueues = Db.dbh.select_all('select * from `queue`') ! puts "Queues (to restore manually)" + savedqueues.map{ |q| "\n"+q.map{|e| e.to_s }.join(', ') }.join sqlfile = File.open('ngetcache.sql') cmd = '' sqlfile.each { |l| *************** *** 13,25 **** if l=~/CREATE TABLE (`.*`)/ puts "Resetting #{$1}" ! dbh.do "drop table if exists #{$1}" end cmd += l if l =~ /;/ ! dbh.do cmd cmd = '' end } ! dbh.disconnect sqlfile.close puts 'done' --- 16,36 ---- if l=~/CREATE TABLE (`.*`)/ puts "Resetting #{$1}" ! Db.dbh.do "drop table if exists #{$1}" end cmd += l if l =~ /;/ ! Db.dbh.do cmd cmd = '' end } ! ! puts 'Restoring groups...' ! sth = Db.dbh.prepare "insert into `groups` (`fullname`,`shortname`,`directory`,`active`,`date_added`,`description`) values (?,?,?,?,?,?)" ! savedgroups.each { |g| ! sth.execute(*g) ! } ! ! Db.dbh.disconnect sqlfile.close puts 'done' + end |
From: <ys...@us...> - 2004-02-17 15:05:29
|
Update of /cvsroot/ngetsuite/ngetsuite/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5607/web Modified Files: group.rhtml release.rhtml Log Message: small fixes, more to come Index: group.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/group.rhtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** group.rhtml 4 Feb 2004 15:40:22 -0000 1.3 --- group.rhtml 17 Feb 2004 14:56:32 -0000 1.4 *************** *** 111,115 **** orphanq = "select count(*), sum(`size`) from `articles` " ! orphanq += "where `release`='' " orphanq += "and DATE_FORMAT(`time`, '%Y-%m-%d')='#{web.date}' " if web.date != "any" --- 111,115 ---- orphanq = "select count(*), sum(`size`) from `articles` " ! orphanq += "where `group`='#{web.group._fullname}' and `release`='' " orphanq += "and DATE_FORMAT(`time`, '%Y-%m-%d')='#{web.date}' " if web.date != "any" *************** *** 124,128 **** } %> ! <a href="orphans.rhtml?group=<%= web.group %>&date=<%= web.date %>"><%= orphans %></a> </td> </tr> --- 124,128 ---- } %> ! <a target="right" href="release.rhtml?mid=&group=<%= web.group._fullname %>&date=<%= web.date %>"><%= orphans %></a> </td> </tr> Index: release.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/release.rhtml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** release.rhtml 4 Feb 2004 03:07:57 -0000 1.1 --- release.rhtml 17 Feb 2004 14:56:32 -0000 1.2 *************** *** 15,26 **** attr_reader :articles, :nfos ! def initialize(group,mid) @articles = Array.new @nfos = Array.new ! @rls = NgetSuite::Release.new(group,mid,true) artq = "select * from `articles` a left join `nfos` n using (`mid`) " artq += "where a.`group`='#{group}' and `release`='#{mid}'" artq += "order by `subject`" --- 15,27 ---- attr_reader :articles, :nfos ! def initialize(group,mid,date) @articles = Array.new @nfos = Array.new ! @rls = NgetSuite::Release.new(group,mid,true) if mid artq = "select * from `articles` a left join `nfos` n using (`mid`) " artq += "where a.`group`='#{group}' and `release`='#{mid}'" + artq += "and DATE_FORMAT(`time`, '%Y-%m-%d')='#{date}' " if date != "any" artq += "order by `subject`" *************** *** 47,51 **** <a href="queue.rhtml?group=<%= web.group._fullname %>">return to queue list</a> ! <% rls = ReleaseArticles.new(web.group._fullname, web.rlsmid) %> <a name="top"></a> --- 48,56 ---- <a href="queue.rhtml?group=<%= web.group._fullname %>">return to queue list</a> ! <% rls = ReleaseArticles.new(web.group._fullname, web.rlsmid, web.date) %> ! ! ! <% if web.rlsmid %> ! <a name="top"></a> *************** *** 70,73 **** --- 75,86 ---- <% } %> + + <% else %> + + <h1>Orphan files</h1> + <%= "<h2>posted on #{web.date_str}</h2>" if web.date %> + + <% end %> + <a name="artlist"></a> <div class="group">Articles list</div> |
From: <ys...@us...> - 2004-02-17 15:05:28
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5607/ngetsuite Modified Files: articles.rb Log Message: small fixes, more to come Index: articles.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/articles.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** articles.rb 7 Feb 2004 16:21:20 -0000 1.4 --- articles.rb 17 Feb 2004 14:56:31 -0000 1.5 *************** *** 105,109 **** if fn[1] > 0 and fn[0] > 0 return false if fn[1] != @_nbexpected ! return false if fn[0] <= @lastnb pushart(art,fn[0]) return true --- 105,109 ---- if fn[1] > 0 and fn[0] > 0 return false if fn[1] != @_nbexpected ! return false if fn[0] < @lastnb pushart(art,fn[0]) return true |
From: <jj...@us...> - 2004-02-10 02:56:50
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28219/ngetsuite Modified Files: group.rb Log Message: changed the search ability to regexp in the subjects in the database (mysql's RLIKE) Index: group.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/group.rb,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** group.rb 8 Feb 2004 12:55:48 -0000 1.34 --- group.rb 9 Feb 2004 15:32:58 -0000 1.35 *************** *** 128,132 **** def search(filter) ! sth = Db.dbh.execute('select * from `articles` where `group` = ? and `subject` LIKE ? order by `time` desc', @_fullname, '%'+filter+'%') sth.fetch_hash do |row| puts row['subject'] --- 128,132 ---- def search(filter) ! sth = Db.dbh.execute('select * from `articles` where `group` = ? and `subject` RLIKE ? order by `time` desc', @_fullname, filter) sth.fetch_hash do |row| puts row['subject'] |
From: <jj...@us...> - 2004-02-10 01:21:42
|
Update of /cvsroot/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18893 Modified Files: ngetsuite.rb Log Message: added -G to search within releases, the daemon now retries the download of failed queues with a period defined (with 'resume_downloads') Index: ngetsuite.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite.rb,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ngetsuite.rb 8 Feb 2004 12:55:47 -0000 1.18 --- ngetsuite.rb 9 Feb 2004 21:34:49 -0000 1.19 *************** *** 21,24 **** --- 21,25 ---- [ '--list-nfos', '-l', GetoptLong::OPTIONAL_ARGUMENT, '[groupid]', 'Lists already fetched nfos' ], [ '--list-releases', '-L', GetoptLong::OPTIONAL_ARGUMENT, '[groupid]', 'Lists detected releases' ], + [ '--search-releases', '-G', GetoptLong::REQUIRED_ARGUMENT, 'groupid,filter', 'Searches the releases matching a filter for a group' ], [ '--show-nfo', '-n', GetoptLong::REQUIRED_ARGUMENT, 'nb_nfo[,groupid]', 'Prints the specified nfo' ], [ '--queue-article', '-q', GetoptLong::REQUIRED_ARGUMENT, 'groupid,articleid', 'Adds an article to the download queue'], |