Guest User

Untitled

a guest
Jul 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #COPY FROM iPhoneVideoRecorder TO 100APPLE
  4. target="/var/mobile/Media/iPhoneVideoRecorder"
  5. cd $target
  6. current=$(pwd)
  7. if [[ "$current" = "$target" ]]; then
  8. find -name "*.mov" -o -name "*.mp4" | while read I; do mv "$I" /var/mobile/Media/DCIM/100APPLE/; done
  9. fi;
  10.  
  11. #COPY FROM Cycorder TO 100APPLE
  12. target="/var/mobile/Media/Videos"
  13. cd $target
  14. current=$(pwd)
  15. if [[ "$current" = "$target" ]]; then
  16. find -name "*.mov*" | while read I; do mv "$I" /var/mobile/Media/DCIM/100APPLE/; done
  17. fi;
  18.  
  19. #COPY FROM YourTube TO 100APPLE
  20. target="/var/mobile/Media/Downloads/YourTube"
  21. cd $target
  22. current=$(pwd)
  23. if [[ "$current" = "$target" ]]; then
  24. find -name "*.mov" -o -name "*.mp4" | while read I; do mv "$I" /var/mobile/Media/DCIM/100APPLE/; done
  25. fi;
  26.  
  27. #REMOVE SPACES
  28. target="/var/mobile/Media/DCIM/100APPLE"
  29. cd $target
  30. current=$(pwd)
  31. if [[ "$current" = "$target" ]]; then
  32. find . -name "* *" -exec sh -c 'mv "${0}" "${0// /_}"' {} \;
  33.  
  34. #GET LAST VIDEO NUMBER
  35. num="1"
  36. last=$(ls -1 | grep 'MOV\|JPG')
  37. num=`expr match "$last" '^.*IMG_\([0-9]*\)'`
  38. num=`expr $num + 1`
  39. echo $num
  40.  
  41. #REMOVE APPLE DOUBLE FILE
  42. rm -rf .AppleDouble
  43.  
  44. #RENAME VIDEOS
  45. find -name "*.mov" -o -name "*.mp4" | while read I; do if [[ "$num" -lt "10" ]]; then mv "$I" IMG_000$num.MOV; else if [[ "$num" -lt "100" ]]; then mv "$I" IMG_00$num.MOV; else if [[ "$num" -lt "1000" ]]; then mv "$I" IMG_0$num.MOV; else if [[ "$num" -lt "10000" ]]; then mv "$I" IMG_$num.MOV; fi fi fi fi; ((num=num+1)); done
  46.  
  47. #CHECK & CREATE THUMBS
  48. find -name "IMG*.MOV" | while read I; do num=`expr match "$I" '^.*IMG_\([0-9]*\)'`; if [[ -f /var/mobile/Media/DCIM/100APPLE/.MISC/IMG_$num.THM ]]; then exist="true"; else ffmpeg -i IMG_$num.MOV -t 0:0:3.001 /var/mobile/Media/DCIM/100APPLE/.MISC/IMG_$num.MOV.jpg; fi; done
  49. fi;
  50.  
  51. #RENAME THUMBS
  52. target="/var/mobile/Media/DCIM/100APPLE/.MISC"
  53. cd $target
  54. current=$(pwd)
  55. if [[ "$current" = "$target" ]]; then
  56. find -name "*.jpg" | while read I; do num=`expr match "$I" '^.*IMG_\([0-9]*\)'`; mv "$I" IMG_$num.THM; cp IMG_$num.THM IMG_$num.JPG; done
  57. fi;
Add Comment
Please, Sign In to add comment