#!/bin/bash # cat /usr/local/bin/openpl # sudo chmod +x /usr/local/bin/openpl # related commands: ls -l /usr/local/bin/{playmovs,mixmovs,openpl,newpldir} # # License: The MIT License, http://www.opensource.org/licenses/mit-license.php, Copyright (c) 2009 jv # declare DEFAULT_PLAYLIST_DIR PLAYLISTDIR # default DEFAULT_PLAYLIST_DIR DEFAULT_PLAYLIST_DIR="$(/usr/local/bin/playmovs -default_playlist_dir 2>/dev/null)" || DEFAULT_PLAYLIST_DIR="${HOME}/Movies/mplayer" # make sure there is no trailing slash DEFAULT_PLAYLIST_DIR="${DEFAULT_PLAYLIST_DIR%/}" if [[ "${1}" == '-h' ]] || [[ "${1}" == '-help' ]] || [[ "${1}" == '--help' ]]; then echo echo 'usage:' echo 'openpl -d # open default playlist directory' echo 'openpl -h' echo 'openpl -s # show' echo 'openpl -s regex # show & filter with egrep regex' echo 'openpl [dirname] # open playlist files of [dirname]' echo 'openpl -d [dirname] # open specified playlist directory' echo exit 0 fi if [[ "${1}" == '-s' ]] || [[ "${1}" == '--show' ]]; then #/usr/bin/find -x "${DEFAULT_PLAYLIST_DIR}" -mindepth 1 -maxdepth 1 -type d -print0 | /usr/bin/xargs -0 /usr/bin/basename /usr/bin/find -x "${DEFAULT_PLAYLIST_DIR}" -mindepth 1 -maxdepth 1 -type d -print0 | /usr/bin/xargs -0 /usr/bin/basename | /usr/bin/egrep -i "${2:-.*}" #/usr/bin/find -x "${DEFAULT_PLAYLIST_DIR}" -mindepth 1 -maxdepth 1 -type d -name "${2:-*}" -print0 | /usr/bin/xargs -0 -n1 /usr/bin/basename #/usr/bin/find -x "${DEFAULT_PLAYLIST_DIR}" -mindepth 1 -maxdepth 1 -type d -name "*${2:-*}*" -print0 | /usr/bin/xargs -0 -n1 /usr/bin/basename exit 0 fi if [[ "${1}" == '-d' ]]; then if [[ ! -d "${DEFAULT_PLAYLIST_DIR}/${2}" ]]; then echo "No such directory: ${DEFAULT_PLAYLIST_DIR}/${2}" exit 1 fi /usr/bin/open -a Finder "${DEFAULT_PLAYLIST_DIR}/${2}" exit 0 fi PLAYLISTDIR="${DEFAULT_PLAYLIST_DIR}/${1}" if [[ ! -d "${PLAYLISTDIR}" ]]; then echo "No such directory: ${PLAYLISTDIR}" exit 1 fi if [[ -f "${PLAYLISTDIR}/playlisturls-file.txt" ]]; then /usr/bin/open -e "${PLAYLISTDIR}/playlisturls-file.txt" else echo "No such file: ${PLAYLISTDIR}/playlisturls-file.txt" fi if [[ -f "${PLAYLISTDIR}/playlisturls-website.txt" ]]; then /usr/bin/open -e "${PLAYLISTDIR}/playlisturls-website.txt" else echo "No such file: ${PLAYLISTDIR}/playlisturls-website.txt" fi exit 0
Never been to CodeSnippets before?
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
Scripting mplayer playlists (IV) - openpl (See related posts)
Comments on this post
You need to create an account or log in to post comments to this site.
Related Posts
» Subscribe to a RSS feed of y... in apache php mysql find awk email lighttpd ruby rails ssh date perl regex shell textpattern svn osx mac css python google html bash subversion backup script sql javascript dom expressionengine java flash actionscript rubyonrails unix linux applescript cli c ajax image xml terminal file web sed list delphi administration directory
» DIRECTORY_SEPARATOR in apache php mysql find awk lighttpd ruby rails ssh date perl regex shell textpattern svn http osx mac css python google html bash subversion windows sql activerecord javascript expressionengine java actionscript rubyonrails unix linux applescript cli database c text ajax image string xml terminal file array web delphi administration video film convert izle
» Subscribe to a RSS feed of y... in apache php mysql find awk email lighttpd ruby rails ssh date perl regex shell textpattern svn osx mac css python google html bash subversion backup script sql javascript dom expressionengine java flash actionscript rubyonrails unix linux applescript cli c ajax image xml terminal file web sed list delphi administration directory
» 6144 users tagging and stori... in apache php mysql find awk email lighttpd ruby rails ssh date perl regex shell textpattern svn osx mac css python google html bash subversion backup script sql javascript dom expressionengine java flash actionscript rubyonrails unix linux applescript cli c ajax image xml terminal file web sed list delphi administration directory
» Using this function you will... in apache php mysql find awk email lighttpd ruby rails ssh date perl regex shell textpattern svn osx mac css python google html bash subversion backup script sql javascript dom expressionengine java flash actionscript rubyonrails unix linux applescript cli c ajax image xml terminal file web sed list delphi administration directory
» snippet in spam shell osx mac html bash unix code commandline web download convert textutil internet ed snippets snippet comment
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails