@bharper/atv-js 0.2.6 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +89 -9
- package/dist/index.js.map +1 -1
- package/dist/mdns.d.ts.map +1 -1
- package/dist/mdns.js +96 -11
- package/dist/mdns.js.map +1 -1
- package/examples/print-device-json.js +22 -0
- package/package.json +2 -3
- package/pyatv/.codecov.yml +38 -0
- package/pyatv/.github/FUNDING.yml +3 -0
- package/pyatv/.github/ISSUE_TEMPLATE/bug_report.yml +80 -0
- package/pyatv/.github/ISSUE_TEMPLATE/config.yml +1 -0
- package/pyatv/.github/ISSUE_TEMPLATE/feature_request.yml +22 -0
- package/pyatv/.github/ISSUE_TEMPLATE/implementation-proposal.yml +29 -0
- package/pyatv/.github/ISSUE_TEMPLATE/investigation.yml +16 -0
- package/pyatv/.github/ISSUE_TEMPLATE/minor-change.yml +10 -0
- package/pyatv/.github/ISSUE_TEMPLATE/question-or-idea.yml +11 -0
- package/pyatv/.github/dependabot.yml +26 -0
- package/pyatv/.github/workflows/codeql-analysis.yml +71 -0
- package/pyatv/.github/workflows/release.yml +160 -0
- package/pyatv/.github/workflows/tests.yml +104 -0
- package/pyatv/.gitpod.yml +23 -0
- package/pyatv/CHANGES.md +3708 -0
- package/pyatv/CODE_OF_CONDUCT.md +76 -0
- package/pyatv/CONTRIBUTING.md +72 -0
- package/pyatv/CONTRIBUTORS.md +3 -0
- package/pyatv/Dockerfile +15 -0
- package/pyatv/LICENSE.md +9 -0
- package/pyatv/MANIFEST.in +14 -0
- package/pyatv/README.md +111 -0
- package/pyatv/base_versions.txt +13 -0
- package/pyatv/chickn.yaml +75 -0
- package/pyatv/docs/404.html +24 -0
- package/pyatv/docs/CNAME +1 -0
- package/pyatv/docs/Gemfile +31 -0
- package/pyatv/docs/_config.yml +121 -0
- package/pyatv/docs/_includes/api +10 -0
- package/pyatv/docs/_includes/atvremote_scan +32 -0
- package/pyatv/docs/_includes/code +6 -0
- package/pyatv/docs/_includes/issue +14 -0
- package/pyatv/docs/_includes/pypi +5 -0
- package/pyatv/docs/_layouts/template.html +109 -0
- package/pyatv/docs/api/pyatv.conf.html +312 -0
- package/pyatv/docs/api/pyatv.const.html +974 -0
- package/pyatv/docs/api/pyatv.convert.html +106 -0
- package/pyatv/docs/api/pyatv.exceptions.html +489 -0
- package/pyatv/docs/api/pyatv.helpers.html +102 -0
- package/pyatv/docs/api/pyatv.html +120 -0
- package/pyatv/docs/api/pyatv.interface.html +2369 -0
- package/pyatv/docs/api/pyatv.settings.html +484 -0
- package/pyatv/docs/api/pyatv.storage.file_storage.html +102 -0
- package/pyatv/docs/api/pyatv.storage.html +186 -0
- package/pyatv/docs/api/pyatv.storage.memory_storage.html +83 -0
- package/pyatv/docs/assets/css/custom.css +19 -0
- package/pyatv/docs/assets/css/hljs.css +1 -0
- package/pyatv/docs/assets/css/normalize.css +349 -0
- package/pyatv/docs/assets/css/pdoc.css +287 -0
- package/pyatv/docs/assets/css/sanitize.css +566 -0
- package/pyatv/docs/assets/css/style.scss +9 -0
- package/pyatv/docs/assets/img/logo.svg +63 -0
- package/pyatv/docs/assets/js/highlight.9.12.0.min.js +3 -0
- package/pyatv/docs/assets/js/mermaid.8.9.2.min.js +32 -0
- package/pyatv/docs/assets/js/mermaid.min.js.map +1 -0
- package/pyatv/docs/development/apps.md +81 -0
- package/pyatv/docs/development/audio.md +42 -0
- package/pyatv/docs/development/control.md +56 -0
- package/pyatv/docs/development/development.md +15 -0
- package/pyatv/docs/development/device_info.md +36 -0
- package/pyatv/docs/development/examples.md +44 -0
- package/pyatv/docs/development/features.md +70 -0
- package/pyatv/docs/development/keyboard.md +51 -0
- package/pyatv/docs/development/listeners.md +144 -0
- package/pyatv/docs/development/logging.md +55 -0
- package/pyatv/docs/development/metadata.md +115 -0
- package/pyatv/docs/development/power_management.md +53 -0
- package/pyatv/docs/development/scan_pair_and_connect.md +331 -0
- package/pyatv/docs/development/services.md +9 -0
- package/pyatv/docs/development/storage.md +259 -0
- package/pyatv/docs/development/stream.md +241 -0
- package/pyatv/docs/development/testing.md +9 -0
- package/pyatv/docs/documentation/atvlog.md +64 -0
- package/pyatv/docs/documentation/atvproxy.md +244 -0
- package/pyatv/docs/documentation/atvremote.md +639 -0
- package/pyatv/docs/documentation/atvscript.md +275 -0
- package/pyatv/docs/documentation/concepts.md +168 -0
- package/pyatv/docs/documentation/documentation.md +130 -0
- package/pyatv/docs/documentation/getting_started.md +248 -0
- package/pyatv/docs/documentation/protocols.md +1959 -0
- package/pyatv/docs/documentation/supported_features.md +246 -0
- package/pyatv/docs/documentation/tutorial.md +1062 -0
- package/pyatv/docs/documentation/workspace.code-workspace +7 -0
- package/pyatv/docs/favicon.ico +0 -0
- package/pyatv/docs/index.md +109 -0
- package/pyatv/docs/internals/design.md +354 -0
- package/pyatv/docs/internals/documentation.md +84 -0
- package/pyatv/docs/internals/interfaces.md +95 -0
- package/pyatv/docs/internals/internals.md +157 -0
- package/pyatv/docs/internals/submit_pr.md +56 -0
- package/pyatv/docs/internals/testing.md +176 -0
- package/pyatv/docs/internals/tools.md +574 -0
- package/pyatv/docs/pdoc_templates/config.mako +46 -0
- package/pyatv/docs/pdoc_templates/html.mako +454 -0
- package/pyatv/docs/support/acknowledgements.md +87 -0
- package/pyatv/docs/support/faq.md +214 -0
- package/pyatv/docs/support/migration.md +138 -0
- package/pyatv/docs/support/scanning_issues.md +110 -0
- package/pyatv/docs/support/support.md +18 -0
- package/pyatv/docs/support/troubleshooting.md +83 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/AudioFadeMessage.proto +13 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/AudioFadeMessage_pb2.pyi +37 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/AudioFadeResponseMessage.proto +11 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/AudioFadeResponseMessage_pb2.pyi +32 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/AudioFormatSettingsMessage.proto +5 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/AudioFormatSettingsMessage_pb2.pyi +27 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/ClientUpdatesConfigMessage.proto +16 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/ClientUpdatesConfigMessage_pb2.pyi +44 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/CommandInfo.proto +117 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/CommandInfo_pb2.pyi +325 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/CommandOptions.proto +36 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/CommandOptions_pb2.pyi +115 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/Common.proto +79 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/Common_pb2.pyi +228 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/ConfigureConnectionMessage.proto +11 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/ConfigureConnectionMessage_pb2.pyi +32 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/ContentItem.proto +27 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/ContentItemMetadata.proto +213 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/ContentItemMetadata_pb2.pyi +630 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/ContentItem_pb2.pyi +94 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/CryptoPairingMessage.proto +15 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/CryptoPairingMessage_pb2.pyi +46 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/DeviceInfoMessage.proto +69 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/DeviceInfoMessage_pb2.pyi +226 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/GenericMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/GenericMessage_pb2.pyi +35 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/GetKeyboardSessionMessage.proto +11 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/GetKeyboardSessionMessage_pb2.pyi +26 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/GetRemoteTextInputSessionMessage.proto +10 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/GetRemoteTextInputSessionMessage_pb2.pyi +26 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/GetVolumeMessage.proto +11 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/GetVolumeMessage_pb2.pyi +32 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/GetVolumeResultMessage.proto +11 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/GetVolumeResultMessage_pb2.pyi +32 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/KeyboardMessage.proto +88 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/KeyboardMessage_pb2.pyi +261 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/LanguageOption.proto +9 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/LanguageOption_pb2.pyi +42 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/ModifyOutputContextRequestMessage.proto +23 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/ModifyOutputContextRequestMessage_pb2.pyi +86 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/NotificationMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/NotificationMessage_pb2.pyi +38 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/NowPlayingClient.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/NowPlayingClient_pb2.pyi +49 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/NowPlayingInfo.proto +24 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/NowPlayingInfo_pb2.pyi +79 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/NowPlayingPlayer.proto +11 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/NowPlayingPlayer_pb2.pyi +45 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/Origin.proto +17 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/OriginClientPropertiesMessage.proto +11 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/OriginClientPropertiesMessage_pb2.pyi +32 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/Origin_pb2.pyi +63 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/PlaybackQueue.proto +15 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/PlaybackQueueCapabilities.proto +7 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/PlaybackQueueCapabilities_pb2.pyi +33 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/PlaybackQueueContext.proto +5 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/PlaybackQueueContext_pb2.pyi +27 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/PlaybackQueueRequestMessage.proto +29 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/PlaybackQueueRequestMessage_pb2.pyi +87 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/PlaybackQueue_pb2.pyi +53 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/PlayerClientPropertiesMessage.proto +13 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/PlayerClientPropertiesMessage_pb2.pyi +37 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/PlayerPath.proto +11 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/PlayerPath_pb2.pyi +39 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/ProtocolMessage.proto +171 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/ProtocolMessage_pb2.pyi +377 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RegisterForGameControllerEventsMessage.proto +18 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RegisterForGameControllerEventsMessage_pb2.pyi +54 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RegisterHIDDeviceMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RegisterHIDDeviceMessage_pb2.pyi +34 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RegisterHIDDeviceResultMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RegisterHIDDeviceResultMessage_pb2.pyi +35 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RegisterVoiceInputDeviceMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RegisterVoiceInputDeviceMessage_pb2.pyi +34 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RegisterVoiceInputDeviceResponseMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RegisterVoiceInputDeviceResponseMessage_pb2.pyi +35 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RemoteTextInputMessage.proto +13 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RemoteTextInputMessage_pb2.pyi +38 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RemoveClientMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RemoveClientMessage_pb2.pyi +34 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RemoveEndpointsMessage.proto +11 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RemoveEndpointsMessage_pb2.pyi +34 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RemoveOutputDevicesMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RemoveOutputDevicesMessage_pb2.pyi +38 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RemovePlayerMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/RemovePlayerMessage_pb2.pyi +34 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SendButtonEventMessage.proto +13 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SendButtonEventMessage_pb2.pyi +38 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SendCommandMessage.proto +16 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SendCommandMessage_pb2.pyi +43 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SendCommandResultMessage.proto +100 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SendCommandResultMessage_pb2.pyi +286 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SendHIDEventMessage.proto +41 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SendHIDEventMessage_pb2.pyi +63 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SendPackedVirtualTouchEventMessage.proto +24 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SendPackedVirtualTouchEventMessage_pb2.pyi +64 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SendVoiceInputMessage.proto +38 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SendVoiceInputMessage_pb2.pyi +134 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetArtworkMessage.proto +11 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetArtworkMessage_pb2.pyi +32 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetConnectionStateMessage.proto +18 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetConnectionStateMessage_pb2.pyi +54 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetDefaultSupportedCommandsMessage.proto +28 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetDefaultSupportedCommandsMessage_pb2.pyi +74 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetDiscoveryModeMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetDiscoveryModeMessage_pb2.pyi +35 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetHiliteModeMessage.proto +11 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetHiliteModeMessage_pb2.pyi +32 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetNowPlayingClientMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetNowPlayingClientMessage_pb2.pyi +34 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetNowPlayingPlayerMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetNowPlayingPlayerMessage_pb2.pyi +34 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetRecordingStateMessage.proto +17 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetRecordingStateMessage_pb2.pyi +54 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetStateMessage.proto +27 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetStateMessage_pb2.pyi +72 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetVolumeMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SetVolumeMessage_pb2.pyi +35 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SupportedCommands.proto +7 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/SupportedCommands_pb2.pyi +30 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/TextInputMessage.proto +23 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/TextInputMessage_pb2.pyi +76 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/TransactionKey.proto +6 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/TransactionKey_pb2.pyi +30 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/TransactionMessage.proto +15 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/TransactionMessage_pb2.pyi +42 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/TransactionPacket.proto +11 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/TransactionPacket_pb2.pyi +41 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/TransactionPackets.proto +7 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/TransactionPackets_pb2.pyi +30 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/UpdateClientMessage.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/UpdateClientMessage_pb2.pyi +34 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/UpdateContentItemArtworkMessage.proto +14 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/UpdateContentItemArtworkMessage_pb2.pyi +41 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/UpdateContentItemMessage.proto +14 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/UpdateContentItemMessage_pb2.pyi +41 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/UpdateEndPointsMessage.proto +25 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/UpdateEndPointsMessage_pb2.pyi +74 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/UpdateOutputDeviceMessage.proto +88 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/UpdateOutputDeviceMessage_pb2.pyi +277 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/UpdatePlayerPath.proto +12 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/UpdatePlayerPath_pb2.pyi +34 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/VirtualTouchDeviceDescriptorMessage.proto +8 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/VirtualTouchDeviceDescriptorMessage_pb2.pyi +36 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/VoiceInputDeviceDescriptorMessage.proto +8 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/VoiceInputDeviceDescriptorMessage_pb2.pyi +35 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/VolumeControlAvailabilityMessage.proto +23 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/VolumeControlAvailabilityMessage_pb2.pyi +71 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/VolumeControlCapabilitiesDidChangeMessage.proto +14 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/VolumeControlCapabilitiesDidChangeMessage_pb2.pyi +40 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/VolumeDidChangeMessage.proto +13 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/VolumeDidChangeMessage_pb2.pyi +38 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/WakeDeviceMessage.proto +11 -0
- package/pyatv/pyatv/protocols/mrp/protobuf/WakeDeviceMessage_pb2.pyi +26 -0
- package/pyatv/pyatv/py.typed +0 -0
- package/pyatv/pylintrc +49 -0
- package/pyatv/pyproject.toml +74 -0
- package/pyatv/requirements/requirements.txt +14 -0
- package/pyatv/requirements/requirements_docs.txt +2 -0
- package/pyatv/requirements/requirements_test.txt +20 -0
- package/pyatv/scripts/build_docs.sh +17 -0
- package/pyatv/scripts/setup_dev_env.sh +83 -0
- package/pyatv/setup.cfg +14 -0
- package/pyatv/tests/data/README +23 -0
- package/pyatv/tests/data/audio_10_frames.wav +0 -0
- package/pyatv/tests/data/audio_1_packet_metadata.wav +0 -0
- package/pyatv/tests/data/audio_3_packets.wav +0 -0
- package/pyatv/tests/data/only_metadata.wav +0 -0
- package/pyatv/tests/data/only_title.wav +0 -0
- package/pyatv/tests/data/static_3sec.ogg +0 -0
- package/pyatv/tests/data/testfile.txt +1 -0
- package/pyatv/tests/support/pyatv.code-workspace +14 -0
- package/src/index.ts +122 -8
- package/src/mdns.ts +64 -11
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: template
|
|
3
|
+
title: atvscript
|
|
4
|
+
permalink: /documentation/atvscript/
|
|
5
|
+
link_group: documentation
|
|
6
|
+
---
|
|
7
|
+
# Table of Contents
|
|
8
|
+
{:.no_toc}
|
|
9
|
+
* TOC
|
|
10
|
+
{:toc}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# atvscript
|
|
14
|
+
|
|
15
|
+
This script has been created specifically for scripting purposes or for integration
|
|
16
|
+
with existing software without having to write any additional code. It supports a
|
|
17
|
+
subset of what `atvremote` supports and always produce output in a format that is
|
|
18
|
+
easy to parse, e.g. JSON. It is simple to add support for additional formats if needed.
|
|
19
|
+
|
|
20
|
+
Extending and improving this script will mostly be left to the community. If you want
|
|
21
|
+
a new feature, feel free to send a PR!
|
|
22
|
+
|
|
23
|
+
# General Output Format
|
|
24
|
+
|
|
25
|
+
Output is always in the form of a dictionary (be it JSON, YAML or something else) with
|
|
26
|
+
the following keys pre-defined keys:
|
|
27
|
+
|
|
28
|
+
| Key | Meaning |
|
|
29
|
+
| --- | ------- |
|
|
30
|
+
| result | `success` if command was successful, else `failure`.
|
|
31
|
+
| datetime | Date and time (ISO8601) when event occurred (was printed), e.g. 2020-04-06T18:51:04.758569+02:00.
|
|
32
|
+
| error | An error occurred and this is a well defined string representing the error. Values: `device_not_found`, `unsupported_command`.
|
|
33
|
+
| exception | If an unexpected exception occurred, this key contains the exception message.
|
|
34
|
+
| stacktrace | If a stacktrace is available with the exception, it is included as a string here.
|
|
35
|
+
|
|
36
|
+
`error` and `exception` will only be present if `result` is set to `failure`. Any
|
|
37
|
+
additional keys not mentioned here are part of the command response.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# Specifying Device and Credentials
|
|
41
|
+
|
|
42
|
+
Currently `atvscript` supports device discovery using regular scanning and unicast
|
|
43
|
+
scanning, with identifier as filter. The arguments are identical to [atvremote](/documentation/atvremote):
|
|
44
|
+
|
|
45
|
+
```shell
|
|
46
|
+
$ atvscript --id 12345 xyz
|
|
47
|
+
$ atvscript -s 10.0.0.2 xyz
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Credentials are specified via `--dmap-credentials`, `--mrp-credentials` and
|
|
51
|
+
`--airplay-credentials`. Protocol can also be specified with `--protocol`.
|
|
52
|
+
|
|
53
|
+
When using unicast scanning, i.e. specifying IP address via `-s`, it is not needed to
|
|
54
|
+
specify `--id` as the script will pick the first available device it finds. This can
|
|
55
|
+
only be the requested device.
|
|
56
|
+
|
|
57
|
+
# Command Reference
|
|
58
|
+
|
|
59
|
+
This section documents the supported commands. JSON output has been prettified for some
|
|
60
|
+
commands to make them easier to read. One command response is *always* printed per line.
|
|
61
|
+
|
|
62
|
+
## Scanning
|
|
63
|
+
|
|
64
|
+
It is possible to scan for devices with the `scan` command:
|
|
65
|
+
|
|
66
|
+
```shell
|
|
67
|
+
$ atvscript scan
|
|
68
|
+
{
|
|
69
|
+
"result": "success",
|
|
70
|
+
"datetime": "2020-04-06T18:51:04.758569+02:00",
|
|
71
|
+
"devices": [
|
|
72
|
+
{
|
|
73
|
+
"name": "Vardagsrum",
|
|
74
|
+
"address": "10.0.10.81",
|
|
75
|
+
"identifier": "xxx",
|
|
76
|
+
"all_identifiers": [
|
|
77
|
+
"xxx",
|
|
78
|
+
"xxx",
|
|
79
|
+
"xxx"
|
|
80
|
+
],
|
|
81
|
+
"device_info": {
|
|
82
|
+
"mac": "AA:BB:CC:DD:EE:FF",
|
|
83
|
+
"model": "Gen4K",
|
|
84
|
+
"model_str": "Apple TV 4K",
|
|
85
|
+
"operating_system": "TvOS",
|
|
86
|
+
"version": "15.5.1"
|
|
87
|
+
},
|
|
88
|
+
"services": [
|
|
89
|
+
{
|
|
90
|
+
"protocol": "mrp",
|
|
91
|
+
"port": 49152
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"protocol": "airplay",
|
|
95
|
+
"port": 7000
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "Apple TV",
|
|
101
|
+
"address": "10.0.10.123",
|
|
102
|
+
"identifier": "xxx",
|
|
103
|
+
"all_identifiers": [
|
|
104
|
+
"xxx",
|
|
105
|
+
"xxx",
|
|
106
|
+
"xxx"
|
|
107
|
+
],
|
|
108
|
+
"device_info": {
|
|
109
|
+
"mac": "AA:BB:CC:DD:EE:FF",
|
|
110
|
+
"model": "Gen3",
|
|
111
|
+
"model_str": "Apple TV 3",
|
|
112
|
+
"operating_system": "Legacy",
|
|
113
|
+
"version": "8.6.1"
|
|
114
|
+
}
|
|
115
|
+
"services": [
|
|
116
|
+
{
|
|
117
|
+
"protocol": "airplay",
|
|
118
|
+
"port": 7000
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"protocol": "dmap",
|
|
122
|
+
"port": 3689
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "Proxy",
|
|
128
|
+
"address": "10.0.10.254",
|
|
129
|
+
"identifier": "xxx",
|
|
130
|
+
"all_identifiers": [
|
|
131
|
+
"xxx",
|
|
132
|
+
"xxx",
|
|
133
|
+
"xxx"
|
|
134
|
+
],
|
|
135
|
+
"device_info": {
|
|
136
|
+
"mac": null,
|
|
137
|
+
"model": "Unknown",
|
|
138
|
+
"model_str": "Unknown",
|
|
139
|
+
"operating_system": "Unknown",
|
|
140
|
+
"version": null
|
|
141
|
+
},
|
|
142
|
+
"services": [
|
|
143
|
+
{
|
|
144
|
+
"protocol": "mrp",
|
|
145
|
+
"port": 47531
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Scanning also respects the `--scan-hosts` (`-s`) flag, which is useful sometimes if scanning
|
|
154
|
+
is flaky:
|
|
155
|
+
|
|
156
|
+
```shell
|
|
157
|
+
$ atvscript -s 10.0.10.81 scan
|
|
158
|
+
{
|
|
159
|
+
"result": "success",
|
|
160
|
+
"datetime": "2020-04-06T18:51:04.758569+02:00",
|
|
161
|
+
"devices": [
|
|
162
|
+
{
|
|
163
|
+
"name": "Vardagsrum",
|
|
164
|
+
"address": "10.0.10.81",
|
|
165
|
+
"identifier": "xxx",
|
|
166
|
+
"all_identifiers": [
|
|
167
|
+
"xxx",
|
|
168
|
+
"xxx",
|
|
169
|
+
"xxx"
|
|
170
|
+
],
|
|
171
|
+
"device_info": {
|
|
172
|
+
"mac": "AA:BB:CC:DD:EE:FF",
|
|
173
|
+
"model": "Gen4K",
|
|
174
|
+
"model_str": "Apple TV 4K",
|
|
175
|
+
"operating_system": "TvOS",
|
|
176
|
+
"version": "15.5.1"
|
|
177
|
+
},
|
|
178
|
+
"services": [
|
|
179
|
+
{
|
|
180
|
+
"protocol": "mrp",
|
|
181
|
+
"port": 49152
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"protocol": "airplay",
|
|
185
|
+
"port": 7000
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## What is Playing
|
|
194
|
+
|
|
195
|
+
To get what is playing:
|
|
196
|
+
|
|
197
|
+
```shell
|
|
198
|
+
$ atvscript -s 10.0.10.81 playing
|
|
199
|
+
{
|
|
200
|
+
"result": "success",
|
|
201
|
+
"datetime": "2020-04-06T18:51:04.758569+02:00",
|
|
202
|
+
"hash": "azyFEzFpSNOSGq9ZvcaX4A∆DcpumkUoRty+R098MQeIKA",
|
|
203
|
+
"media_type": "music",
|
|
204
|
+
"device_state": "paused",
|
|
205
|
+
"title": "Ordinary World (Live)",
|
|
206
|
+
"artist": "Duran Duran",
|
|
207
|
+
"album": "From Mediterranea With Love - EP",
|
|
208
|
+
"genre": "Rock",
|
|
209
|
+
"total_time": 395,
|
|
210
|
+
"position": 1,
|
|
211
|
+
"shuffle": "off",
|
|
212
|
+
"repeat": "off",
|
|
213
|
+
"app": "Musik",
|
|
214
|
+
"app_id": "com.apple.TVMusic"
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Some of the fields, like `media_type` and `device_state` uses the names from their corresponding enum, but in lower case. Check out {% include api i="const.DeviceState" %} for instance to find valid values for `device_state`.
|
|
219
|
+
|
|
220
|
+
## Remote Control
|
|
221
|
+
|
|
222
|
+
All buttons in {% include api i="interface.RemoteControl" %} are supported by `atvscript`
|
|
223
|
+
except for the ones beginning with `set_`:
|
|
224
|
+
|
|
225
|
+
```shell
|
|
226
|
+
$ atvscript -s 10.0.10.81 menu
|
|
227
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "command": "menu"}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Push, Power, Audio and Keyboard Updates
|
|
231
|
+
|
|
232
|
+
Push, power, audio and keyboard updates are printed to the terminal as they happen:
|
|
233
|
+
|
|
234
|
+
```shell
|
|
235
|
+
$ atvscript -s 10.0.10.81 push_updates
|
|
236
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "power_state": "off"}
|
|
237
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "output_devices": [{"name": "Living room", "identifier": "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE"}]}
|
|
238
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "focus_state": "unfocused"}
|
|
239
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "hash": "azyFEzFpSNOSGq9ZvcaX4A\u2206DcpumkUoRty+R098MQeIKA", "media_type": "music", "device_state": "paused", "title": "Ordinary World (Live)", "artist": "Duran Duran", "album": "From Mediterranea With Love - EP", "genre": "Rock", "total_time": 395, "position": 1, "shuffle": "off", "repeat": "off", "app": "Musik", "app_id": "com.apple.TVMusic"}
|
|
240
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "power_state": "on"}
|
|
241
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "volume": 20.0}
|
|
242
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "volume": 15.0}
|
|
243
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "focus_state": "focused"}
|
|
244
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "focus_state": "unfocused"}
|
|
245
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "power_state": "off"}
|
|
246
|
+
|
|
247
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "push_updates": "finished"}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Current power state is always printed as the first update.
|
|
251
|
+
|
|
252
|
+
When pressing ENTER, the script will exit (as seen on the last line).
|
|
253
|
+
|
|
254
|
+
## Connection Status
|
|
255
|
+
|
|
256
|
+
Listening to push updates is a long-lived process and the connection might be closed at some point, e.g.
|
|
257
|
+
due to device reboot or network issues. If this happens, `connection` will be set to `closed`:
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
$ atvscript --id 6D797FD3-3538-427E-A47B-A32FC6CF3A69 push_updates
|
|
261
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "power_state": "on"}
|
|
262
|
+
...
|
|
263
|
+
{"result": "failure", "datetime": "2020-04-06T18:51:04.758569+02:00", "connection": "closed"}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
In case of abnormal disconnection, `connection` will be set to `lost` and an exception will be
|
|
267
|
+
included:
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
{"result": "success", "datetime": "2020-04-06T18:51:04.758569+02:00", "power_state": "on"}
|
|
271
|
+
...
|
|
272
|
+
{"result": "failure", "datetime": "2020-04-06T18:51:04.758569+02:00", "exception": "something bad happened", "connection": "closed"}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
The script will also exit (without requiring user interaction) with a non-zero exit code.
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: template
|
|
3
|
+
title: Concepts
|
|
4
|
+
permalink: /documentation/concepts/
|
|
5
|
+
link_group: documentation
|
|
6
|
+
---
|
|
7
|
+
# Table of Contents
|
|
8
|
+
{:.no_toc}
|
|
9
|
+
* TOC
|
|
10
|
+
{:toc}
|
|
11
|
+
|
|
12
|
+
# Concepts
|
|
13
|
+
|
|
14
|
+
There are a couple of important concepts in pyatv that is good to understand. This page will cover
|
|
15
|
+
the most important ones, giving them relations to how they are used in code.
|
|
16
|
+
|
|
17
|
+
# Devices and configuration
|
|
18
|
+
|
|
19
|
+
A physical device, e.g. an Apple TV 4K, is represented by a *configuration*. From a code
|
|
20
|
+
perspective, you find all the important pieces in {% include api i="conf.AppleTV" %}. It stores all
|
|
21
|
+
the necessary information about the device it represents, e.g. name, IP-address, supported protocols,
|
|
22
|
+
etc. You can read more about this in the following sections.
|
|
23
|
+
|
|
24
|
+
The simplest way to create a configuration is to to scan for devices, as {% include api i="pyatv.scan" %} returns a list of {% include api i="conf.AppleTV" %} objects with almost all information already filled in. You can then just pick the configuration you want and either connect to or pair with the device. Scanning and pairing is explained below.
|
|
25
|
+
|
|
26
|
+
It is also possible to manually create a configuration, although this is not the recommended way. One reason
|
|
27
|
+
for this is that some information is not static, e.g. port numbers and Zeroconf properties (which pyatv
|
|
28
|
+
heavily relies on). When using {% include api i="pyatv.scan" %}, the correct port will be automatically identified and filled in for you.
|
|
29
|
+
## Services and protocols
|
|
30
|
+
|
|
31
|
+
Each configuration keeps track of all the different protocols a device supports. The term *service* is also used in this context and it is exactly the same thing (this will likely be consolidated into a single term in the future, but for now they are used interchangeably).
|
|
32
|
+
|
|
33
|
+
Currently pyatv supports five protocols:
|
|
34
|
+
|
|
35
|
+
| Protocol | Purpose | Devices |
|
|
36
|
+
| -------- | ------- | ------- |
|
|
37
|
+
| Digital Media Access Protocol (DMAP) | Control device and get metadata | Apple TV <= 3 and tvOS <= 12 |
|
|
38
|
+
| Media Remote Protocol (MRP) | Control device and get metadata | tvOS (any version), e.g. Apple TV 4 and later |
|
|
39
|
+
| AirPlay | Stream video to a device | All devices |
|
|
40
|
+
| RAOP | Stream audio to a device | All devices |
|
|
41
|
+
| Companion | Currently used for app management | Apple TV 4+, HomePod in the future |
|
|
42
|
+
|
|
43
|
+
Only one protocol is needed to connect, but multiple can be used. The most appropriate protocol
|
|
44
|
+
will be used depending on feature (see [Protocol relaying](#protocol-relaying) for details). The
|
|
45
|
+
Companion protocol is however an exception as there's no unique identifier easily available for
|
|
46
|
+
that protocol.
|
|
47
|
+
|
|
48
|
+
There are methods in {% include api i="conf.AppleTV" %} to add and retrieve services. When using {% include api i="pyatv.scan" %}, all discovered protocols will be added automatically and all relevant information (e.g. which port is used) is stored as well. When manually creating a configuration, you have to provide this information yourself (e.g. via {% include api i="conf.DmapService" %} for `DMAP`, and so on).
|
|
49
|
+
|
|
50
|
+
## Device Information
|
|
51
|
+
|
|
52
|
+
It is possible to extract some general information about a device,
|
|
53
|
+
for instance which operating system it runs or its MAC address.
|
|
54
|
+
There's generally no "good" way of obtaining this information, but pyatv
|
|
55
|
+
will pull bits and pieces from the metadata received during scanning to
|
|
56
|
+
make a good guess. It can also extract additional information after
|
|
57
|
+
connecting to the device, since some protocols provide information once
|
|
58
|
+
a connection has been made. The amount of device information available
|
|
59
|
+
can because of that differ when scanning or connecting.
|
|
60
|
+
|
|
61
|
+
## Identifiers
|
|
62
|
+
|
|
63
|
+
An important concept for pyatv is to be able to *uniquely* identify a device. You should be able to say: "I want to find and connect to *this* specific device" and pyatv should be able to do that for you. This of course means that you cannot use common identifiers, like IP-address or device name, as they can change at any time. And how many devices named "Living Room" aren't there in the world?
|
|
64
|
+
|
|
65
|
+
Instead, pyatv extracts *unique identifiers* from the different services it finds when scanning. You can then specify that you want to scan for a device with one of these identifiers and be sure that you find the device you expect. What is a unique identifier then? It can be anything, as long as it is unique of course. In case of `MRP`, it actually exposes a property called `UniqueIdentifer`. Looking at `AirPlay`, you can get the device MAC-address via a property called `deviceid`. In practice this means that a device has *multiple* identifiers and you can use *any* of them when scanning. There is a convenience property, {% include api i="conf.AppleTV.identifier" %}, used to get an identifier. It just picks one from all of the available.
|
|
66
|
+
|
|
67
|
+
If you perform a scan with `atvremote`, you can see all the available identifiers:
|
|
68
|
+
|
|
69
|
+
```raw
|
|
70
|
+
$ atvremote scan
|
|
71
|
+
========================================
|
|
72
|
+
Name: Living Room
|
|
73
|
+
Model/SW: 4K tvOS 13.3.1 build 17K795
|
|
74
|
+
Address: 10.0.0.10
|
|
75
|
+
MAC: AA:BB:CC:DD:EE:FF
|
|
76
|
+
Identifiers:
|
|
77
|
+
- 01234567-89AB-CDEF-0123-4567890ABCDE
|
|
78
|
+
- 00:11:22:33:44:55
|
|
79
|
+
Services:
|
|
80
|
+
- Protocol: MRP, Port: 49152, Credentials: None
|
|
81
|
+
- Protocol: AirPlay, Port: 7000, Credentials: None
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Why is this concept so important then? Well, it *is* important that you connect to the device you expect. Especially for `MRP`, where the port might change at any time and you need to be able to find your way back (reconnect) when that happens. It also makes pyatv more reliable in environments using DHCP, which is the case in most peoples homes.
|
|
85
|
+
|
|
86
|
+
## Credentials
|
|
87
|
+
|
|
88
|
+
All protocols has some sort of "authentication" process and require *credentials* when connecting. You obtain said credentials via pairing, which is explained below. The credentials are then stored together with the protocol in a configuration.
|
|
89
|
+
|
|
90
|
+
The usual flow is:
|
|
91
|
+
|
|
92
|
+
* Perform scan
|
|
93
|
+
* Pick device of interest
|
|
94
|
+
* Connect
|
|
95
|
+
|
|
96
|
+
As of pyatv.0.14.0, persistent storage is built in. So credentials are saved and loaded automatically from
|
|
97
|
+
file (or somewhere else). See next section.
|
|
98
|
+
|
|
99
|
+
# Storage and Settings
|
|
100
|
+
|
|
101
|
+
To simplify handling of things like credentials, passwords and various settings, pyatv will automatically
|
|
102
|
+
put these into a storage module that allows for persistent storage. It is possible to implement custom
|
|
103
|
+
storage modules that for instance store settings in a cloud service, but pyatv also ships with a file
|
|
104
|
+
based storage module that will save settings in a file. This storage module is used by scripts shipped
|
|
105
|
+
with pyatv, e.g. [atvremote](../atvremote) and [atvscript](../atvscript).
|
|
106
|
+
|
|
107
|
+
# Scanning
|
|
108
|
+
|
|
109
|
+
To find devices, you perform a *scan* with the {% include api i="pyatv.scan" %} function. It uses [Zeroconf](https://en.wikipedia.org/wiki/Zero-configuration_networking) to discover devices, just like the Remote app/Control Center widget in iOS. You get a list of all available devices with information pre-filled and you can pretty much connect immediately (you might have to add credentials first though).
|
|
110
|
+
|
|
111
|
+
Scanning is not 100% reliable, that comes with the territory. Sometimes a device is not found, or even a service might not be found. It will happen and that is just life. Scan again and hope for the best. Usually it works just fine, so it shouldn't be that much of an issue (but bear it in mind when writing your software).
|
|
112
|
+
|
|
113
|
+
As a workaround for scanning issues, pyatv comes with support for *unicast scanning*. It allows
|
|
114
|
+
you to specify a list of devices to scan for. When doing so, pyatv will not rely on multicast
|
|
115
|
+
but rather send a request to the devices directly. This is much more reliable but of course comes
|
|
116
|
+
with the downside of not having devices auto discovered. You can simply try this out with `atvremote`,
|
|
117
|
+
please see [atvremote](../atvremote/).
|
|
118
|
+
|
|
119
|
+
Please note that unicast scanning does not work across different network as the Apple TV will ignore
|
|
120
|
+
packets from a different subnet. This is according to the multicast DNS specification (see chapter 5.5
|
|
121
|
+
in RFC 6762 [here](https://tools.ietf.org/html/rfc6762#section-5.5) in case you are interested) and is
|
|
122
|
+
not something that can be fixed in pyatv.
|
|
123
|
+
|
|
124
|
+
## Deep Sleep Detection
|
|
125
|
+
|
|
126
|
+
When a device is in deep sleep mode, another node on the network called a
|
|
127
|
+
*sleep proxy* will announce its prescence. It will also wake up the device
|
|
128
|
+
using Wake-On-LAN in case a particular service is requested. When scanning,
|
|
129
|
+
pyatv can detect if the response originates from a sleep proxy and
|
|
130
|
+
deduce that a device is sleeping. This is indicated via the flag
|
|
131
|
+
{% include api i="conf.AppleTV.deep_sleep" %}.
|
|
132
|
+
|
|
133
|
+
*Please do note that this is an experimental feature.*
|
|
134
|
+
|
|
135
|
+
# Pairing
|
|
136
|
+
|
|
137
|
+
Pairing is the process of obtaining credentials. You provide a configuration to the {% include api i="pyatv.pair" %} method together with the protocol you want to pair. Usually you have to input a PIN code and then the credentials are returned via the `credentials` property in the service. This means that you can scan for a device, pass the configuration you got from {% include api i="pyatv.scan" %} to {% include api i="pyatv.pair" %} and finish off by passing the same configuration to {% include api i="pyatv.connect" %}. As simple as that.
|
|
138
|
+
|
|
139
|
+
# Connecting
|
|
140
|
+
|
|
141
|
+
The final step is to connect to a device. It is done via {% include api i="pyatv.connect" %}, which sets up the connection and validates the credentials (e.g. setup encryption). You will get an error if it doesn't work. Connection attempts will be made to all protocols you have provided
|
|
142
|
+
configuration for (if necessary).
|
|
143
|
+
|
|
144
|
+
Prior to pyatv 0.8.0, a `protocol` parameter was used to pick protocol used as "main"
|
|
145
|
+
protocol (for primary interaction). This is no longer needed as the most appropriate protocol
|
|
146
|
+
is used automatically beacuase of [Protocol Relaying](#protocol-relaying). The flag is deprecated and unused.
|
|
147
|
+
|
|
148
|
+
# Metadata and push updates
|
|
149
|
+
|
|
150
|
+
The object you get when connecting follows the interface specified in the `interface` module. You can get *metadata*, e.g. what is currently playing via the `metadata` property. You don't have to poll the device for that information, you can use the {% include api i="interface.PushUpdater" %} interface to receive updates instantly as they happen via a callback interface.
|
|
151
|
+
|
|
152
|
+
# Features
|
|
153
|
+
|
|
154
|
+
Depending on hardware model and software, various features might be supported or not. Siri is for
|
|
155
|
+
instance only supported by devices running tvOS. Certain actions might not be possible to perform
|
|
156
|
+
due to the device state, e.g. pressing "pause" is not possible unless something is playing. In pyatv,
|
|
157
|
+
it's possible to obtain information about the availability of features using {% include api i="interface.Features" %}.
|
|
158
|
+
|
|
159
|
+
# Protocol Relaying
|
|
160
|
+
|
|
161
|
+
The concept of *protocol relaying* is an internal mechanism of pyatv, it is however
|
|
162
|
+
worth knowing the basics of it. pyatv provides a uniform API towards the
|
|
163
|
+
developer, removing the need to worry about underlying protocols (other than
|
|
164
|
+
credentials): it is automatically handled "under the hood". The relaying mechanism
|
|
165
|
+
allows multiple protocols to be active and will automatically "relay" interface
|
|
166
|
+
calls to the most suitable protocol. If two protocols implement the same
|
|
167
|
+
feature, the best of the two will be used. One protocol might also implement parts
|
|
168
|
+
of an interface, leaving the reminder to another protocol.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: template
|
|
3
|
+
title: Documentation
|
|
4
|
+
permalink: /documentation/
|
|
5
|
+
link_group: documentation
|
|
6
|
+
---
|
|
7
|
+
# :green_book: Table of Contents
|
|
8
|
+
{:.no_toc}
|
|
9
|
+
* TOC
|
|
10
|
+
{:toc}
|
|
11
|
+
|
|
12
|
+
# Documentation
|
|
13
|
+
|
|
14
|
+
This section covers general parts of pyatv, like how to install it, concepts and terminology to
|
|
15
|
+
understand how it works. More or less everything that is not *how* you develop with it.
|
|
16
|
+
|
|
17
|
+
Before diving into code, make sure you read and understand the [Concepts](concepts/)
|
|
18
|
+
first.
|
|
19
|
+
|
|
20
|
+
# Installing pyatv
|
|
21
|
+
|
|
22
|
+
You can install/run pyatv either in a container using pre-built images or a virtual environment.
|
|
23
|
+
|
|
24
|
+
## Container (Docker)
|
|
25
|
+
|
|
26
|
+
Starting with release 0.9.0, container images for x86_64, aarch64 and armv7 are automatically built and
|
|
27
|
+
available from GitHub. Images are published per version (e.g. v0.9.0, v0.9.1, etc.) and the latest
|
|
28
|
+
commit on `master` (just labeled with `latest`). See the [images](https://github.com/postlund/pyatv/pkgs/container/pyatv)
|
|
29
|
+
page for all available images.
|
|
30
|
+
|
|
31
|
+
To test atvremote, you can run:
|
|
32
|
+
|
|
33
|
+
```shell
|
|
34
|
+
$ docker run -it --rm --network=host ghcr.io/postlund/pyatv:master atvremote scan
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
It is also possible to run simple scripts and applications like this:
|
|
38
|
+
|
|
39
|
+
```shell
|
|
40
|
+
$ docker run --rm --network=host -v $PWD:/app ghcr.io/postlund/pyatv:v0.9.0 python /app/scan.py
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Note that network must be used in `host` mode, otherwise pyatv will not be able to find your
|
|
44
|
+
devices when scanning.
|
|
45
|
+
|
|
46
|
+
## System dependencies
|
|
47
|
+
|
|
48
|
+
You might need some additional packages to compile the dependencies. On a debian based system
|
|
49
|
+
(e.g. Debian itself or Ubuntu), you can just run:
|
|
50
|
+
|
|
51
|
+
```shell
|
|
52
|
+
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This is not needed when running in a container.
|
|
56
|
+
|
|
57
|
+
## Virtual Environment
|
|
58
|
+
|
|
59
|
+
It is recommended to install pyatv in a virtual environment rather than
|
|
60
|
+
system-wide. To create a new virtual environment:
|
|
61
|
+
|
|
62
|
+
python3 -m venv pyatv_venv
|
|
63
|
+
source pyatv_venv/bin/activate
|
|
64
|
+
|
|
65
|
+
This creates a virtual environment in a directory called `pyatv_venv`. The
|
|
66
|
+
second command activates the virtual environment and must be done every
|
|
67
|
+
time a new shell is started.
|
|
68
|
+
|
|
69
|
+
Now you can continue by installing the version of pyatv you want.
|
|
70
|
+
|
|
71
|
+
### Latest Stable Version
|
|
72
|
+
|
|
73
|
+
Install pyatv using `pip3`:
|
|
74
|
+
|
|
75
|
+
```shell
|
|
76
|
+
pip3 install {{ site.pyatv_version }}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Development Version
|
|
80
|
+
|
|
81
|
+
To try out the latest development version (a.k.a. `master` on GitHub), you can install with:
|
|
82
|
+
|
|
83
|
+
```shell
|
|
84
|
+
pip3 install --upgrade git+https://github.com/postlund/pyatv.git
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Specific Branch or a Pull Request
|
|
88
|
+
|
|
89
|
+
To install from a branch, you can install like this:
|
|
90
|
+
|
|
91
|
+
```shell
|
|
92
|
+
pip3 install --upgrade git+https://github.com/postlund/pyatv.git@refs/heads/<branch>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Replace `<branch>` with the name of the branch.
|
|
96
|
+
|
|
97
|
+
It is also possible to install directly from a pull request:
|
|
98
|
+
|
|
99
|
+
```shell
|
|
100
|
+
pip3 install git+https://github.com/postlund/pyatv.git@refs/pull/<id>/head
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Replace `<id>` with the pull request number.
|
|
104
|
+
|
|
105
|
+
# Testing with GitPod
|
|
106
|
+
|
|
107
|
+
You can try out pyatv and play around with the code using GitPod. Everything is
|
|
108
|
+
already set up and ready to go, just login with one of the supported account,
|
|
109
|
+
e.g. GitHub, and you are ready within a minute. No need to install anything on
|
|
110
|
+
your own computer and works across operating systems and web browsers. Really cool!
|
|
111
|
+
|
|
112
|
+
[](https://gitpod.io/#https://github.com/postlund/pyatv)
|
|
113
|
+
|
|
114
|
+
*Note: This runs in the cloud, so you will not be able to find your own devices. It's mainly for development or basic testing.*
|
|
115
|
+
|
|
116
|
+
# Dependencies
|
|
117
|
+
|
|
118
|
+
At least python 3.7 is required to run pyatv. A few additional libraries
|
|
119
|
+
are needed as well. An updated list is available
|
|
120
|
+
[here](https://github.com/postlund/pyatv/blob/master/base_versions.txt).
|
|
121
|
+
|
|
122
|
+
You also need to have OpenSSL compiled with support for ed25519 in order
|
|
123
|
+
to connect to MRP devices. More details is
|
|
124
|
+
[here](../support/faq/#i-get-an-error-about-ed25519-is-not-supported-how-can-i-fix-that).
|
|
125
|
+
|
|
126
|
+
# Milestones
|
|
127
|
+
|
|
128
|
+
Current milestones are available on GitHub:
|
|
129
|
+
|
|
130
|
+
[Milestones](https://github.com/postlund/pyatv/milestones)
|