From: Kyoshiro <mib...@us...> - 2004-09-27 14:59:51
|
Update of /cvsroot/ngetsuite/ngetsuite/ngetsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23534/ngetsuite Modified Files: core.rb downloader.rb nfo.rb queue.rb utils.rb web.rb Log Message: sampleconfig: add httpd error and access log entries web/ top.rhtml: add (*) pseudo group to remove group filtering release.rhtml: remove non working pretty_date release.rhtml: add release view by filter queueview.rhtml: increase queue_add regex maxlength queueview.rhtml: add sort links to queue's columns headers queueview.rhtml: reorganize queue columns queueview.rhtml: replace regex input field with link to articles list (release view by filter) group.rhtml: remove non working pretty_date search.rhtml: add file, allow searching with web interface ngetsuite/ web.rb: add some form attributes recognition web.rb: add start_html, end_html, urlencode methods queue.rb: add shortgroup method, enhance output (more \n) nfo.rb: add getnfobyregex method nfo.rb: add search method downloader.rb: remove db locks ngetsuite.rb, specif.txt, core.rb: add --search-nfo-by-subject (-N) and --search-nfo (-F) options which work like -g and -G daemon.rb: add mime types handling to make webrick send text/html for .rhtml files daemon.rb: make webrick log access/errors into files instead of output mime.types: contains css and rhtml type definitions... Index: downloader.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/downloader.rb,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** downloader.rb 27 Sep 2004 13:04:05 -0000 1.39 --- downloader.rb 27 Sep 2004 14:59:40 -0000 1.40 *************** *** 180,186 **** @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' ignoreme = (Db.dbh.select_one "select `ignoreregex` from `groups` where `groupindex`='#{Group.getindex(@group)}'")[0] if ignoreme and ignoreme.length > 0 --- 180,186 ---- @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' ignoreme = (Db.dbh.select_one "select `ignoreregex` from `groups` where `groupindex`='#{Group.getindex(@group)}'")[0] if ignoreme and ignoreme.length > 0 Index: core.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/core.rb,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** core.rb 27 Sep 2004 13:04:05 -0000 1.43 --- core.rb 27 Sep 2004 14:59:40 -0000 1.44 *************** *** 109,112 **** --- 109,120 ---- end + def search_nfo_by_subject(groupid, regex) + puts Nfo.searchbysubject(groupid, regex) + end + + def search_nfo(groupid, regex) + puts Nfo.search(groupid, regex) + end + def list_releases(groupid = '') Release.list(groupid) *************** *** 246,250 **** # Simple check on the status of the queue if q._status == 'PROCESSING' ! get_manager.stop_downloader(arg) else puts "No current download for this queue" --- 254,258 ---- # Simple check on the status of the queue if q._status == 'PROCESSING' ! get_manager.stop_downloader(q._queueindex) else puts "No current download for this queue" Index: nfo.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/nfo.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** nfo.rb 27 Sep 2004 13:04:05 -0000 1.9 --- nfo.rb 27 Sep 2004 14:59:40 -0000 1.10 *************** *** 10,13 **** --- 10,49 ---- Db.autotable(Nfo, 'nfos') + def Nfo.searchbysubject(groupid, filter) + groupindex = Group.getindex(groupid) + req = "select n.artindex, n.groupindex, a.subject from `articles` a right join `nfos` n using (`artindex`) " + req += "where a.groupindex='#{groupindex}' and a.subject RLIKE '#{filter}' " + req += "order by `subject`" + sth = Db.dbh.execute req + + i = 0 + sth.fetch do |row| + puts "NFO id: #{row[0]}" + puts "Article: #{row[2]}" + i += 1 + end + sth.finish + return "No nfos found." if i == 0 + end + + def Nfo.search(groupid, filter) + groupindex = Group.getindex(groupid) + req = "select n.artindex, n.groupindex, a.subject from `articles` a " + req += "right join `nfos` n using (`artindex`) " + req += "where a.groupindex='#{groupindex}' and n.text RLIKE '#{filter}' " + req += "order by `subject`" + sth = Db.dbh.execute req + + i = 0 + sth.fetch do |row| + puts "NFO id: #{row[0]}" + puts "Article: #{row[2]}" + print "\n" + i += 1 + end + sth.finish + return "No nfos found." if i == 0 + end + def Nfo.get(groupid, n) groupindex = Group.getindex(groupid) Index: queue.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/queue.rb,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** queue.rb 9 Sep 2004 12:11:10 -0000 1.29 --- queue.rb 27 Sep 2004 14:59:40 -0000 1.30 *************** *** 127,132 **** end def to_s ! s = "#{yellow '<'}#{blue @_queueindex}#{yellow '>'} [#{red group}] #{yellow @_value}, prio : #{@_priority}, dest : #{green @_subdir}, status : #{@_status}" if (@_status == FAILED || @_status == PROCESSING) a = Db.dbh.select_all("select `status` from `queue_files` where `queueindex`='#{@_queueindex}'") --- 127,136 ---- end + def shortgroup + Group._shortname + end + def to_s ! s = "#{yellow '<'}#{blue @_queueindex}#{yellow '>'} [#{red group}] #{yellow @_value},\n\tdest : #{green @_subdir},\n\tprio : #{@_priority}, status : #{@_status} " if (@_status == FAILED || @_status == PROCESSING) a = Db.dbh.select_all("select `status` from `queue_files` where `queueindex`='#{@_queueindex}'") Index: web.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/web.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** web.rb 21 Feb 2004 15:58:18 -0000 1.8 --- web.rb 27 Sep 2004 14:59:40 -0000 1.9 *************** *** 7,11 **** class Web include Utils ! attr_reader :group, :rlsartind, :offset, :articles_by_page, :filter, :date def initialize(servlet_request) --- 7,12 ---- class Web include Utils ! attr_reader :group, :groups, :want_release, :rlsartind, :offset, :articles_by_page, :filter, ! :date, :sort, :age_max, :groupindex def initialize(servlet_request) *************** *** 21,28 **** @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' @articles_by_page = 60 --- 22,51 ---- @status = @query['status' ].list() if @query.has_key? 'status' @value = @query['value' ].list() if @query.has_key? 'value' ! @groups = @query['groups' ].list() if @query.has_key? 'groups' ! @sort = @query['sort' ].to_s if @query.has_key? 'sort' @date = @query['date' ].to_s if @query.has_key? 'date' ! @rlsartind = @query['rlsartind' ].to_s if @query.has_key? 'rlsartind' ! @groupindex = @query['groupindex'].to_s if @query.has_key? 'groupindex' ! @filter = @query['filter' ].to_s if @query.has_key? 'filter' ! @group = NgetSuite::Group.getgroup(@query['group'].to_s) if @query.has_key? 'group' + @want_release = @query['want_release'] if @query.has_key? 'want_release' + if (@query.has_key? 'aging' and @query.has_key? 'aging_unit' and + @query['aging'] != '') + @age_max = @query['aging'].to_s+" " + aging_unit = @query['aging_unit'].to_s + if (aging_unit == 'd') + @age_max += 'DAY' + elsif (aging_unit == 'h') + @age_max += 'HOUR' + elsif (aging_unit == 'w') + @age_max = @query['aging'].to_i + @age_max *= 7 + @age_max = @age_max.to_s + @age_max += ' DAY' + else + @age_max += 'DAY' + end + end @articles_by_page = 60 *************** *** 124,127 **** --- 147,173 ---- end + def start_html(title) + '<?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>'+title+'</title> + </head> + <body>'+"\n" + end + + def end_html() + "</body></html>\n" + end + + def urlencode(text) + text.gsub(/[^a-zA-Z0-9\-,.*_]/) { |x| "%"+sprintf('%2X', x[0]) } + end + + # def urldecode(text) + # text.gsub(/%(\d\d)/) { |x| sprintf('%s', x[1]) } + # end + end #class Index: utils.rb =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/ngetsuite/utils.rb,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** utils.rb 9 Sep 2004 12:11:10 -0000 1.18 --- utils.rb 27 Sep 2004 14:59:40 -0000 1.19 *************** *** 80,83 **** --- 80,87 ---- end + def Utils.rebg msg + color(msg,RED_BG,1) + end + def format_date(date) if date.class == Time |