Giter VIP home page Giter VIP logo

google-takeout-helper's Introduction

Google Takeout Helper

Install

  1. Make sure Python 3 is installed as well as pip for python 3
  2. Install ImageMagick version 7 with HEIC support.
  • uninstall default libhefi (if it's older than 1.51. If it's >= 1.5.1 you can skip building and installing libheif)
  • build and install (libheif-1.5.1)[https://github.com/ImageMagick/libheif] manually from source. This was required for me on Ubuntu to build ImageMagick 7 correctly with HEIC support.
  • sudo apt install build-essentials libheif-dev
  • Download source for ImageMagick 7
  • Uncomment all 'build-deps's in /etc/apt/sources.list
  • apt-get build-dep imagemagick
  • ./configure --with-heic
  • make
  • sudo make install
  • sudo ldconfig /usr/local/lib
  1. Install libmagickwand-dev?
  2. Install Wand: pip install Wand

Recover your photos from Google Photos

  1. Download all .zip archives for only Google Photos data. For me, selecting more than Google Photos resulted in an error. This is most likely because of the size of all of my Google data being so massive.
    • Note: It can take hours or even days for Google to generate Zip files with all your data.
  2. Run ./organize.py <directory where all your archives are>. For example: ./organize.py --photos_dir ~/Downloads/google_takeout_archives/. The script will:
    • Find all of the takeout archives in this directory
    • Extract the photos from these archives
    • Delete extra metadata files (i.e. not the images and videos)
    • Give you an option to delete the archives after to reclaim some hard drive space.
  3. (Strongly recommended) Back up your photos somewhere else. Google does a ton of work to make sure your images will never be accidentally deleted or lost. It's very unlikely you are willing/able/can afford to have the same level of reliability as Google. I'm no expert, but I've found this subreddit's wiki to be a good starting point for learning about how to back up.

Extract all attachments from the mail archive

  1. Download the .mbox archive with Gmail data
  2. Run ./organize.py --mbox_file <path to .mbox file>

google-takeout-helper's People

Contributors

treymo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

google-takeout-helper's Issues

Error from creation date string

Thanks for creating this script. It is a huge help! However I get the following error:

D:\Backups\GoogleFotosTakeoutLine301120\Takeout\GoogleFotos/1980-01-01/1988 Ferie 09.jpg
Error setting creation date from string:
time data '2007:12:28 14:31: 2' does not match format '%Y:%m:%d %H:%M:%S'
Traceback (most recent call last):
File "c:\users\emil\anaconda3\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\users\emil\anaconda3\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\Emil\anaconda3\Scripts\google-photos-takeout-helper.exe_main
.py", line 7, in
File "c:\users\emil\anaconda3\lib\site-packages\google_photos_takeout_helper_main
.py", line 356, in main
filter_fun=lambda f: (is_photo(f) or is_video(f))
File "c:\users\emil\anaconda3\lib\site-packages\google_photos_takeout_helper_main_.py", line 99, in for_all_files_recursive
for_all_files_recursive(file, file_function, folder_function, filter_fun)
File "c:\users\emil\anaconda3\lib\site-packages\google_photos_takeout_helper_main_.py", line 102, in for_all_files_recursive
file_function(dir, file)
File "c:\users\emil\anaconda3\lib\site-packages\google_photos_takeout_helper_main_.py", line 274, in fix_metadata
set_creation_date_from_exif(file)
File "c:\users\emil\anaconda3\lib\site-packages\google_photos_takeout_helper_main_.py", line 241, in set_creation_date_from_exif
set_creation_date_from_str(file, datetime_str)
File "c:\users\emil\anaconda3\lib\site-packages\google_photos_takeout_helper_main_.py", line 226, in set_creation_date_from_str
_os.utime(file, (timestamp, timestamp))
UnboundLocalError: local variable 'timestamp' referenced before assignment

I seem to get this error when the script tries to process photos that I have manually uploaded to Gphotos, rather than those uploaded by my phone automatically. I should mention that i use the --divide-to-dates tag.

Is it possible to include an ignore-errors flag that simply skips photos with incorrect date strings? Alternatively, puts the photos into a non-sorted folder?

Import mail.py and photos.py only if required

Thanks for this! Downloaded this script only to extract attachments from my mbox file. Since I was just using the mail.py utility, I didn't install the requirements for photos.py, however, I had to comment out the import photos in order for the script to run.

For people in a similar situation, it would be helpful if the program only imported dependencies required for the run. This could be done by removing the imports from the beginning of the script, and import within the methods themselves.

Removed:

import mail
import photos

Changed:

def _maybe_organize_photos_takeout(takeout_dir):
    if not takeout_dir:
        print('Invalid (or no) Photos takeout archive directory specified. Not '
              'extracting photos from archives.')
        return
    else:
        organize_photos = input('Organize Photos takeout archives? y/n: ')
        organize_photos = distutils.util.strtobool(organize_photos)
        if not organize_photos:
            return
    import photos
    photos.organize_photos_takeout(takeout_dir)


def _maybe_extract_email_attachments(mbox_file_path):
    if (mbox_file_path and os.path.isfile(mbox_file_path) and
            mbox_file_path.endswith('.mbox')):
        answer = input('Extract mailbox attachments? y/n: ')
        answer = distutils.util.strtobool(answer)
        if answer:
            import mail
            mail.extract_mail_attachments(mbox_file_path)
    else:
        print('Invalid (or no) .mbox path specified. Not extracting email '
              'attachments.')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.