2 # Checks to make sure all videos off of phone have been copied to the Originals directory
3 # If they are missing, it means Nextcloud missed them somehow. Copy them to New Memories then.
4 # 1) First connect the phone to a computer with USB debugging turned on.
5 # Authorize the connection
6 # 2) Execute the command "adb tcpip 5555"
7 # 3) Run the script, authorize the connection
8 # 4) Run the script again
9 # You should now be able to connect to the device wirelessly
11 dcim_path="/storage/emulated/0/DCIM/Camera"
12 originals="/naspool/dropbox/Originals"
13 organized_logs="/var/log/organize"
14 new_memories="/naspool/dropbox/New Memories"
16 adb connect 192.168.0.23
17 if [[ $? != 0 ]]; then
18 echo "#ERROR: Unable to connect to phone at 192.168.0.23"
22 mp4s_on_phone=$(adb -e shell ls -1 $dcim_path/*.mp4 | xargs -n 1 basename)
23 mp4s_in_originals=$(/bin/ls -1 $originals/*.mp4 | xargs -n 1 basename)
25 for i in $mp4s_on_phone; do
26 echo "$mp4s_in_originals" | grep -q $i
27 if [[ $? != 0 ]]; then
28 zgrep -q $i $organized_logs/organize_videos*
29 if [[ $? != 0 ]]; then
30 echo "mp4 not found in originals or organize logs: $i"
31 if [[ ! -e "$new_memories/$i" ]]; then
32 adb -e pull "$dcim_path/$i" "$new_memories"
34 echo "mp4 already copied into $new_memories"
37 echo "mp4 found in originals or organize logs: $i"
40 echo "mp4 found in originals or organize logs: $i"