Permalink
Browse files

Add new commands

  • Loading branch information...
1 parent 6147ee3 commit 04ad0e49108bc6f90bfe0a28dd017ef8b5b178f3 Aldis Berjoza committed Aug 6, 2011
Showing with 48 additions and 5 deletions.
  1. +22 −1 bin/playd.sh
  2. +26 −4 man/man1/playd.1
View
23 bin/playd.sh
@@ -37,10 +37,11 @@
# feedback email: playd@bsdroot.lv
-readonly PLAYD_VERSION='1.21.1'
+readonly PLAYD_VERSION='1.21.2'
# dependancies:
# * mplayer (multimedia/mplayer)
# * tagutil (audio/tagutil) [Optional, needed if you want playd info]
+# * jot (Included in FreeBSD)
readonly PLAYD_NAME="${0##*/}"
readonly PLAYD_FILE_FORMATS='mp3|flac|og[agxmv]|wv|aac|mp[421a]|wav|aif[cf]?|m4[abpr]|ape|mk[av]|avi|mpf|vob|di?vx|mpga?|mov|flv|3gp|wm[av]|(m2)?ts'
@@ -419,6 +420,22 @@ Exit() { # {{{1
exit $1
} # 1}}}
+playd_edit_playlist() { # {{{1
+ # arg1 playlist to edit
+ ${EDITOR:-vi} "$1"
+ # TODO: add checks
+ #playd_put 'loadlist' "$PLAYD_PLAYLIST" "0"
+} # 1}}}
+
+playd_clean_playlist() { #{{{1
+ # arg1 - playlist to clean
+ rm -f "$1.tmp"
+ cat "$1" | while read item; do
+ [ -r "$item" ] && echo "$item" >> "$1.tmp"
+ done
+ mv "$1.tmp" "$1"
+} # 1}}}
+
# checking for mplayer
[ "`which mplayer`" ] || playd_die 'mplayer not found'
[ -d "$PLAYD_HOME" ] || { mkdir -p "$PLAYD_HOME" || playd_die "Can't create \"$PLAYD_HOME\""; }
@@ -437,6 +454,10 @@ while [ $# -gt 0 ]; do
'append' ) playd_warn "$1 should be 1st argument. Ignoring" ;;
'cat' ) playd_cat_playlist ;;
'cat-favourites' | 'catfav' ) cat "$PLAYD_FAV_PLAYLIST" ;;
+ 'clean' ) playd_clean_playlist "$PLAYD_PLAYLIST" ;;
+ 'clean-favourite' | 'cleanfav' ) playd_clean_playlist "$PLAYD_FAV_PLAYLIST" ;;
+ 'edit' ) playd_edit_playlist "$PLAYD_PLAYLIST" ;;
+ 'edit-favourite' | 'editfav' ) playd_edit_playlist "$PLAYD_PLAYLIST" ;;
'filename' | 'fname' ) playd_current_file ;;
'help' | '--help' | '-h' ) $PLAYD_HELP ;;
'info' ) tagutil "`playd_current_file`" ;;
View
30 man/man1/playd.1
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2010, Aldis Berjoza <aldis@bsdroot.lv>
+.\" Copyright (c) 2010-2011, Aldis Berjoza <aldis@bsdroot.lv>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are
@@ -26,7 +26,7 @@
.\" (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 December 15, 2010
+.Dd August 6, 2011
.Dt playd 1
.Os
.\"#############################################################################
@@ -149,6 +149,28 @@ range -100 to 100.
.Xc
Play video DVD. (Can't append to playlist)
.\" }}}
+.\" clean {{{
+.It Cm clean
+Clean current playlist (remove files that doesn't exist)
+.\" }}}
+.\" clean-favourite {{{
+.It Cm clean-favourite
+Clean favourite playlist (remove files that doesn't exist)
+.Pp
+Alias:
+.Cm cleanfav
+.\" }}}
+.\" edit {{{
+.It Cm edit
+Edit current playlist (calls $EDITOR or vi)
+.\" }}}
+.\" edit-favourite {{{
+.It Cm edit-favourite
+Edit favourite playlist (calls $EDITOR or vi)
+.Pp
+Alias:
+.Cm editfav
+.\" }}}
.\" favourite {{{
.It Cm favourite
Add current song to favourites
@@ -508,13 +530,12 @@ Enough is enough... Turn off the player
.Ar *.divx ,
.Ar *.dvx ,
.Ar *.flac ,
+.Ar *.flv ,
.Ar *.m2ts ,
.Ar *.m4a ,
.Ar *.m4b ,
.Ar *.m4p ,
.Ar *.m4r ,
-.Ar *.mid ,
-.Ar *.midi ,
.Ar *.mka ,
.Ar *.mkv ,
.Ar *.mov ,
@@ -531,6 +552,7 @@ Enough is enough... Turn off the player
.Ar *.ogm ,
.Ar *.ogv ,
.Ar *.ogx ,
+.Ar *.ts ,
.Ar *.vob ,
.Ar *.wav ,
.Ar *.wma ,

0 comments on commit 04ad0e4

Please sign in to comment.