danielwelch / hassio-dropbox-sync

Back up your Hass.io snapshots and other local files to Dropbox
Apache License 2.0
132 stars 37 forks source link

Add option not to skip existing files #10

Open rsuplido opened 6 years ago

rsuplido commented 6 years ago

First, thanks for the add-on!

I've automated my backups to run Monday, Wednesday, Friday and name the backup files like _Snapshot.tar. Looking at the code, it seems like you are using the -s upload option to skip existing files in Dropbox. Will you be able to provide a setting to not use the -s option so it would just overwrite/update files in Dropbox?

TIA.

danielwelch commented 6 years ago

I think that's a good idea. I'll try to add an option soon.

rsuplido commented 6 years ago

Nvm. it looks like HA still uses a system generated filename and you can only change the label for that snapshot.

nmsoares commented 6 years ago

Hi @danielwelch. I too fell the "skip existing files" as an option (on/off) would be a great additional feature. Is it coming ? Fantastic job

woody4165 commented 6 years ago

Hi @danielwelch

This can be an useful option for me too.

Fantastic addon for Hassio.

Thanks

d0ugal commented 5 years ago

I was pointed to this issue to see if I could provide some input. In http://github.com/d0ugal/hassio-dropbox-upload we calculate the file hash and compare it with the one in dropbox and only re-upload the file if the hash doesn't match (i.e. the filename is the same but the contents is different).

It works fairly well, but you need to calculate the hash in a specific way so you get the same one as you get from the Dropbox API. Here is the code: https://github.com/d0ugal/hassio-dropbox-upload/blob/master/dropbox-upload/dropbox_upload/dropbox.py#L43-L52 (I found and adapted the code from an example in the docs iirc).

... but I'm not sure if this is possible at all with the dependency on the parent script. So you might just need to re-upload everything? My full snapshots are 2gb, so that would be a bit slow :smile:

danielwelch commented 5 years ago

Thanks for the input. I’m actually working on another snapshot addon that uses your code for Dropbox functionality, so I’m very familiar with the code 😄 it works great! In short, this add-on is basically just a wrapper around that script, so while we could work around it, might as well just rewrite the whole thing in python. Your add-on is great for that, and I’m hoping to have mine available soon. Still working on it and testing, haven’t had much free time lately. But, big picture, I plan to move my efforts to that addon as we keep running into the limitations of the Dropbox uploaded shell script.

d0ugal commented 5 years ago

Interesting. Sounds good. Happy to team up if I can help at all.

nmsoares commented 5 years ago

@danielwelch any news on this update/fix ?