diff options
Diffstat (limited to 'python-roonapi.spec')
| -rw-r--r-- | python-roonapi.spec | 214 |
1 files changed, 214 insertions, 0 deletions
diff --git a/python-roonapi.spec b/python-roonapi.spec new file mode 100644 index 0000000..80e3ee5 --- /dev/null +++ b/python-roonapi.spec @@ -0,0 +1,214 @@ +%global _empty_manifest_terminate_build 0 +Name: python-roonapi +Version: 0.1.4 +Release: 1 +Summary: Provides a python interface to interact with Roon +License: Apache-2.0 +URL: https://github.com/pavoni/pyroon +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/43/34/da6d008000ee9b028b17724d0be43a800974810a63bb4a2099c4ae1e9080/roonapi-0.1.4.tar.gz +BuildArch: noarch + +Requires: python3-ifaddr +Requires: python3-requests +Requires: python3-six +Requires: python3-websocket_client + +%description +# pyRoon    +python library to interface with the Roon API (www.roonlabs.com) + +See https://github.com/pavoni/pyroon/tree/master/examples for code examples. + + +An example of connecting to the roon server and using a subscription: + +``` +import time + +from roonapi import RoonApi + +appinfo = { + "extension_id": "python_roon_test", + "display_name": "Python library for Roon", + "display_version": "1.0.0", + "publisher": "gregd", + "email": "mygreat@emailaddress.com", +} + +# Can be None if you don't yet have a token +token = open("mytokenfile").read() + +# Take a look at examples/discovery if you want to use discovery. +server = "192.168.1.160" + +roonapi = RoonApi(appinfo, token, server) + + +def my_state_callback(event, changed_ids): + """Call when something changes in roon.""" + print("my_state_callback event:%s changed_ids: %s" % (event, changed_ids)) + for zone_id in changed_ids: + zone = roonapi.zones[zone_id] + print("zone_id:%s zone_info: %s" % (zone_id, zone)) + + +# receive state updates in your callback +roonapi.register_state_callback(my_state_callback) + +time.sleep(60) + +# save the token for next time +with open("mytokenfile", "w") as f: + f.write(roonapi.token)``` + + +%package -n python3-roonapi +Summary: Provides a python interface to interact with Roon +Provides: python-roonapi +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-roonapi +# pyRoon    +python library to interface with the Roon API (www.roonlabs.com) + +See https://github.com/pavoni/pyroon/tree/master/examples for code examples. + + +An example of connecting to the roon server and using a subscription: + +``` +import time + +from roonapi import RoonApi + +appinfo = { + "extension_id": "python_roon_test", + "display_name": "Python library for Roon", + "display_version": "1.0.0", + "publisher": "gregd", + "email": "mygreat@emailaddress.com", +} + +# Can be None if you don't yet have a token +token = open("mytokenfile").read() + +# Take a look at examples/discovery if you want to use discovery. +server = "192.168.1.160" + +roonapi = RoonApi(appinfo, token, server) + + +def my_state_callback(event, changed_ids): + """Call when something changes in roon.""" + print("my_state_callback event:%s changed_ids: %s" % (event, changed_ids)) + for zone_id in changed_ids: + zone = roonapi.zones[zone_id] + print("zone_id:%s zone_info: %s" % (zone_id, zone)) + + +# receive state updates in your callback +roonapi.register_state_callback(my_state_callback) + +time.sleep(60) + +# save the token for next time +with open("mytokenfile", "w") as f: + f.write(roonapi.token)``` + + +%package help +Summary: Development documents and examples for roonapi +Provides: python3-roonapi-doc +%description help +# pyRoon    +python library to interface with the Roon API (www.roonlabs.com) + +See https://github.com/pavoni/pyroon/tree/master/examples for code examples. + + +An example of connecting to the roon server and using a subscription: + +``` +import time + +from roonapi import RoonApi + +appinfo = { + "extension_id": "python_roon_test", + "display_name": "Python library for Roon", + "display_version": "1.0.0", + "publisher": "gregd", + "email": "mygreat@emailaddress.com", +} + +# Can be None if you don't yet have a token +token = open("mytokenfile").read() + +# Take a look at examples/discovery if you want to use discovery. +server = "192.168.1.160" + +roonapi = RoonApi(appinfo, token, server) + + +def my_state_callback(event, changed_ids): + """Call when something changes in roon.""" + print("my_state_callback event:%s changed_ids: %s" % (event, changed_ids)) + for zone_id in changed_ids: + zone = roonapi.zones[zone_id] + print("zone_id:%s zone_info: %s" % (zone_id, zone)) + + +# receive state updates in your callback +roonapi.register_state_callback(my_state_callback) + +time.sleep(60) + +# save the token for next time +with open("mytokenfile", "w") as f: + f.write(roonapi.token)``` + + +%prep +%autosetup -n roonapi-0.1.4 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-roonapi -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.4-1 +- Package Spec generated |
