From a69e2e847fdf0ce3006a4b4d94ae0cf26146b8ed Mon Sep 17 00:00:00 2001 From: wes Date: Mon, 5 Mar 2012 17:20:08 -0500 Subject: [PATCH] fixed bugs --- config_parser.rkt | 2 +- lazyplay.rkt | 11 +++++------ lazyplay.sexp | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/config_parser.rkt b/config_parser.rkt index 327fcdb..8fec05d 100755 --- a/config_parser.rkt +++ b/config_parser.rkt @@ -2,7 +2,7 @@ #lang racket (require "helpers.rkt") -(define ip (open-input-file "lazyplay.sexp")) +(define ip (open-input-file "/home/wes/lisp/lazyplay/lazyplay.sexp")) (define parsed (read ip)) (close-input-port ip) diff --git a/lazyplay.rkt b/lazyplay.rkt index c1e62d7..4397555 100755 --- a/lazyplay.rkt +++ b/lazyplay.rkt @@ -6,13 +6,11 @@ (require "config_parser.rkt") (define args (vector->list (current-command-line-arguments))) -; args: filename, mplayer-args -; optional: directory -(hash-ref settings "args" "") + (define file-types (make-hash)) (define media-player (string->path (hash-ref settings "player" "/usr/bin/mplayer"))) (define player-args (hash-ref settings "args" "")) -(update file-types (hash-ref settings "file-types" '(("avi" #t)))) +(update file-types (hash-ref settings "filetypes" '(("avi" #t)))) (define (file-list) ; list of files in the current working directory (map path->string ; get the strings from the list of paths @@ -86,19 +84,20 @@ (cond ((compose not thread-running?) player-thread ; if the thread is not running then return '())) + (display "> ") (let* ((input (read-line (current-input-port) 'linefeed))) input (cond ((eof-object? input) '()) (else (thread-send player-thread input) (controller player-thread))))) - +(play-list) (define player-thread (thread (lambda () (play (play-list) played player-args)))) (define controller-thread (thread (lambda () (controller player-thread)))) ; check to see if the player is running, and if not then kill the controller (define (check) - (sleep 20) + ; (sleep 20) (cond (((compose not thread-running?) player-thread) (kill-thread controller-thread)) (else (check)))) diff --git a/lazyplay.sexp b/lazyplay.sexp index 0d4a6f3..7133d2f 100644 --- a/lazyplay.sexp +++ b/lazyplay.sexp @@ -1,3 +1,3 @@ (("player" "/usr/bin/mplayer") -("filetypes" (("avi" #t) ("mp4" #t))) -("args" "-ss 5000")) \ No newline at end of file +("filetypes" (("avi" #t) ("mp4" #t) ("mkv" #t))) +("args" "")) \ No newline at end of file