Skip to content

Commit

Permalink
(v 1.1) Added custom edited suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
anderbggo committed Oct 9, 2022
1 parent 76c65f9 commit cd83cf5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ This algorithm is able to match this information in the image/video from the dow

1. Download your _Google Photos_ media from [Takeout](https://takeout.google.com/)

2. Download and execute [GPMatcher.exe](GPMatcher.exe)
2. Download and execute GPMatcher.exe

3. Select the folder in which images/videos along with its JSONs were downloaded ('Photos from 2022' for example)
3. [Optional] Type custom suffix used for edited photos (explained in the program)

4. Click on _Match_ button
4. Select the folder in which images/videos along with its JSONs were downloaded ('Photos from 2022' for example)

5. Matched images/videos will be on directory _Matched_ inside the same path
5. Click on _Match_ button

6. Matched images/videos will be on directory _Matched_ inside the same path

## FAQs

Expand Down
4 changes: 2 additions & 2 deletions files/auxFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@


# Function to search media associated to the JSON
def searchMedia(path, title, mediaMoved, nonEdited):
def searchMedia(path, title, mediaMoved, nonEdited, editedWord):
title = fixTitle(title)
realTitle = str(title.rsplit('.', 1)[0] + "-editado." + title.rsplit('.', 1)[1])
realTitle = str(title.rsplit('.', 1)[0] + "-" + editedWord + "." + title.rsplit('.', 1)[1])
filepath = path + "\\" + realTitle # First we check if exists an edited version of the image
if not os.path.exists(filepath):
realTitle = str(title.rsplit('.', 1)[0] + "(1)." + title.rsplit('.', 1)[1])
Expand Down
6 changes: 4 additions & 2 deletions files/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from PIL import Image
import PySimpleGUI as sg

def mainProcess(browserPath, window):
def mainProcess(browserPath, window, editedW):
piexifCodecs = [k.casefold() for k in ['TIF', 'TIFF', 'JPEG', 'JPG']]

mediaMoved = [] # array with names of all the media already matched
Expand All @@ -12,6 +12,8 @@ def mainProcess(browserPath, window):
nonEditedMediaPath = path + "\EditedRaw"
errorCounter = 0
successCounter = 0
editedWord = editedW or "editado"
print(editedWord)

try:
obj = list(os.scandir(path)) #Convert iterator into a list to sort it
Expand All @@ -35,7 +37,7 @@ def mainProcess(browserPath, window):
titleOriginal = data['title'] # Store metadata into vars

try:
title = searchMedia(path, titleOriginal, mediaMoved, nonEditedMediaPath)
title = searchMedia(path, titleOriginal, mediaMoved, nonEditedMediaPath, editedWord)

except Exception as e:
print("Error on searchMedia() with file " + titleOriginal)
Expand Down
14 changes: 12 additions & 2 deletions files/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

sg.theme("DarkTeal2")
layout = [[sg.T("")],
[sg.Text("Choose a folder: "), sg.Input(key="-IN2-", change_submits=True), sg.FolderBrowse(key="-IN-")],
[sg.Text('Enter suffix used for edited photos (optional):')],
[sg.InputText(key='-INPUT_TEXT-'), sg.ReadFormButton('Help')],
[sg.T("")],
[sg.Text("Choose a folder: ")],
[sg.Input(key="-IN2-", change_submits=True), sg.FolderBrowse(key="-IN-")],
[sg.T("")],
[sg.Button("Match")],
[sg.T("")],
Expand All @@ -17,4 +21,10 @@
if event == sg.WIN_CLOSED or event == "Exit":
break
elif event == "Match":
mainProcess(values["-IN2-"], window)
mainProcess(values["-IN2-"], window, values['-INPUT_TEXT-'])
elif event == "Help":
sg.Popup("", "Media edited with the integrated editor of google photos "
"will download both the original image 'Example.jpg' and the edited version 'Example-editado.jpg'.", "",
"The 'editado' suffix changes depending on the language (in the case of Spain it will be 'editado').","",
"If you leave this box blank default spanish suffix will be used to search for edited photos.",
"", title="Information", icon='photos.ico')

0 comments on commit cd83cf5

Please sign in to comment.