KXStudio scripts and misc stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
858B

  1. #!/bin/bash
  2. #
  3. # FLASHLINK
  4. #
  5. # Will ieterate through all open copies flashplayer and link flash video to the
  6. # current folder (or specified directory) with the .flv extension added.
  7. args=("$@")
  8. args=`echo $args | sed 's/[/]$//'`
  9. pids=`eval pgrep -f flashplayer`
  10. for pid in $pids; do
  11. lsoutput=$(lsof -p $pid | grep '/tmp/Flash[^ ]*')
  12. IFS=$'\n'
  13. for line in $lsoutput; do
  14. lsout1=`echo $line | awk '{print "/proc/" $2 "/fd/" $4}' | sed 's/[rwu]$//'`
  15. lsout2=`echo $line | awk '{print $9}' | awk -F '/' '{print $3}'`
  16. if [ -n "$args" ]; then
  17. if [ -d $args ]; then
  18. echo "Linking $lsout2 to $args/"
  19. eval "ln -s $lsout1 $args/$lsout2.flv"
  20. else
  21. echo "The directory \"$args\" doesn't exist"
  22. break
  23. fi
  24. else
  25. echo "Linking $lsout2"
  26. eval "ln -s $lsout1 $lsout2.flv"
  27. fi
  28. done
  29. done