scan.sh 559 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. # Bail if the media share isn't mounted
  3. if ! ~/bin/video/isMediaMounted; then
  4. exit 0
  5. fi
  6. # Bail if we are already scanning
  7. if ~/bin/video/pms/isScanning.sh; then
  8. exit 0
  9. fi
  10. # Scan, appending any parameters passed to us
  11. '/Applications/Zach/Media/Plex Media Server.app/Contents/MacOS/Plex Media Scanner' --scan ${@}
  12. # Check the return; kill the PMS if things did not go well
  13. if [ $? -ne 0 ]; then
  14. ~/bin/video/pms/killPMS.sh
  15. fi
  16. # Force an optimization after deep scans
  17. if echo "${@}" | grep -q -- '--deep'; then
  18. ~/bin/video/pms/optimize.sh
  19. fi