update for preferred content

This commit is contained in:
Joey Hess 2019-05-21 14:56:45 -04:00
parent e06feb7316
commit d98dc13345
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -19,14 +19,13 @@ already.
Then, in that repository, set up an adb special remote: Then, in that repository, set up an adb special remote:
initremote android type=adb androiddirectory=/sdcard/DCIM encryption=none exporttree=yes importtree=yes initremote android type=adb androiddirectory=/sdcard encryption=none exporttree=yes importtree=yes
The above example imports files from the /sdcard/DCIM directory of the The above example syncs with the /sdcard directory of the
Android device, so it will only import photos and videos, not other files. Android device. That can be a lot of files, so you may want a more
If you wanted to import everything, you could instead use limited directory. See the sample workflows below for some more examples.
"androiddirectory=/sdcard".
Next, configure how file trees imported from it will be merged into your Next, configure how trees of files imported from it will be merged into your
git repository. git repository.
git config remote.android.annex-tracking-branch master:android git config remote.android.annex-tracking-branch master:android
@ -36,6 +35,14 @@ of the master branch, and makes all its files appear to be inside a
subdirectory named `android`. If you want its files to not be in a subdirectory named `android`. If you want its files to not be in a
subdirectory, set it to "master" instead. subdirectory, set it to "master" instead.
Finally, you may want to configure a preferred content expression for the
remote. That will limit both what is exported to it, and what is imported
from it. If you want to fully sync all files, you don't need to do this.
For example, to limit the files that get imported and exported to sound files:
git annex wanted android 'include=*.mp3 or include=*.ogg'
## syncing with it ## syncing with it
git annex sync --content android git annex sync --content android
@ -57,21 +64,32 @@ these to only import from or export to the android device:
### photos ### photos
The examples above showed how to import photos from your Android device Set up the remote to use the /sdcard/DCIM directory where the phone's
into an android subdirectory. If you don't want to keep old photos on your camera stores them.
Android device, you can simply `git mv` the files out of the android
directory, and the next sync with the phone will delete them from the initremote android type=adb androiddirectory=/sdcard/DCIM encryption=none exporttree=yes importtree=yes
Android device:
The annex-tracking-branch can be the same as before, to limit
the files that are synced to those in an android directory:
git config remote.android.annex-tracking-branch master:android
If you don't want to keep old photos on your Android device, you can simply
`git mv` the files from the android directory to another directory, and
the next sync with the phone will delete them from the Android device:
git mv android/* . git mv android/* .
git annex sync --content git annex sync --content
### music and podcasts ### music and podcasts
Set up the remote to use the /sdcard/Music directory: You could set up the remote to use the /sdcard/Music directory.
But, I sometimes download music to other locations, and perhaps you do too.
Let's instead limit the remote to mp3 and ogg files:
initremote android type=adb androiddirectory=/sdcard encryption=none exporttree=yes importtree=yes
git annex wanted android 'include=*.mp3 or include=*.ogg'
initremote android type=adb androiddirectory=/sdcard/Music encryption=none exporttree=yes importtree=yes
The annex-tracking-branch can be the same as before, to limit The annex-tracking-branch can be the same as before, to limit
the files that are synced to those in an android directory: the files that are synced to those in an android directory:
@ -82,14 +100,17 @@ And then do an initial sync:
git annex sync --content android git annex sync --content android
Now, you can copy music and podcasts you want to listen Now, you can copy music and podcasts you want to listen
to over to the Android device, by first copying them to the Android to over to the Android device, by first copying them to the android
directory of your git-annex repo: directory of your git-annex repo:
cp -a podcasts/LibreLounge/Episode_14__Secure_Scuttlebutt_with_Joey_Hess.ogg android/ cp -a podcasts/LibreLounge/Episode_14__Secure_Scuttlebutt_with_Joey_Hess.ogg android/
git annex add android git annex add android
git annex sync --content android git annex sync --content android
Once you're done with listening to something on the Android device, That will also import any new sound files from the Android device into
you can simply delete on the device, and the next time git-annex syncs, it your git-annex repo.
Once you're done with listening to something on the Android device, you can
simply delete it from the device, and the next time git-annex syncs, it
will get removed from the android directory. Or, you can delete it from the will get removed from the android directory. Or, you can delete it from the
android directory and the next sync will delete it from the Android device. android directory and the next sync will delete it from the Android device.