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

Feature: Add created date into media metadata after download #16

Open
seantran6 opened this issue Feb 25, 2022 · 4 comments
Open

Feature: Add created date into media metadata after download #16

seantran6 opened this issue Feb 25, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@seantran6
Copy link

Hey, just recently installed the archiver. Works great in installing the photos in a pretty decent time as well. However after upon further examination, a lot of my photos dates are changed. I could be a complete beginner at this, so let me know if I need to do anything. Some of my recent videos are not dated back to 1969 and my photos from 2016 are dated as 2022. Thanks.

@NicholasDawson
Copy link
Owner

Okay, so the date that is on the photos when downloaded from Google is the date you uploaded them to Google Photos.

However, I do have existing functionality to add descriptive metadata to the photo.

I will take this as a feature request to embed the date the media was created/taken into the media item after download. My idea is that this will be the new default behavior.

Will keep you updated in this thread. It may be a while as I am busy will school work, but over my spring break, I will have some time.

Thank you for the feedback, it is greatly appreciated.

@NicholasDawson NicholasDawson self-assigned this Feb 25, 2022
@NicholasDawson NicholasDawson added the enhancement New feature or request label Feb 25, 2022
@NicholasDawson NicholasDawson changed the title Photo Metadata isn't saved or is jumbled Feature: Add created date into media metadata after download Feb 25, 2022
@deanthing
Copy link

Hey Nicholas, would you consider a pull request for this feature? This is a great tool and would like to be able to contribute.

@NicholasDawson
Copy link
Owner

Hey Nicholas, would you consider a pull request for this feature? This is a great tool and would like to be able to contribute.

Of course, I'd be happy to accept the PR.

Let me know if you want to work on something together, I've been too busy to add enhancements so this is a big help!

@Andi7da
Copy link

Andi7da commented Jul 27, 2024

This caused quite a mess for me too. But your program is cool anyway :).

I can't program in Python, but I found a workaround that works for me. It's not that nice, I know, it results in long file names. But it's very easy to integrate.

So I inserted some code in gparch.py "def process_media_items" (about line 287, changes marked here with "AM"):

def process_media_items(self, media_items, save_directory, album_uuid=None):
    media = []
    for item in media_items:
        # Path where the media item will be saved to
        item_path = None

        # AM added two lines
        mm = item["mediaMetadata"]
        mmctime = mm["creationTime"].replace(":","-") + "_"

        # Select the media item from the database
        # -> if it doesn't exist then generate the item_path
        # -> if it already exists then just pull the item_path from the existing db entry
        item_db_entry = self.select_media_item(item["id"])
        if not item_db_entry:
            item["filename"] = sanitize(item["filename"])
            # AM changed, original: item_path = f'{save_directory}/{item["filename"]}'
            item_path = f'{save_directory}/{mmctime + item["filename"]}'

Oh, PS: If you change the code, the data has to be downloaded again completely. I therefore recommend deleting everything in the target directory except credentials.json and photoslibrary_token.pickle. Yes, also delete database.sqlite3...
Or select first another directory for testing.
And with a new version, this will be necessary again. Unless you integrate my code again...

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

4 participants