BUG:Google Takeout photos with duplicate or long names lose their date and location
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
backend/app/utils/takeout_sidecar.py から始め、takeout_sidecar_read が画像名と sidecar ファイルをどのように対応付けているかを追ってください。issue の再現スクリプトにある4つのファイル名のケースを使い、重複した名前と短縮された JSON 名の回帰テストを追加してください。すべてのケースで元の日付と GPS 座標が返されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 322
- フォーク
- 793
- 平均マージ
- 6日 10時間
- マージ済み PR(30日)
- 20
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AOSSIE-Org/PictoPy のほかの issue
-
bug enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
AOSSIE-Org/PictoPy#1802 · コメント 2 件 ·
メンテナーはふだん 3 日以内に返信
-
BUG: XMP metadata export permanently overwrites file modification timestamp (mtime), destroying photo dates対応中かも @swastiksharma45 が 2 日前に担当しました。 オープンbug enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
AOSSIE-Org/PictoPy#1788 · コメント 6 件 ·
メンテナーはふだん 3 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
AOSSIE-Org/PictoPy#1786 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
BUG: Semantic search sees portrait phone photos sideways (SigLIP ignores EXIF orientation)対応中かも @omkar-suryavanshi が 3 日前に担当しました。 オープンbug enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
AOSSIE-Org/PictoPy#1780 · コメント 5 件 ·
メンテナーはふだん 3 日以内に返信
-
BUG: Share password loses leading/trailing spaces so the password you set doesn't work対応中かも @ManyaJain111 が 2 日前に担当しました。 オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
AOSSIE-Org/PictoPy#1779 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
AOSSIE-Org/PictoPy の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
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"対応中かも @cestercian が今日担当しました。 オープンcomp/cli P2 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
NousResearch/hermes-agent#162259 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
upstream update
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
conan-io/conan-center-index#31597 ·
メンテナーはふだん 1 日以内に返信
-
community-request
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA-NeMo/Run#727 ·
メンテナーはふだん 1 日以内に返信
-
bot-triaged module: higher order operators module: pickle module: pt2-dispatcher oncall: pt2 triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
pytorch/pytorch#207247 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信