I am writing a bash video downloader script for iOS, and I would like to know how can I save the downloaded videos to the Gallery. So far I got to this point:
mv $title.$ext /var/mobile/Media/DCIM/100APPLE/IMG_$(printf '%04d\n' $((10#$(ls /var/mobile/Media/DCIM/100APPLE | tail -n 1 | sed 's/.*_//' | cut -f 1 -d'.') + 1))).$ext
To move the video into the Gallery and
rm /var/mobile/Media/PhotoData/Photos.sqlite-shm /var/mobile/Media/PhotoData/Photos.sqlite-wal
To refresh the gallery, but this last command does not work. I know I can remove the whole PhotoData directory but then a reboot is needed and a long wait for the gallery to reload all the photos and videos. Is there another way I can do this? Thanks in advance.