Page 1 of 2
Backup Flows To Google Drive Only If Modified
Posted: 31 Jan 2018 03:42
by jjts
Hi all,
I'm new at Automagic so bear with me! I liked the default backup flow that comes with Automagic but wanted to backup daily and to the cloud. Then I got to thinking, it is silly to backup every day if nothing's changed, so I modified the default backup script and came up with this:
Edit - new link to working file:
http://automagic4android.com/flow.php?i ... 1ed3d4e12e
Here's what it does:
- copies the existing current backup file to old
- copies the current hash, if it exists, to old hash
- backs up current widgets and flows to a file
- reads both current and old widget files into memory
- hashes the two files if necessary and compares the hashes
- if the hashes don't match, there was a change to the file, so it uploads the current flow backup xml to a timestamped version on the server
Usage:
If you want to use this, you'll need to do a couple things:
1) create 2 blank files, /storage/emulated/0/flows_widgets_backup-CURRENT.xml and /storage/emulated/0/flows_widgets_backup-OLD.xml (I used the Terminus app with the touch command)
2) change the Google account in the last step of the flow to your own
Please let me know of any feedback or if anything could be improved. I know I should create the empty files if they don't exist, and I may just do that with with an updated version.
Re: Backup Flows To Google Drive Only If Modified
Posted: 04 Feb 2018 20:21
by DRAGO
Kann ich nicht importieren."Datei ist ungültig"
Re: Backup Flows To Google Drive Only If Modified
Posted: 06 Feb 2018 03:51
by karthikn130
Automagic says "Could not import flows. This file is not valid." So kindly reupload the flow or upload screenshot of the flow.
Thanks.
Re: Backup Flows To Google Drive Only If Modified
Posted: 06 Feb 2018 06:46
by Desmanto
It seems he edited the xml manually before sharing. I check the xml is properly formatted in automagic format. Open using hex editor, there is no inproper BOM. Turns out to be the email part, where he replace his email with <MYUSERNAME>@gmail.com. <> are illegal characters in email address. Worse is it is properly enclosed, making it to be viewed as a valid xml tag, but not closed properly. Well, even it is closed properly using </MYUSERNAME>, it will still corrupt when imported.
So meanwhile it hasn't been fixed, you can fix it by yourself by using any text editor.
1. Open the flow.xml using any text editor, I just use MiXplorer Text editor
2. Find for
<MYUSERNAME>@gmail.com. (it is at line 52 if using MiXplorer).
3. Remove the less-than and greater-than sign, leaving it :
MYUSERNAME@gmail.com
4. Save the file and import it again. It should import properly now.
This is the SS of the flow.
- Screenshot_2018-02-06-13-40-06_Half_Clean.png (88.7 KiB) Viewed 26428 times
Re: Backup Flows To Google Drive Only If Modified
Posted: 06 Feb 2018 18:24
by karthikn130
Thank you for your reply. It worked as expected and Thanks for your time.
Re: Backup Flows To Google Drive Only If Modified
Posted: 07 Feb 2018 04:28
by jjts
Desmanto wrote:It seems he edited the xml manually before sharing. I check the xml is properly formatted in automagic format. Open using hex editor, there is no inproper BOM. Turns out to be the email part, where he replace his email with <MYUSERNAME>@gmail.com. <> are illegal characters in email address. Worse is it is properly enclosed, making it to be viewed as a valid xml tag, but not closed properly. Well, even it is closed properly using </MYUSERNAME>, it will still corrupt when imported.
My apologies, yes, I had edited out my email address for privacy. Link in the original post is fixed now.
Re: Backup Flows To Google Drive Only If Modified
Posted: 07 Dec 2018 12:34
by yxd0018
Does your Google drive upload still work? I have error with correct Gmail account and various paths:
07.12.2018 07:24:59.274 [Manual Test] End executing action 'Google Drive Upload Files: /storage/emulated/0/flows_widgets_backup-CURRENT.xml to /backups' and exception Unknown
07.12.2018 07:24:59.326 [Manual Test] Flow ends execution due to errors
07.12.2018 07:24:59.326 [Manual Test] Error:
ch.gridvision.ppam.androidautomagiclib.util.m: Unknown
at ch.gridvision.ppam.androidautomagic.model.a.bh$1.b(SourceFile:382)
at ch.gridvision.ppam.androidautomagiclib.util.ci$1$1.run(SourceFile:52)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6623)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: com.google.android.gms.auth.GoogleAuthException: Unknown
at com.google.android.gms.auth.zzh.zze(Unknown Source:132)
at com.google.android.gms.auth.zzg.zzd(Unknown Source:21)
at com.google.android.gms.auth.zzg.zze(Unknown Source:77)
at com.google.android.gms.auth.zzg.getToken(Unknown Source:3)
at com.google.android.gms.auth.zzg.getToken(Unknown Source:5)
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source:0)
at ch.gridvision.ppam.androidautomagic.util.a.a.<init>(SourceFile:76)
at ch.gridvision.ppam.androidautomagic.model.a.bh$1.a(SourceFile:199)
at ch.gridvision.ppam.androidautomagic.model.a.bh$1.c(SourceFile:174)
at ch.gridvision.ppam.androidautomagiclib.util.ci$1.run(SourceFile:40)
at java.lang.Thread.run(Thread.java:764)
Re: Backup Flows To Google Drive Only If Modified
Posted: 07 Dec 2018 14:30
by anuraag
Looks like Automagic don't have permission to your google drive.
Try opening action "upload to google drive" and verify account access.
Re: Backup Flows To Google Drive Only If Modified
Posted: 07 Dec 2018 20:40
by yxd0018
I chose Google account without seeing any permission popup. But I get Google drive access error. Could be my automatic 2017 version old?
Re: Backup Flows To Google Drive Only If Modified
Posted: 07 Dec 2018 23:06
by anuraag
Why are you using old version?