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

Add handling of app deep links #27

Merged
merged 1 commit into from
Feb 17, 2025
Merged

Conversation

kennymc-c
Copy link
Contributor

This adds support for handling app deep links (https://pyatv.dev/development/apps/#app-deep-links)

While testing this I also noticed than entering a custom source parameter when there's also a source list is a little tricky in the web configurator. When you enter any text in the source field it's obstructed by the source list.

Copy link
Contributor

@zehnm zehnm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding deep link support!
The check if it's an available app or a deeplink could be beautified, but it's also ok this way.
I will merge it later if you don't want to change it.

Comment on lines +875 to +882
except KeyError:
# If app_name is not an app name handle it as app deep link url
try:
await self._atv.apps.launch_app(app_name)
except pyatv.exceptions.NotSupportedError:
_LOG.warning("[%s] Launch app is not supported", self.log_id)
except pyatv.exceptions.ProtocolError:
_LOG.warning("[%s] Launch app: protocol error", self.log_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of abusing exception handling to check if app_name exists, check if the name is in _app_list and let @async_handle_atvlib_errors take care of all exceptions:

        if app_name in self._app_list.keys():
            # Launch app by name
            await self._atv.apps.launch_app(self._app_list[app_name])
        else:
            # If app_name is not an app name handle it as app deep link url
            await self._atv.apps.launch_app(app_name)

@zehnm zehnm merged commit 402cf28 into unfoldedcircle:main Feb 17, 2025
4 checks passed
@kennymc-c kennymc-c deleted the appdeeplink branch February 17, 2025 17:52
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.

2 participants