BUG:Google Takeout photos with duplicate or long names lose their date and location
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 85/100
Direzione di ricerca
Inizia da backend/app/utils/takeout_sidecar.py e segui il modo in cui takeout_sidecar_read associa i nomi delle immagini ai file sidecar. Usa i quattro casi di nomi di file nello script di riproduzione dell’issue per aggiungere test di regressione per i nomi duplicati e i nomi JSON abbreviati. Il lavoro è concluso quando tutti i casi restituiscono la data originale e le coordinate GPS.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I noticed that PictoPy fails to read the JSON metadata for some photos imported from Google Takeout.
This happens mainly when a photo has a duplicate name or a long filename.
For example, when Google Takeout renames a duplicate photo, the names can look like this:
Photo: IMG_0002(1).jpg
JSON: IMG_0002.jpg(1).json
Another format is:
Photo: IMG_0003(1).jpg
JSON: IMG_0003.jpg.supplemental-metadata(1).json
The same problem happens with long filenames because Google Takeout can shorten the JSON filename.
PictoPy currently looks for a JSON filename starting with the full image name, so it misses these files.
As a result, the photo's original date and GPS location are not read correctly.
Where the problem is
In backend/app/utils/takeout_sidecar.py:
directory, basename = os.path.split(image_path)
prefix = basename + "."
for name in _sidecar_names(directory or "."):
if not name.startswith(prefix):
continue
The comment above this code mentions handling .supplemental-metadata(1).json, but the check still fails when the image itself has (1) in its filename.
Steps to reproduce
Save this as takeout_names.py:
import json, os, sys, tempfile
sys.path.insert(0, sys.argv[1])
from app.utils.takeout_sidecar import takeout_sidecar_read
d = tempfile.mkdtemp()
def make(image, sidecar, ts):
open(os.path.join(d, image), "wb").close()
with open(os.path.join(d, sidecar), "w") as f:
json.dump({
"title": image,
"photoTakenTime": {"timestamp": str(ts)},
"geoData": {
"latitude": 48.85,
"longitude": 2.35
}
}, f)
long_name = "PXL_20230615_101010123.PORTRAIT.ORIGINAL_long_name.jpg"
cases = [
("normal", "IMG_0001.jpg",
"IMG_0001.jpg.supplemental-metadata.json", 1600000000),
("duplicate, old style", "IMG_0002(1).jpg",
"IMG_0002.jpg(1).json", 1600000100),
("duplicate, new style", "IMG_0003(1).jpg",
"IMG_0003.jpg.supplemental-metadata(1).json", 1600000200),
("long name, truncated", long_name,
long_name[:46] + ".json", 1600000300),
]
for label, image, sidecar, ts in cases:
make(image, sidecar, ts)
for label, image, sidecar, ts in cases:
print(f"{label:22} -> {takeout_sidecar_read(os.path.join(d, image))}")
Run it using:
python takeout_names.py /path/to/PictoPy/backend
Output
normal -> ('2020:09:13 17:56:40', 48.85, 2.35)
duplicate, old style -> (None, None, None)
duplicate, new style -> (None, None, None)
long name, truncated -> (None, None, None)
The normal filename works, but the other three fail to return the date and location.
Expected behavior
PictoPy should be able to find these JSON files even when Google Takeout changes or shortens their names.
I also found that GooglePhotosTakeoutHelper handles similar naming cases.
I'd like to work on this issue and add tests for it if the maintainers agree.
- Lingua principale
- Python
- Stelle
- 322
- Fork
- 793
- Merge medio
- 6g 10h
- PR unite (30g)
- 20
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di AOSSIE-Org/PictoPy
-
bug enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
AOSSIE-Org/PictoPy#1802 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
BUG: XMP metadata export permanently overwrites file modification timestamp (mtime), destroying photo datesForse già presa @swastiksharma45 l’ha presa 2 giorni fa. Apertabug enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AOSSIE-Org/PictoPy#1788 · 6 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
AOSSIE-Org/PictoPy#1786 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
BUG: Semantic search sees portrait phone photos sideways (SigLIP ignores EXIF orientation)Forse già presa @omkar-suryavanshi l’ha presa 3 giorni fa. Apertabug enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AOSSIE-Org/PictoPy#1780 · 5 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
BUG: Share password loses leading/trailing spaces so the password you set doesn't workForse già presa @ManyaJain111 l’ha presa 2 giorni fa. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
AOSSIE-Org/PictoPy#1779 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di AOSSIE-Org/PictoPy
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
hermes hooks doctor smoke test never checks the hook exit code — a crashing hook (exit=1) renders ✓ "ran clean" and "All shell hooks look healthy"Forse già presa @cestercian l’ha presa oggi. Apertacomp/cli P2 type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
NousResearch/hermes-agent#162259 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[request] gRpc/1.86.0Apertaupstream update
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
conan-io/conan-center-index#31597 ·
I maintainer di solito rispondono entro 1 giorno
-
community-request
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NVIDIA-NeMo/Run#727 ·
I maintainer di solito rispondono entro 1 giorno
-
bot-triaged module: higher order operators module: pickle module: pt2-dispatcher oncall: pt2 triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
pytorch/pytorch#207247 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno