LukeHagar / plex-api-spec

An open source Plex Media Server API Specification
MIT License
37 stars 11 forks source link

fix: Add additional titles and indexes to item metadata #69

Closed dstaley closed 1 week ago

dstaley commented 1 week ago

This PR adds support for the grandparentTitle, parentTitle, originalTitle, index, and parentIndex item metadata fields. The example is from a non-hierarchical library, so adding example values wouldn't match the existing example data.

Example:

{
  "MediaContainer": {
    "size": 1,
    "allowSync": true,
    "identifier": "com.plexapp.plugins.library",
    "librarySectionID": 4,
    "librarySectionTitle": "Music",
    "librarySectionUUID": "3c088ca3-5a22-4ab0-a5f6-96172580433e",
    "mediaTagPrefix": "/system/bundle/media/flags/",
    "mediaTagVersion": 1730230381,
    "Metadata": [
      {
        "ratingKey": "3013",
        "key": "/library/metadata/3013",
        "parentRatingKey": "3008",
        "grandparentRatingKey": "3007",
        "guid": "plex://track/5d0802d7403c640290f88cb3",
        "parentGuid": "plex://album/5d07cbed403c640290e32974",
        "grandparentGuid": "plex://artist/5d07bcb4403c64029053da80",
        "parentStudio": "Atlantic",
        "type": "track",
        "title": "Screwed",
        "grandparentKey": "/library/metadata/3007",
        "parentKey": "/library/metadata/3008",
        "librarySectionTitle": "Music",
        "librarySectionID": 4,
        "librarySectionKey": "/library/sections/4",
+       "grandparentTitle": "Janelle Monáe",
+       "parentTitle": "Dirty Computer",
+       "originalTitle": "Janelle Monáe ft. Zoë Kravitz",
        "summary": "",
+       "index": 5,
+       "parentIndex": 1,
        "ratingCount": 8623,
        "viewCount": 33,
        "lastViewedAt": 1702820467,
        "parentYear": 2018,
        "thumb": "/library/metadata/3008/thumb/1717555188",
        "art": "/library/metadata/3007/art/1731300415",
        "parentThumb": "/library/metadata/3008/thumb/1717555188",
        "grandparentThumb": "/library/metadata/3007/thumb/1731300415",
        "grandparentArt": "/library/metadata/3007/art/1731300415",
        "duration": 302491,
        "addedAt": 1525097811,
        "updatedAt": 1731300416,
        "musicAnalysisVersion": "1",
        "Media": [
          {
            "id": 5019,
            "duration": 302491,
            "bitrate": 1650,
            "audioChannels": 2,
            "audioCodec": "flac",
            "container": "flac",
            "hasVoiceActivity": false,
            "Part": [
              {
                "accessible": true,
                "exists": true,
                "id": 8862,
                "key": "/library/parts/8862/1641607904/file.flac",
                "duration": 302491,
                "file": "/media/Music/Janelle Monáe/Dirty Computer/05. Screwed.flac",
                "size": 62930454,
                "container": "flac",
                "hasThumbnail": "1",
                "Stream": [
                  {
                    "id": 17528,
                    "streamType": 2,
                    "selected": true,
                    "codec": "flac",
                    "index": 0,
                    "channels": 2,
                    "bitrate": 1650,
                    "albumGain": "-9.13",
                    "albumPeak": "1.000000",
                    "albumRange": "8.868684",
                    "audioChannelLayout": "stereo",
                    "bitDepth": 24,
                    "gain": "-9.13",
                    "loudness": "-8.87",
                    "lra": "5.80",
                    "peak": "0.993688",
                    "samplingRate": 44100,
                    "displayTitle": "FLAC (Stereo)",
                    "extendedDisplayTitle": "FLAC (Stereo)"
                  },
                  {
                    "id": 71824,
                    "key": "/library/streams/71824",
                    "streamType": 4,
                    "codec": "lrc",
                    "format": "lrc",
                    "minLines": "3",
                    "provider": "com.plexapp.agents.lyricfind",
                    "timed": "1",
                    "displayTitle": "LRC",
                    "extendedDisplayTitle": "LRC (External)"
                  }
                ]
              }
            ]
          }
        ],
        "Image": [
          {
            "alt": "Screwed",
            "type": "coverPoster",
            "url": "/library/metadata/3008/thumb/1717555188"
          },
          {
            "alt": "Screwed",
            "type": "background",
            "url": "/library/metadata/3007/art/1731300415"
          }
        ],
        "Genre": [
          {
            "id": 24810,
            "filter": "genre=24810",
            "tag": "R&b"
          }
        ],
        "Guid": [
          {
            "id": "mbid://f1f18c39-135b-42f9-a019-29663f5e1e4c"
          }
        ]
      }
    ]
  }
}

Summary by CodeRabbit

coderabbitai[bot] commented 1 week ago

[!CAUTION]

Review failed

The pull request is closed.

📝 Walkthrough
📝 Walkthrough ## Walkthrough The recent modifications pertain to the OpenAPI specification for the `get-meta-data-by-rating-key` endpoint. Notably, five new properties—`grandparentTitle`, `parentTitle`, `originalTitle`, `index`, and `parentIndex`—have been added to the `Metadata` object in the response schema. Each of these properties is defined as either string or integer types, thereby enriching the metadata provided for library items without altering the existing structure or definitions. ## Changes | File Path | Change Summary | |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------| | src/paths/library/metadata/[ratingKey]/get-meta-data-by-rating-key.yaml | Added properties: `grandparentTitle: string`, `parentTitle: string`, `originalTitle: string`, `index: integer`, and `parentIndex: integer` to the response schema for `get-meta-data-by-rating-key`. | ## Sequence Diagram(s) ```mermaid sequenceDiagram participant Client participant API participant MetadataService Client->>API: Request metadata by rating key API->>MetadataService: Fetch metadata MetadataService-->>API: Return metadata (with new titles) API-->>Client: Send metadata response (includes grandparentTitle, parentTitle, originalTitle, index, parentIndex) ``` > 🎩 In the library's grand hall, metadata does swell, > With titles of lineage, it tells quite the tale. > Grandparent, parent, and original too, > A richer response, now splendid and true! > So raise a toast to the data we glean, > For knowledge and context, a most noble scene! 🍷

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
JasonLandbridge commented 1 week ago

Thank you for the contribution!