Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add iTunes Store Identifier to metadata #2478

Merged
merged 2 commits into from
Nov 2, 2024

Conversation

JarekToro
Copy link
Contributor

@JarekToro JarekToro commented Aug 12, 2024

This is a re pull request of #2439 . When I rebased onto Ralph the PR closed. And I couldn't reopen 🤷‍♂️

Sorry I didn't get this in before Ralph. It crazy how life can sometimes make running ./scripts/chickn.py -t fixup more difficult then it needs to be. No rush on when this gets in. Thank you.

Hopefully I rebased without issue.

Original PR description

  • Added iTunesStoreIdentifier to FeatureName in pyatv/const.py.
  • Updated Playing class in pyatv/interface.py to include itunes_store_identifier.
  • Enhanced the metadata_field function in pyatv/protocols/mrp/__init__.py to support itunes_store_identifier.
  • Adjusted fake device implementation in tests/fake_device/mrp.py to handle itunes_store_identifier.
  • Updated functional tests in tests/protocols/mrp/test_mrp_functional.py to verify itunes_store_identifier.
  • Modified documentation to include itunes_store_identifier.

Honestly first time really working in a mature python codebase so hopefully this checks all the boxes. I tried to follow the guidelines. But am leaning on this portion of the MD file lol

PRs will not be merged unless all criterias are met. If you are unsure about anything, just push a PR and ask for help in the PR itself 😄

The tool Im building was really hinging on the ability to identify the content from the Apple TV App, but seemed like they only supplied the Title (which was just the series name if it was a tv show, not even the episode name. You would think apple would be better at implementing their own interfaces but I digress 😆) . But with some debugging I saw that iTunesStoreIdentifier was typically available for the Apple TV App so I exposed that the the Playing interface.
Im currently using a local version with these changes for what im building but wanted to at least submit a PR if it proved useful for someone else.

- Added `iTunesStoreIdentifier` to `FeatureName` in `pyatv/const.py`.
- Updated `Playing` class in `pyatv/interface.py` to include `itunes_store_identifier`.
- Enhanced the `metadata_field` function in `pyatv/protocols/mrp/__init__.py` to support `itunes_store_identifier`.
- Adjusted fake device implementation in `tests/fake_device/mrp.py` to handle `itunes_store_identifier`.
- Updated functional tests in `tests/protocols/mrp/test_mrp_functional.py` to verify `itunes_store_identifier`.
- Modified documentation to include `itunes_store_identifier`.
@thiccaxe
Copy link
Contributor

iTunesStoreIdentifier is also available in tvos18 under the new "NowPlayingInfo" (see here #2461 (comment))

In there, it is technically a string-wrapped number, with the unknown/error state being "0'. Do you know if the store identifier is always a number?

@JarekToro
Copy link
Contributor Author

I believe so.

https://developer.apple.com/documentation/storekit/skstoreproductparameteritunesitemidentifier

The value for this key, an iTunes item identifier, is an instance of NSNumber.
To find a product’s iTunes identifier, go to linkmaker.itunes.apple.com and search for the product, then locate the iTunes identifier in the link URL. For example, the iTunes identifier for the iBooks app is 364709193.

@postlund
Copy link
Owner

postlund commented Nov 2, 2024

I believe so.

https://developer.apple.com/documentation/storekit/skstoreproductparameteritunesitemidentifier

The value for this key, an iTunes item identifier, is an instance of NSNumber.
To find a product’s iTunes identifier, go to linkmaker.itunes.apple.com and search for the product, then locate the iTunes identifier in the link URL. For example, the iTunes identifier for the iBooks app is 364709193.

Can confirm just based on the protobuf definitions:

optional int64 iTunesStoreIdentifier = 54;

@postlund
Copy link
Owner

postlund commented Nov 2, 2024

Looks good to me, will merge once the checks passes 👍

@postlund postlund merged commit 5f0515e into postlund:master Nov 2, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants