Browse Source

fixed bugs

master
wes 12 years ago
parent
commit
a69e2e847f
  1. 2
      config_parser.rkt
  2. 11
      lazyplay.rkt
  3. 4
      lazyplay.sexp

2
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)

11
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))))

4
lazyplay.sexp

@ -1,3 +1,3 @@
(("player" "/usr/bin/mplayer")
("filetypes" (("avi" #t) ("mp4" #t)))
("args" "-ss 5000"))
("filetypes" (("avi" #t) ("mp4" #t) ("mkv" #t)))
("args" ""))