Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- file="/media/$USER/My_Data/Videos/video clips/random.m3u"
- last="/media/$USER/WindowsDir/Users/$USER/GoogleDrive/linux/.lastNumber"
- DIR0="/media/mosaid/My_Data/Videos/video clips/videos 001/"
- N=$( cat "$file" | wc -l )
- function play (){
- n=$1
- if (( $n > $N )) ; then n=1; fi
- #for i in 20 89 196 223 281 311 411 423
- # do
- # if(($i==$n))
- # then
- # let "n += 1"
- # fi
- #done
- fileToPlay=$( cat "$file" | sed -n "$n"p )
- echo "$n" > "$last"
- pid=$(pidof xplayer) # $( pgrep xplayer )
- nohup xplayer "$fileToPlay" </dev/null >/dev/null 2>&1 &
- sleep 1
- if (( ${#pid}==0 ))
- then
- xplayer --toggle-controls
- fi
- }
- function printhelp () {
- string1=$1
- string2=$2
- pad=$( printf '%0.1s' " "{1..60} )
- padlength=25
- printf '\t%s' "$string1"
- printf '%*.*s' 0 $(( padlength - ${#string1} )) "$pad"
- printf "$string2"
- printf '\n'
- }
- case "$1" in
- "" )
- number=$(cat "$last" )
- let "number += 1"
- if (($number > $N))
- then
- number="1"
- fi
- echo "$number"
- play $number
- ;;
- "all" )
- nohup xplayer "$file" </dev/null >/dev/null 2>&1 &
- ;;
- "l" | "L" )
- cat "$file" | awk -F'/' '{ if(length($NF)>70) $NF=substr($NF,0,70) ; print $NF}' | cat -n |less
- ;;
- "a" )
- mv "$2" "$DIR0"
- echo "$DIR0/$2" >> "$file"
- ;;
- "e" )
- nohup notepadqq "$file" </dev/null >/dev/null 2>&1 &
- ;;
- "h" )
- printhelp "h" "print this help"
- printhelp "" "play next"
- printhelp "[number]" "play [number] of the list"
- printhelp "l, L" "print list items"
- printhelp "a" "move 2nd arg to videos folder and add to list"
- printhelp "e" "edit vclips.m3u"
- ;;
- * )
- number='^[0-9]+$'
- if [[ $1 =~ $number ]] ; then play $1 ; fi
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement