From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Dec 15 07:10:03 2009 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C8DF106566C for ; Tue, 15 Dec 2009 07:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 4AF588FC15 for ; Tue, 15 Dec 2009 07:10:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nBF7A3FL070398 for ; Tue, 15 Dec 2009 07:10:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nBF7A3ul070397; Tue, 15 Dec 2009 07:10:03 GMT (envelope-from gnats) Resent-Date: Tue, 15 Dec 2009 07:10:03 GMT Resent-Message-Id: <200912150710.nBF7A3ul070397@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Aldis Berjoza Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7141F10656D4 for ; Tue, 15 Dec 2009 07:01:30 +0000 (UTC) (envelope-from killasmurf86@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id 9ABEE8FC14 for ; Tue, 15 Dec 2009 07:01:29 +0000 (UTC) Received: by bwz5 with SMTP id 5so2776548bwz.3 for ; Mon, 14 Dec 2009 23:01:28 -0800 (PST) Received: by 10.204.154.85 with SMTP id n21mr571495bkw.171.1260860488403; Mon, 14 Dec 2009 23:01:28 -0800 (PST) Received: from killasmurf86.pc (mpe-11-135.mpe.lv [83.241.11.135]) by mx.google.com with ESMTPS id 15sm1412395bwz.12.2009.12.14.23.01.20 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 14 Dec 2009 23:01:27 -0800 (PST) Message-Id: <1260860481.4333@killasmurf86.pc> Date: Tue, 15 Dec 2009 09:01:21 +0200 From: Aldis Berjoza To: "FreeBSD gnats submit" X-Send-Pr-Version: gtk-send-pr 0.4.9 Cc: Subject: ports/141577: ports: playd update X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2009 07:10:03 -0000 >Number: 141577 >Category: ports >Synopsis: ports: playd update >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Tue Dec 15 07:10:02 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Aldis Berjoza >Release: FreeBSD 8.0-RELEASE-p1 i386 >Organization: >Environment: System: FreeBSD 8.0-RELEASE-p1 #1: Sun Dec 13 22:39:39 EET 2009 killasmurf86@killasmurf86.pc:/usr/obj/usr/src/sys/ANTIGENERIC >Description: I decided to move playd files to port.... they are only 2 files, and bough are very small Sorry for trouble. P.S. if this is unsacceptible, I will find hosting for port source. >How-To-Repeat: >Fix: --- playd.patch begins here --- diff -rNu playd.bak/Makefile playd/Makefile --- playd.bak/Makefile 2009-08-04 19:44:08.000000000 +0300 +++ playd/Makefile 2009-12-15 08:49:43.213466714 +0200 @@ -8,7 +8,8 @@ PORTNAME= playd PORTVERSION= 1.3.7 CATEGORIES= multimedia -MASTER_SITES= ${MASTER_SITE_GOOGLE_CODE} +MASTER_SITES= # none +DISTFILES= # none MAINTAINER= killasmurf86@gmail.com COMMENT= Very easy to use mplayer sh wrapper script, with useful features @@ -18,12 +19,12 @@ CONFLICTS= playd2-2.[0-9]* PLIST_FILES= bin/playd MAN1= playd.1 -WRKSRC= ${WRKDIR}/playd NO_BUILD= yes +SUB_FILES= playd.sh do-install: - ${INSTALL_SCRIPT} ${WRKSRC}/playd.sh ${PREFIX}/bin/playd - ${INSTALL_MAN} ${WRKSRC}/playd.1 ${PREFIX}/man/man1/ + ${INSTALL_SCRIPT} ${WRKDIR}/playd.sh ${PREFIX}/bin/playd + ${INSTALL_MAN} ${FILESDIR}/playd.1 ${PREFIX}/man/man1/ .include diff -rNu playd.bak/distinfo playd/distinfo --- playd.bak/distinfo 2009-08-04 19:44:08.000000000 +0300 +++ playd/distinfo 1970-01-01 03:00:00.000000000 +0300 @@ -1,3 +0,0 @@ -MD5 (playd-1.3.7.tar.gz) = 6e2db7058c62550427a10805af5265c1 -SHA256 (playd-1.3.7.tar.gz) = 03769f6431cf61a18cc3d9b653f2ee101cbf8e4bebb6fec9b0bb4974bbddfa61 -SIZE (playd-1.3.7.tar.gz) = 7179 diff -rNu playd.bak/files/playd.1 playd/files/playd.1 --- playd.bak/files/playd.1 1970-01-01 03:00:00.000000000 +0300 +++ playd/files/playd.1 2009-12-15 08:40:23.236561269 +0200 @@ -0,0 +1,210 @@ +.\" Copyright (c) 2009, Aldis Berjoza +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions are +.\" met: +.\" +.\" * Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" * Redistributions in binary form must reproduce the above +.\" copyright notice, this list of conditions and the following disclaimer +.\" in the documentation and/or other materials provided with the +.\" distribution. +.\" * Neither the name of the nor the names of its +.\" contributors may be used to endorse or promote products derived from +.\" this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +.\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" .Dd June 16, 2009 +.TH playd 1 "June 16, 2009" "playd v1.3+" "playd v1 manual" +.SH NAME +\fBplayd\fP - simple to use mplayer sh wrapper script +.SH SYNOPSIS +\fBplayd\fP [ \fB--append\fP ] [ \fIoptions\fP ] [ \fIfiles\fP | \fIdirectories\fP | \fIstream\fP ] ... +.SH DESCRIPTION +Playd is simple mplayer sh wrapper script. +With playd you don't need mplayer gui, to listen to music, watch wideos, stream video/audio. +Playd stores it's playlist is simple plain text files, containing file names with absolute path. +Playd automatically creates playlist if nessacery. +It is easy to integreate playd in various window managers (i.e. fvwm2, fluxbox), scripts etc. + +Playd is designed K.I.S.S. +Goal is to be small, fast and very easy to use. +The goal is not to be as foolproof as possible. +.SH OPTIONS +Options can be mixed almost in any order. +There's only one limit: \fB--append\fP must be 1st argument, if specified. +.SS --append +Applend items to default playlist. +Must be first argument on command line if used. +.SS --audio-delay \fIvalue\fP [ --absolute ] +Adjust audio delay in seconds (relative by default). +If \fB--absolute\fP is set, then audio delay will be set exactly to value seconds. +.SS --cd [ \fItrack\fP ] +Play audio CD. +(Can't append to playlist) +.SS --cmd "\fImplayer comman\fP" +Send command to mplayer slave directly. +If command contain spaces, it should be quoted. +For mplayer slave commands see + +http://www.mplayerhq.hu/DOCS/tech/slave.txt +.SS --brightness \fIvalue\fP [ --absolute ] +Adjust brightness by value (relative by default). +If \fB--absolute\fP key is specified, brightness will be set to absolute value. +Value can be in range -100 to 100. +.SS --contrast \fIvalue\fP [ --absolute ] +Adjust contrast by value (relative by default). +If \fB--absolute\fP key is specified, contrast will be set to absolute value. +Value can be in range -100 to 100. +.SS --dvd [ \fItrack\fP ] +Play video DVD. +(Can't append to playlist) +.SS --file [ \fIfile\fP | \fIdirectory\fP ] +Play file or directory. +This option is handy if you have file name that match playd command +.SS --gamma \fIvalue\fP [ --absolute ] +Adjust gamma by value (relative by default). +If \fB--absolute\fP key is specified, gamma will be set to absolute value. +Value can be in range -100 to 100. +.SS --hue \fIvalue\fP [ --absolute ] +Adjust hye by value (relative by default). +If \fB--absolute\fP key is specified, hue will be set to absolute value. +Value can be in range -100 to 100. +.SS --list +Show default playlist. +.SS --longlist +Show default plaulist. Each item is displayed with full path. +.SS --mute +Mute mplayer slave. +.SS --next +Play next playlist item. +.SS --nocheck \fIfile\fP +There are some files that are reported as application/octet-stream. +These can be various types, even text files. +If you can't load some file, you can try using this option. +It won't check for file type and extension. +This can be very usefull for disk images. +Note, that you need to set \fB--nocheck\fP for every file you want playd to skip filetype checks. +.SS --pause +Pause mplayer slave. +.SS --play \fIitem1\fP [\fIitem2\fP] ... +Play items from default playlist. +.SS --playlist [\fIcustom-playlist\fP] +Play simple text playlist. +Playd will play default playlist if no playlist is specified. +Mplayer slave will be automatically started if nessacery. +.SS --restart [ --console ] [ --nofork ] +Sometime playd doesn't listen to your commands. +Actually playd does listend, while mplayer doesn't. +So if you don't get expeced behavior from playd, please run \fBplayd --restart\fP and check if everything works. +Only send bug report if same problem apears after restart. +If \fB--console\fP is set, mplayer will only output sound. +If \fB--fork\fP is set, mplayer playd will show mplayer output to current terminal. +.SS --rmlist +Remove default playlist. +.SS --seek \fIvalue\fP [ --absolute | --precent ] +Seek current file to value. +If \fB--absolute\fP is specified, seek to absolute value in seconds. +If \fB--precent\fP is specified, seek to value percent. +By default mplayer slave will seak relative in seconds. +.SS --sarution \fIvalue\fP [ --absolute ] +Adjust sarution by value (relative by default). +If \fB--absolute\fP key is specified, sarution will be set to absolute value. +Value can be in range -100 to 100. +.SS --start [ --console ] [ --nofork ] +Start mplayer slave. +You won't probably need to use this, because mplayer slave is started automatically when needed. +If \fB--console\fP is set, mplayer will only output sound. +If \fB--fork\fP is set, mplayer playd will show mplayer output to current terminal. +.SS --status +Check if mplayer is started in slave mode. +.SS --subtitles \fIfile\fP +Load subtitles. +This optiond doesn't check for filetype. + +NOTE: this option is untested. If it works, or doesn't please send email to killasmurf86@gmail.com +.SS --stop +Stop mplayer slave. +.SS --switch-audio +Cycle through the available audio tracks. (for DVD) +.SS --switch-subtitle +Cycle through the available subtitle tracks. (for DVD) +.SS --volume \fIvalue\fP [ --absolute ] +Adjust volume by value (relative by default). +If \fB--absolute\fP key is specified, volume will be set to absolute value. +Value can be 0 - 100 +.SS \fIfile\fP | \fIdirectory\fP | \fIstream\fP +play file, directory or stream. +Mplayer will be automatically started in slave mode, if nessacery. +.SH "COMMAND ALIASES" +Every command that starts with \fB--\fP, has alias witout it (they aren't mentioned here) + + \--absolute abs + \--append -a + \--cd -c cdda + \--dvd -d + \--file -f + \--help -h + \--list -l + \--longlist -L --llist + \--mute -m + \--next -n + \--pause -z + \--percent % + \--play -p + \--playlist -P + \--restart -R + \--seek -s + \--stop -q + \--switch-audio --sw-audio + \--switch-subtitles --sw-subs + \--subtitles -S --subs + \--volume -v --vol +.SH ENVIRONMENT +Set PLAYD_MPLAYER_USER_OPTIONS, to add custom command line options passed to mplayer, when it's started. + +Set PLAYD_HOME, if you want to change playd home directory. +By default it uses ~/.mplayer +.SH EXAMPLES +playd /my/mysic + +playd --append /mysic/1.mp3 /music/3.mp3 + +playd play 1 3 5 + +playd http://yp.shoutcast.com/sbin/tunein-station.pls?id=656847 + +playd stop +.SH NOTES +As of v1.3.x there are several differences in command line syntax compared to older versions. +If you have integrated playd in your window manager, script etc... you should modify your config to match new syntax. + +\fB--rmlist\fP may be remove in future + +One character options, such as -z may change. +They need tuning. +.SH HOMEPAGE +http://code.google.com/p/playd/ +.SH SEE ALSO +mplayer(1) +sh(1) +.SH AUTHORS +Aldis Berjoza +.SH BUGS +Seams \fB--play\fP doesn't work well (if at all) after using \fB--next\fP or \fB--seek\fP. +I think it's mplayer bug (still testing if it's playd bug). +After you restart playd, everything seams work as expected. + +Read \fB--restart\fP diff -rNu playd.bak/files/playd.sh.in playd/files/playd.sh.in --- playd.bak/files/playd.sh.in 1970-01-01 03:00:00.000000000 +0300 +++ playd/files/playd.sh.in 2009-12-15 08:40:23.245912178 +0200 @@ -0,0 +1,539 @@ +#!/bin/sh +# Copyright (c) 2009, Aldis Berjoza +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +# by: killasmurf86 +# e-mail: killasmurf86@gmail.com +# +# playd.sh is sh script that controls mplayer daemon (via pipe) +# it's easy to use and/or integrate in onther apps +# +# I'm using this script in my fvwm2 configuration everywhere where I +# have to deal with sound + +PLAYD_VERSION="1.3.7" +PLAYD_NAME=`basename $0` + +# HOME variable must be defined +if [ "$HOME" = '' ]; then + echo 'ERR: You are homeless. $HOME not defined' + exit 1 +fi + +PLAYD_HOME=${PLAYD_HOME="$HOME/.mplayer"} +PLAYD_PIPE="$PLAYD_HOME/playd.fifo" +PLAYD_PLAYLIST="$PLAYD_HOME/playd_playlist.plst" +PLAYD_LOCK="$PLAYD_HOME/playd.lock" + +# to customize mplayers cmdl set PLAYD_MPLAYER_USER_OPTIONS env variable +MPLAYER_CMD_GENERIC="${PLAYD_MPLAYER_USER_OPTIONS} -idle -input file=$PLAYD_PIPE" +#MPLAYER_CMD_GENERIC="${PLAYD_MPLAYER_USER_OPTIONS} -idle -quiet -input file=$PLAYD_PIPE" +MPLAYER_CMD="mplayer $MPLAYER_CMD_GENERIC" +MPLAYER_SND_ONLY_CMD="mplayer -vo null $MPLAYER_CMD_GENERIC" + + +# print help +playd_help() { +cat << EOF +$PLAYD_NAME v$PLAYD_VERSION +by killasmurf86 +http://code.google.com/p/playd/ + +$PLAYD_NAME is script to control mplayer in slave mode + +Special thanks to DutchDaemon and blah for few lines of sh +EOF +} + + +# put argv into pipe +playd_put() { + playd_check + if [ $? -gt 0 ]; then + echo "$*" >> "$PLAYD_PIPE" + return + fi + echo "ERR: playd doesn't seam to be running" + exit 1 +} + + +# check if playd daemon is running and return pid +# returns 0 if daemon ain't running +playd_check() { + if [ -f "$PLAYD_LOCK" ]; then + local pidStored=`cat $PLAYD_LOCK` + for pid in `pgrep mplayer`; do + if [ "$pid" = "$pidStored" ]; then return "$pidStored"; fi + done + playd_clean + fi + return 0 +} + +# clean files after playd +playd_clean() { + rm -f "$PLAYD_PLAYLIST.tmp" + rm -f "$PLAYD_PIPE" + rm -f "$PLAYD_LOCK" +} + +# start daemon +# possible artguments: +# console novid (order doesn't matter) +playd_start() { + playd_check + if [ $? -eq 0 ]; then + if [ ! -p "$PLAYD_PIPE" ]; then + mkfifo "$PLAYD_PIPE" + if [ $? -gt 0 ]; then + echo "ERR: Can't create $PLAYD_HOME" + exit 1 + fi + else + echo "ERR: There may be another instance of playd running. Run playd --restart" + exit 1 + fi + cd / + if [ $NOVID -eq 0 ]; then + local mplayer_run_cmd="$MPLAYER_CMD" + else + local mplayer_run_cmd="$MPLAYER_SND_ONLY_CMD" + fi + + if [ $CONSOLE -eq 0 ]; then + exec ${mplayer_run_cmd} > /dev/null 2> /dev/null & + echo "$!" > "$PLAYD_LOCK" + else + local dbg_pipe="$PLAYD_HOME/playd_debug.pipe" + mkfifo "$dbg_pipe" + exec ${mplayer_run_cmd} > "$dbg_pipe" 2> "$dbg_pipe" & + echo "$!" > "$PLAYD_LOCK" + cat "$dbg_pipe" + playd_clean + exit + fi + cd - + fi +} + + +# stop playd daemon +playd_stop() { + playd_check + if [ $? -gt 0 ]; then + playd_put 'quit' + if [ $? -gt 0 ]; then + sleep 1 # give mplayer 1s to quit + playd_check + local kill_pid=$? + if [ $kill_pid -gt 0 ]; then + kill $kill_pid + sleep 1 + playd_check + kill_pid=$? + if [ $kill_pid -gt 0 ]; then + kill -s KILL $kill_pid + sleep 1 + playd_check + if [ $? -gt 0 ]; then + echo "ERR: can't kill mplayer slave" + exit 1 + fi + fi + fi + fi + fi + playd_clean +} + + +## make playlist form directory +## arguments: +## $1 - dir to make list +playd_mk_playlist() { + # $1 and $fileName must be double quoted to avoid + # problems with filenames that contain speccial characters + ls "$1" | while read fileName; do + if [ -f "$1/$fileName" ]; then + local fname="$1/$fileName" + case `echo ${fname##*.} | tr 'QWERTYUIOPASDFGHJKLZXCVBNM' 'qwertyuiopasdfghjklzxcvbnm'` in + mp3|flac|ogg|oga|aac|wav|wma|aiff|aifc|m4a|m4b|m4p|m4r|mpga|mka|avi|mkv|vob|mp4|3gp|wmv|mov|divx|dvx|ogm|ogv|ape ) + echo "$fname" >> "$PLAYD_PLAYLIST.tmp" + ;; + + *) + case `file -ib "$fname" | tr ' ' '_'` in + 'audio'* | 'video'* ) + echo "$fname" >> "$PLAYD_PLAYLIST.tmp" + ;; + esac + esac + elif [ -d "$1/$fileName" ]; then + playd_mk_playlist "$1/$fileName" + else + echo 'ERR: wtf?' + echo "file: $1/$fileName" + exit 1 + fi + done +} + + +# playd match takes at least 4 arguments. +# argument count must be even +# arg 1 is key we need to find +# arg 2 is what we return if we don't find key +#--- +# next argument is what we return when we find key +# next argument is quoted list of possible keys +#--- +# etc +#======= +# check it's usage in source (especially where we want to set volume) +playd_match() { + if [ $# -ge 4 ]; then + if [ `expr $# % 2` -eq 0 ]; then + local mkey="$1" # search for key + local errVal="$2" # return if not found + while [ $# -gt 0 ]; do + shift 2 + for ckey in $2; do + if [ "$mkey" = "$ckey" ]; then + echo "$1" + return + fi + done + done + echo "$errVal" + else + echo 'ERR: playd_match takes even numver of arguments' + exit 255 + fi + else + echo 'ERR: playd_match takes at least 4 arguments' + exit 255 + fi +} + +# echo full path of file/dir +# should be use as function +playd_fullpath() { + case "$1" in + /* ) echo "$1";; + * ) echo "`pwd`/$1";; + esac +} + + +#add entry to playlist +# arg1 = playlist item +playd_playlist_add() { + playd_start + playd_put "loadfile $1 $playd_append" + if [ $playd_append -eq 1 ]; then + echo "$*" >> "$PLAYD_PLAYLIST" + else + echo "$*" > "$PLAYD_PLAYLIST" + fi + playd_append=1 +} + + + +######################################################################## + +# checking for mplayer +if [ ! "$(which mplayer)" ]; then + echo 'ERR: mplayer not found' + exit 1 +fi + +if [ ! -d "$PLAYD_HOME" ]; then + mkdir "$PLAYD_HOME" + if [ $? -gt 0 ]; then + echo "ERR: Can't create $PLAYD_HOME" + exit 1 + fi +fi + + +if [ $# -eq 0 ]; then + playd_help +fi + +CONSOLE=0 +NOVID=0 + +playd_append=$(playd_match "$1" 0 1 'append --append -a') +if [ $playd_append -eq 1 ]; then shift; fi + + +# check command line arguments +while [ $# -gt 0 ]; do + case "$1" in + 'append' | '--append' | '-a' ) + echo "WARN: $1 should be 1st argument. Ignoring" + ;; + + 'help' | '--help' | '-h') + playd_help + ;; + + 'stop' | '--stop' | '-q') + playd_stop + ;; + + 'start' | '--start' + | 'restart' | '--restart' | '-R' ) + if [ $(playd_match "$1" '0' '1' 'restart --restart -R') ]; then playd_stop; fi + NOVID=$(playd_match "$2" '0' '1' 'novid --novid') + CONSOLE=$(playd_match "$2" '0' '1' 'console --console') + shift $(expr $NOVID + $CONSOLE) + playd_start ${match1} ${match2} + ;; + + 'list' | '--list' | '-l' ) + cat "$PLAYD_PLAYLIST" | awk '{print "\""$0"\""}' | xargs basename | awk '{print NR,")",$0}' + ;; + + '--longlist' | 'longlist' | 'llist' | '--llist' | '-L' ) + cat "$PLAYD_PLAYLIST" | awk '{print NR,")",$0}' + ;; + +# seams buggy +# I think there's mplayer bug +# after using playd next or playd seek, playd play dosn't work well (if at all) + 'play' | '--play' | '-p' ) + if [ -n $2 -a $2 -gt 0 ]; then + playd_start + while [ "$2" != '' ]; do + if [ -n $2 -a $2 -gt 0 ]; then + playd_put `cat $PLAYD_PLAYLIST | awk '{ if (NR == '$2' ) item = $0 } END { print "loadfile " "\""item"\" '$playd_append'"}'` + shift + else + break + fi + done + else + echo "WARN: $1 needs numberic agument. Ignoring" + fi + ;; + + 'playlist' | '--playlist' | '-P' ) + if [ -f "$2" ]; then + playd_start + if [ `dirname $(file -ib $2 | tr ' ' '_')` = 'text' ]; then + playd_put "loadlist '$2' $playd_append" + shift + else + playd_put "loadlist '$PLAYD_PLAYLIST' $playd_append" + fi + playd_append=1 + elif [ -d "$2" ]; then + echo "WARN: not playlist '$2'. Ignoring" + else + playd_start + playd_put "loadlist '$PLAYD_PLAYLIST' $playd_append" + playd_append=1 + fi + ;; + + 'rmlist' | '--rmlist' ) + rm -f "$PLAYD_PLAYLIST" + ;; + + + 'seek' | '--seek' | '-s' ) + if [ -n $2 ]; then + match=$(playd_match "$3" 0 2 'abs --absolute absolute' 1 '% --percent percent') + playd_put "seek $2 ${match}" + if [ $match -ne 0 ]; then shift; fi + shift + else + echo "WARN: $1 needs numberic atgument. Ignoring" + fi + ;; + + 'next' | '--next' | '-n' ) + playd_put "seek 100 1" + ;; + + 'status' | '--status' ) + playd_check + pid=$? + if [ $pid -gt 0 ]; then + echo "playd is running. PID: $pid" + else + echo 'playd is not running' + fi + ;; + + 'cd' | 'cdda' | '--cd' | '-c' + | 'dvd' | '--dvd' | '-d' ) + media=$(playd_match $1 '0' 'cdda://' 'cd cdda --cd -c' 'dvd://' 'dvd --dvd -d') + if [ -n $2 -a $2 -gt 0 ]; then + while [ "$2" != '' ]; do + if [ -n $2 -a $2 -gt 0 ]; then + playd_playlist_add "'${media}$2'" + shift + else + break + fi + done + else + playd_playlist_add "'${media}'" + fi + ;; + + 'cmd' | '--cmd' ) + if [ "$2" != '' ]; then + playd_put "$2" + shift + else + echo "WARN: $1 needs argument to pass to mplayer. Ignoring" + fi + ;; + + 'nocheck' | '--nocheck' ) + if [ -f "$2" ]; then + playd_playlist_add "'$(playd_fullpath $2)'" + shift + else + echo "WARN: '$2' directory. Skipping" + fi + ;; + + '--subtitles' | 'subtitles' | '--subs' | 'subs' | '-S' ) + if [ -f "$2" ]; then + playd_put "sub_load '$2'" + shift + else + echo "WARN: '$2' isnt's subtitle file. Skipping" + fi + ;; + + 'brightness' | '--brightness' + | 'contrast' | '--contrast' + | 'gamma' | '--gamma' + | 'hue' | '--hue' + | 'saturation' | '--saturation' + | 'volume' | '--volume' | 'vol' | '-V' | '--vol' + | '--audio-delay' | 'audio-delay' + ) + if [ -n $2 ]; then + match=$(playd_match "$3" 0 1 'abs --absolute absolute') + playd_put "$(playd_match \ + "$1" \ + "$1" \ + 'volume' 'vol -V --vol volume --volume' \ + 'audio_delay' '--audio-delay audio-delay' \ + | tr -d '-') $2 ${match}" + shift $(expr 1 + $match) + else + echo "WARN: $1 needs at least numberic argument. Ignoring" + fi + ;; + + 'mute' | '--mute' | '-m' + | 'pause' | '--pause' | '-z' + | '--switch-audio' | 'switch-audio' | '--sw-audio' | 'sw-audio' + | '--switch-subtitles' | 'switch-subtitles' | '--sw-subs' | 'sw-subs' + ) + playd_put "$(playd_match \ + "$1" \ + "$1" \ + 'mute' 'mute --mute -m' \ + 'pause' 'pause --pause -z' \ + 'switch_audio' '--switch-audio switch-track --sw-audio sw-audio' \ + 'sub_select' '--switch-subtitles switch-subtitles --sw-subs sw-subs' \ + | tr -d '-' )" + ;; + + *'://'* ) + playd_playlist_add "$1" + ;; + + 'file' | '--file' | '-f' | * ) + if [ $(playd_match "$1" 0 1 'file --file -f') -eq 1 ]; then shift; fi + + + if [ -f "$1" -o -d "$1" ]; then + isPlayable=0 + playd_start + fileName=$(playd_fullpath $1) + + case `echo ${1##*.} | tr 'QWERTYUIOPASDFGHJKLZXCVBNM' 'qwertyuiopasdfghjklzxcvbnm'` in + mp3|flac|ogg|oga|aac|wav|wma|aiff|aifc|m4a|m4b|m4p|m4r|mpga|mka|avi|mkv|vob|mp4|3gp|wmv|mov|divx|dvx|ogm|ogv ) + isPlayable=1 + ;; + + *) + case `file -ib "$fileName" | tr ' ' '_'` in + 'audio'* | 'video'* ) + isPlayable=1 + ;; + + 'application/x-directory'* ) + rm -f "$PLAYD_PLAYLIST.tmp" + playd_mk_playlist "$fileName" + playd_put "loadlist '$PLAYD_PLAYLIST.tmp' $playd_append" + if [ $playd_append -eq 1 ]; then + cat "$PLAYD_PLAYLIST.tmp" >> "$PLAYD_PLAYLIST" + else + cat "$PLAYD_PLAYLIST.tmp" > "$PLAYD_PLAYLIST" + playd_append=1 + fi + ;; + + *) + echo "WARN: '$fileName' doesn't seam to be vailid file for playback" + echo "WARN: to override use:" + echo " playd --nocheck $fileName" + ;; + esac + ;; + esac + + if [ $isPlayable -eq 1 ]; then + playd_playlist_add "'$fileName'" + fi + + else + echo "WARN: not a file/directory: '$1'" + fi + ;; + + esac + + shift +done + +exit 0 + diff -rNu playd.bak/pkg-descr playd/pkg-descr --- playd.bak/pkg-descr 2009-07-20 01:17:45.000000000 +0300 +++ playd/pkg-descr 2009-12-15 08:56:17.707231424 +0200 @@ -4,7 +4,7 @@ player because playd supports playlists. It is easy to integrate playd into a window manager menu (e.g. FVWM). -WWW: http://code.google.com/p/playd/ +WWW: http://github.com/killasmurf86/playd -- Aldis Berjoza --- playd.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: