Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger Uploads #4

Open
vegedb opened this issue Jul 15, 2024 · 9 comments
Open

Trigger Uploads #4

vegedb opened this issue Jul 15, 2024 · 9 comments
Labels
enhancement New feature or request

Comments

@vegedb
Copy link

vegedb commented Jul 15, 2024

Problem

I find that "background uploads" is unreliable and it prevents new stuff to be transferred to the SSD since it will be full when upload doesn't happen. Since my pixel is away most of the time, its not that feasible to trigger physically.

What I've tried

  1. Use https://github.com/Genymobile/scrcpy manually go to the app and force upload using desktop/laptop. (Works but Not automated)
  2. Tasker + AutoInput to do the press commands (This is unreliable since the phone sometimes close tasker due to deep sleep or lack of ram?)

Question

Is there an adb command or root app to "Trigger upload"? Would be great if its adb since we can use home assistant to do it.

@master-hax
Copy link
Owner

try

adb shell am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file://FILE_PATH

where FILE_PATH might be /sdcard/the_binding or /mnt/runtime/write/emulated/0/the_binding

not sure if you need to specify each file individually

@vegedb
Copy link
Author

vegedb commented Jul 15, 2024

try

adb shell am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file://FILE_PATH

IIRC this is for refreshing/scan photos app for new photos. I have no problems getting google photos app to look for new photos.

To be specific, I'm looking for a way to automate this button.
image

Free Up Space

image

image

On another note, what about automation for "Free up space"? Any ideas?

@master-hax
Copy link
Owner

ah i see. this is a problem i have thought about before.

there may be a way to reliably automate the touch commands using either adb shell uiautomator runtest or a combination of adb shell uiautomator dump & adb shell input tap x y

@vegedb
Copy link
Author

vegedb commented Jul 17, 2024

ah i see. this is a problem i have thought about before.

there may be a way to reliably automate the touch commands using either adb shell uiautomator runtest or a combination of adb shell uiautomator dump & adb shell input tap x y

Guess i'll try to figure out tasker for the time being.
BTW, does 32gb model (cheaper) work for this? I've only tried 128gb.
Also should we try to limit the SSD to 128gb? I see you're using 1TB, won't that flag their system?

@master-hax
Copy link
Owner

Yes, the 32gb model works fine.

Dunno about getting flagged by google. We aren't breaking any TOS afaik.

@milchalpenl
Copy link

automation for "Free up space"? Any ideas?

This is trivial. One can always do

adb shell rm -f /PATH
If you delete by adb then the cloud upload is NOT deleted. Yes, it is not deleted.

"background uploads" is unreliable and it prevents new stuff to be transferred to the SSD

What prevents? can't understand. Like the other idea in comment above I have a script that does the following:

#####delete all files older then 1 week
adb shell find /PATH* -mmin +604800  -delete

for FILENAME in `find /path  -type f -iname \*.jpeg `
do
adb push SYNTAX
adb shell am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file://FILE_PATH
done

@master-hax
Copy link
Owner

The "free up space" button provides a guarantee that the media has been successfully uploaded before being deleted.

Deleting the media manually (using rm) does not provide any such guarantees. It can & will delete media that has not been backed up.

@vegedb
Copy link
Author

vegedb commented Jul 21, 2024

automation for "Free up space"? Any ideas?

This is trivial. One can always do

adb shell rm -f /PATH If you delete by adb then the cloud upload is NOT deleted. Yes, it is not deleted.

"background uploads" is unreliable and it prevents new stuff to be transferred to the SSD

What prevents? can't understand. Like the other idea in comment above I have a script that does the following:

#####delete all files older then 1 week
adb shell find /PATH* -mmin +604800  -delete

for FILENAME in `find /path  -type f -iname \*.jpeg `
do
adb push SYNTAX
adb shell am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file://FILE_PATH
done

I have explained android.intent.action.MEDIA_SCANNER_SCAN_FILE purpose to "refresh" if your photos DO NOT appear on google photos. This is not the problem.

Main points if you got confused, Background upload do not INSTANTLY start if,

  1. Your phone gets locked/deep sleep for a LONG TIME (days) > doze problem
  2. Your Wifi/ethernet disconnects/reconnects for whatever reason
  3. Your USB power cuts off intermittently
  4. Your phone RAM decides to kick google photos out

All these points to unreliability of having it decide for you. Would love to have an option to have more control over initiating uploads.

Also like @master-hax said, you might delete stuff that's not backed up using this method.

@master-hax master-hax added the enhancement New feature or request label Aug 3, 2024
@milchalpenl
Copy link

Main points if you got confused, Background upload do not INSTANTLY start if,

Confusion? None. PS: I have even used 2TB HDD (not SSD) still it uploads reliably. Not instantly. It perhaps takes few hours and then it starts.

Your phone gets locked/deep sleep for a LONG TIME (days) > doze problem

Never experienced it

Your Wifi/ethernet disconnects/reconnects for whatever reason

Every day at 03:00 the ISP does disconnect and reconnect but no problems

Your USB power cuts off intermittently

Never

Your phone RAM decides to kick google photos out

There is nothing running except Google Photos. Why would it?

Of course, like anything YMMV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants