X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=lib%2Fguile%2Fautodl;h=b70fa8f5b549e113c92ec8e60695038eaac23469;hb=94b2ada170760408d9c2a80ba648003e47c89c96;hp=3d2a340862d22234162b60260f57aceea5a1df15;hpb=ecd6e23dca40656e40e7910dbbfa9fe4dad429d5;p=doldaconnect.git diff --git a/lib/guile/autodl b/lib/guile/autodl index 3d2a340..b70fa8f 100755 --- a/lib/guile/autodl +++ b/lib/guile/autodl @@ -62,7 +62,9 @@ (define (wanttosearch) (> (- (current-time) lastsearch) - (if (> (length trans) 0) 300 60)) + (if (eq? (cdr (assoc 'search-mode session)) 'wait) + 7200 + (if (> (length trans) 0) 300 60))) ) (define defspeed '()) @@ -209,7 +211,8 @@ (cons 'realsr info-numreal) (cons 'totalsr info-numtotal) (cons 'lastsrch lastsearch) - (cons 'srcheta info-searcheta)) + (cons 'srcheta info-searcheta) + (cons 'srchmode (cdr (assoc 'search-mode session)))) op) (newline op) (close-port op)))) @@ -379,7 +382,7 @@ (do ((arg (getopt) (getopt))) ((not (and (pair? arg) (char? (car arg)))) (set! args arg)) (cond ((eq? (car arg) #\h) (begin (display "usage: autodl [-s server] -S sessfile\n" (current-error-port)) - (display " autodl [-s server] -e search-expression [-p prio] [-t tag] [-a userarg]\n" (current-error-port)) + (display " autodl [-w] [-s server] -e search-expression [-p prio] [-t tag] [-a userarg]\n" (current-error-port)) (display " autodl [-s server]\n" (current-error-port)) (display " autodl -h\n" (current-error-port)) (exit 0))) @@ -405,6 +408,8 @@ (set! session (cons (cons 'info-file (cdr arg)) session))))) ((eq? (car arg) #\e) (set! session (cons (cons 'sexpr (dc-lexsexpr (cdr arg))) session))) + ((eq? (car arg) #\w) + (set! session (cons '(search-mode . wait) session))) ) ) ) @@ -413,6 +418,8 @@ (set! session (cons '(prio . 10) session))) (if (not (assoc 'maxtrans session)) (set! session (cons '(maxtrans . 1) session))) + (if (not (assoc 'search-mode session)) + (set! session (cons '(search-mode . wait) session))) (if (not (validate-session session)) (begin (display "Invalid session!\n" (current-error-port)) (exit 1))) (if (not dc-server) (set! dc-server (getenv "DCSERVER"))) (if (not dc-server) (set! dc-server "localhost")) @@ -497,15 +504,19 @@ (let ((ires (dc-intresp resp))) (if (and ires (= (car ires) srchid)) (begin (set! info-searcheta (+ (current-time) (cadr ires))) - (logf (string-append "search rescheduled to T+" (number->string (cadr ires)))))))) + (logf (string-append "search rescheduled to T+" (number->string (cadr ires)))) + (write-info-file))))) ((621) ; Search committed (let ((ires (dc-intresp resp))) (if (and ires (= (car ires) srchid)) (begin (logf "search committed") (set! info-searcheta 0) - (set! lastsearch (current-time)))))) + (set! lastsearch (current-time)) + (write-info-file))))) ((622) ; Search result (let ((ires (list->vector (dc-intresp resp)))) + (if (eq? (cdr (assoc 'search-mode session)) 'wait) + (set-cdr! (assoc 'search-mode session) 'normal)) (if (and ires (= (vector-ref ires 0) srchid)) (apply handlesr (map (lambda (n) (vector-ref ires n)) '(1 2 3 4 5 7 8)))))) )