Comments (5)
GIF & Videos are not deleted because the methods that checks uploaded and local file are the same are broken:
- https://github.com/nmrshll/gphotos-uploader-cli/blob/5457068d42ff189235f1151aa557d252ce39ee77/filetypes/video.go#L10
- https://github.com/nmrshll/gphotos-uploader-cli/blob/5457068d42ff189235f1151aa557d252ce39ee77/filetypes/gif.go#L10
from gphotos-uploader-cli.
Trying to fix this bug I've realised that it's very difficult and expensive that to files are the same before deleting the local one. The original code was doing different things depending the media type: gif, video and image
- For image files: First the image is downloaded from Google Photos 🗑️ (this could take a bit, depending the size of the image, a lot of bandwidth is wasted), then average hash of the image is calculated (convert it in greyscale, resize it in 9x8 and calculate the average, a lot of CPU is wasted) and last the local hash and the remote hash, calculated previously, is compared using a hamming function. It's only working for JPEG or PNG formats.
- For gif files: Again, the image is downloaded from Google Photos 🗑️ (same problem as above) then a hash, a non-cryptological one, is calculated (a lot of CPU is wasted) and compared.
- For video files: The code is broken. It has been copied from GIF files so it's not working. 🤦♂️
One alternative came to my mind to simplify and fix the problem 💡 :
Compare hashes of the downloaded file and the local one. I don't like to download the image 🗑️, it seems a lot of time/bandwidth wasted (let's imagine to do the same for videos).
But unfortunately the hash of the downloaded file is different from the local one 😮, this is due to Google Photos metadata, EXIF stripping, image & video processing... So this alternative is not doable 😞
A less secure, but acceptable IMO way to check the file was properly uploaded could be rely on the Google Photos response. If Google says that the item was properly uploaded, we would remove it from local storage.
And I'm thinking 🤔 if this deleteAfterUpload
is an option that people are using a lot. Are you using it? What do you think about my last alternative?
NOTE: I'm going to disable this option because it's not complete and it's broken for several formats, as I mentioned above.
from gphotos-uploader-cli.
Just discovered your tool (very useful for my use case) and would need to use this 'deleteAfterUpload' feature.
The option you propose (rely on the api result) looks ok to me. I don't see a reason to not trust the Google APIs :-)
from gphotos-uploader-cli.
I want to use it, please rely on google's API response.
from gphotos-uploader-cli.
I'm returning from holidays, and this is gonna be my first issue to work on...
from gphotos-uploader-cli.
Related Issues (20)
- What is the best way to update to the latest version? HOT 2
- Upload Errors Occur Intermittently HOT 6
- sort conents of folder HOT 2
- Several SecretBackendTypes not working for MacOS HOT 2
- Unable to run latest version HOT 5
- Add option to specify web port for authentication HOT 1
- Photos "uploaded" but not showing up in google photos HOT 1
- Add a cli switch to specify the name of the album HOT 1
- Run headless by making it load from created credential json file HOT 8
- Uploads are showing date of upload as filename. HOT 5
- allow custom RedirectURLHostname HOT 2
- didn't find all files, please add ability to load file paths from txt. HOT 6
- Show Google Photos API error description to make easier the troubleshooting HOT 9
- Abort upload if v3 directories are found
- 4.2.0 doesn't show version HOT 2
- "option CreateAlbums is invalid, '⏎" on fresh installation HOT 2
- Error message for expired token could be clearer
- Missing steps in OAuth setup / authentication
- Pre resize/encode video to lower resolution and quality before upload HOT 2
- After upgrading from 3.5.2 to 4.5.0 it does not detect already uploaded images HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gphotos-uploader-cli.