编程设置Google照片标题

发布于 2025-02-08 07:16:41 字数 1483 浏览 0 评论 0原文

我们有很多我想在Google照片中放置的照片,我希望它们都有各自的字幕。根据字幕,我的意思是在桌面网络上查看Google照片时,在滑出信息(i)侧边栏中的上限输入。通过标题,我的意思是,当您关闭信息侧栏时,您会在您翻转它们时覆盖图像时覆盖的白色文本。字幕是从大型Flickr下载中的JSON文件中的字幕,但这不是挑战所在。这是我们尝试的:

  1. 在手动上传之前,将各个字段写入.jpgs本身(使用Exiftool)的Exif。我发誓这几年前曾经工作过。但是现在,我只在信息栏中的“其他”字段中看到描述,而不是字幕。有趣的是,我什至不记得这个领域。
  2. 从一个更新一个媒体) Google Apps脚本在手动上传Exif标签的.jpg之后,以从“其他”字段的预先存在的照片中摘下数据,并尝试使用该值来设置“描述”字段。 (我很惊讶地看到我在桌面网上看到的东西是其他已经是API中所示的描述!)值得一试,但这是不允许的,因为引用参考链接,项目必须由开发人员通过API创建。”好的,很好,我明白了,所以我去了一次旅行...
  3. 如果必须手动,我可以手动!我开始编码一些JavaScript,以在浏览器的开发人员控制台中运行,该操作员会找到另一个Div,获取文本,将文本插入标题字段,然后找到下一个按钮并向其发送单击事件。一切都奏效了,我什至在标题字段中看到了我的文本,但是当我切换到下一个图像时,它不会保存!从来没有想到了,但我想我对Google的防盗态度并没有生气。回到正轨...
  4. 考虑文档中的报价,我决定处理实际上进行API上传,然后一口气设置描述。我在Windows上使用了PowerShell,主要是因为该脚本要做的大部分工作都是在我的文件系统上。我创建了专辑,上传文件,并成功地创建了MediaItems,确保将描述字段设置为我想要的内容,并且...这些描述仍然像其他一样!

我们对所有这些都不感到兴奋。我开始认为另一个字段是“除了键盘上的手指以外的任何其他描述。”我们如何用代码设置标题?!?!?!?!?!?!?!?

我不想要的:

我想要什么: 确实要“”

We have a big batch of photos that I want to put in Google Photos and I want them to all have their respective captions. By caption I mean that upper-right input in the slide-out Info (i) sidebar when viewing Google Photos on desktop web. By caption I also mean that white text that overlays images as you flip through them when the Info sidebar is closed. The captions are in json files from a big Flickr download, but that's not where the challenge lies. Here's what we've tried:

  1. Written various fields into the EXIF of the .jpgs themselves (using exiftool) before manual upload. I swear this used to work a couple of years ago. But now I only see the description in the "Other" field in the Info bar, not captions. Funny, I don't even remember this field from before.
  2. Used Google Photos API for updating a mediaItem from a Google Apps Script, after manually uploading EXIF-tagged .jpgs, to pluck the data in pre-existing photos from the "Other" field and tried to set the "description" field using that value. (I was surprised to see that what I was seeing in when viewed on desktop web as Other was already the description as seen in the API!) Worth a shot, but this was not allowed, because, quoting the reference link, "The media item must have been created by the developer via the API." Okay, fine, I got this, so I took a side trip...
  3. If it's got to be manual, I can do manual! I started coding some Javascript to run in the browser's developer console that would find the Other div, get the text, insert that text into the caption field, then find the Next button and send a click event to it. Everything worked, I even saw my text in the caption field but it would not save! when I switched to the next image like it does when you actually click it with a mouse. Never figured it out but I guess I'm not mad at Google for being hack-proof. Back on track...
  4. Thinking about that quote from the docs, I decided to tackle actually doing an API upload and set the description all in one go. I used Powershell on Windows, mostly because most of the work this script had to do was on my file system. I created Albums, uploaded files, and created mediaItems successfully, making sure to set the description field to what I wanted it to be and ... these descriptions still showed up as Other!

We're not excited about retyping all these. I'm beginning to think the Other field is "any description defined by anything other than fingers on your keyboard." How do we set the caption with code?!?!?!?!!?!?!?

What I don't want:
What I don't want

What I do want:
What I do want

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不念旧人 2025-02-15 07:16:41

我成功地在这里使用tanaike-san的图书馆设置了媒体项目的描述: https://github.com/github.com/tanaikech/ gphotoapp
我在项目列表中添加了“描述”:

    const resource = {
    albumId: albumId,
    albumPosition: {
      "properties": {
        "position": {
          "enum": [
            "FIRST_IN_ALBUM",
          ]}}},
    items: [
      {
        blob: DriveApp.getFileById(fileId).getBlob(),
        description: descrip,      <---- "your text goes here"
        filename: filname,
      },
      {
        blob: UrlFetchApp.fetch(url).getBlob(),
        description: descrip,      <---- "your text goes here"
        filename: filname,
      },
    ],
  };

I have had success setting the media item's description using Tanaike-san's library here: https://github.com/tanaikech/GPhotoApp
I added "description" to the items list:

    const resource = {
    albumId: albumId,
    albumPosition: {
      "properties": {
        "position": {
          "enum": [
            "FIRST_IN_ALBUM",
          ]}}},
    items: [
      {
        blob: DriveApp.getFileById(fileId).getBlob(),
        description: descrip,      <---- "your text goes here"
        filename: filname,
      },
      {
        blob: UrlFetchApp.fetch(url).getBlob(),
        description: descrip,      <---- "your text goes here"
        filename: filname,
      },
    ],
  };
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文