gl636474 / google-photos-sync-mac

Downloads new photos from Google Photos and imports them into OS X Photos application
6 stars 0 forks source link

Refactor required #7

Open gl636474 opened 4 years ago

gl636474 commented 4 years ago
  1. Need to make code more object oriented:
    1. Create user class:
      • Contain cache dir names
      • Manage Google tokens
      • Possibly also manage/give access to the cache dir structure
    2. Centralised logging (use existing library?):
      • Enforce flush
      • Add timestamp?
      • handle verbosity more easily (e.g. have log(), log_verbose() and log_debug() which take the verbosity level to determine if they should output)
    3. Better separation of concerns
    4. Less global config and more config closer to where it is used
  2. Cache the downloaded index in case killed/restarted whilst downloading photos. Also cache the return from Photos library query and the results of determining what files need to be downloaded.
  3. Don't download if file already in cache
  4. Manage cache so we can pick up where we left off after killed/restarted
  5. More threads and better thread management?
  6. Make args global? Pass it around everywhere? Or explicitly pass the required bits through to functions?
  7. Any long-duration calls must be refactored so that the shell/GUI can update a progress meter/bar (e.g.
gl636474 commented 4 years ago

Have a class hierarchy for querying Photos libraries and factory method (in superclass?) to determine type of library and instantiate correct subclass.

gl636474 commented 4 years ago

If concurrent downloads for different users - log file will need to indicate the username for user-specific stuff (downloads/imports)