diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cd8d050 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/build +/*.egg-info +__pycache__ + +*.pyc diff --git a/README.md b/README.md index aa608ec..4c4d61e 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,11 @@ Python implementation of the SDK of SIYI camera-gimbal systems. # Usage * Check the scripts in the `siyi_sdk/tests` directory to learn how to use the SDK -* To import this module in your code, copy the `siyi_sdk.py` `siyi_message.py` `utility.py` `crc16_python.py` scripts in your code directory, and import as follows, and then follow the test examples +* To import this module in your code, install the sdk with: + ```bash + pip install git+https://github.com/mzahana/siyi_sdk.git + ``` +* And import as follows, and then follow the test examples ```python from siyi_sdk import SIYISDK ``` diff --git a/gui/tkgui.py b/gui/tkgui.py index 3128745..2a8c608 100644 --- a/gui/tkgui.py +++ b/gui/tkgui.py @@ -12,7 +12,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK # create the window window window = tk.Tk() diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..7d86485 --- /dev/null +++ b/setup.py @@ -0,0 +1,19 @@ +from setuptools import find_packages, setup + +setup( + name="siyi_sdk", + version="0.1.0", + description="Python package implementation for Siyi SDK.", + long_description=open("README.md").read(), + long_description_content_type="text/markdown", + author="Mohamed Abdelkader", + author_email="mohamedashraf123@gmail.com", + packages=find_packages(exclude=["*/test",".github"]), + install_requires=["opencv-python>=4.0.0", "imutils", "ffmpeg-python"], + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + python_requires=">=3.6", +) diff --git a/__init__.py b/siyi_sdk/__init__.py similarity index 100% rename from __init__.py rename to siyi_sdk/__init__.py diff --git a/siyi_sdk/__pycache__/siyi_sdk.cpython-310.pyc b/siyi_sdk/__pycache__/siyi_sdk.cpython-310.pyc new file mode 100644 index 0000000..5997964 Binary files /dev/null and b/siyi_sdk/__pycache__/siyi_sdk.cpython-310.pyc differ diff --git a/cameras.py b/siyi_sdk/cameras.py similarity index 100% rename from cameras.py rename to siyi_sdk/cameras.py diff --git a/crc16_python.py b/siyi_sdk/crc16_python.py similarity index 100% rename from crc16_python.py rename to siyi_sdk/crc16_python.py diff --git a/siyi_message.py b/siyi_sdk/siyi_message.py similarity index 99% rename from siyi_message.py rename to siyi_sdk/siyi_message.py index 583f92f..e116d83 100644 --- a/siyi_message.py +++ b/siyi_sdk/siyi_message.py @@ -7,9 +7,9 @@ """ from os import stat -from crc16_python import crc16_str_swap +from siyi_sdk.crc16_python import crc16_str_swap import logging -from utils import toHex +from siyi_sdk.utils import toHex class FirmwareMsg: seq=0 diff --git a/siyi_sdk.bak.py b/siyi_sdk/siyi_sdk.bak.py similarity index 99% rename from siyi_sdk.bak.py rename to siyi_sdk/siyi_sdk.bak.py index 44664be..c175a7c 100644 --- a/siyi_sdk.bak.py +++ b/siyi_sdk/siyi_sdk.bak.py @@ -7,12 +7,12 @@ """ import socket -from siyi_message import * +from siyi_sdk.siyi_message import * from time import sleep, time import logging -from utils import toInt +from siyi_sdk.utils import toInt import threading -import cameras +import siyi_sdk.cameras as cameras class SIYISDK: diff --git a/siyi_sdk.py b/siyi_sdk/siyi_sdk.py similarity index 99% rename from siyi_sdk.py rename to siyi_sdk/siyi_sdk.py index cba9d4d..1010153 100644 --- a/siyi_sdk.py +++ b/siyi_sdk/siyi_sdk.py @@ -7,12 +7,12 @@ """ import socket -from siyi_message import * +from siyi_sdk.siyi_message import * from time import sleep, time import logging -from utils import toInt +from siyi_sdk.utils import toInt import threading -import cameras +import siyi_sdk.cameras as cameras class SIYISDK: diff --git a/stream.py b/siyi_sdk/stream.py similarity index 100% rename from stream.py rename to siyi_sdk/stream.py diff --git a/utils.py b/siyi_sdk/utils.py similarity index 100% rename from utils.py rename to siyi_sdk/utils.py diff --git a/tests/test_absolute_zoom.py b/tests/test_absolute_zoom.py index 56d5abc..9a2d758 100644 --- a/tests/test_absolute_zoom.py +++ b/tests/test_absolute_zoom.py @@ -15,7 +15,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK def test(): cam = SIYISDK(server_ip="192.168.144.25", port=37260) diff --git a/tests/test_center_gimbal.py b/tests/test_center_gimbal.py index 62dcb3b..d36c861 100644 --- a/tests/test_center_gimbal.py +++ b/tests/test_center_gimbal.py @@ -15,7 +15,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK def test(): cam = SIYISDK(server_ip="192.168.144.25", port=37260) diff --git a/tests/test_follow_mode.py b/tests/test_follow_mode.py index c2cc4b7..66f3d12 100644 --- a/tests/test_follow_mode.py +++ b/tests/test_follow_mode.py @@ -15,7 +15,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK def test(): cam = SIYISDK(server_ip="192.168.144.25", port=37260) diff --git a/tests/test_fpv_mode.py b/tests/test_fpv_mode.py index 9cfe6cd..34df029 100644 --- a/tests/test_fpv_mode.py +++ b/tests/test_fpv_mode.py @@ -15,7 +15,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK def test(): cam = SIYISDK(server_ip="192.168.144.25", port=37260) diff --git a/tests/test_from_rtsp_to_rtmp.py b/tests/test_from_rtsp_to_rtmp.py index a3be166..d3c1dc3 100644 --- a/tests/test_from_rtsp_to_rtmp.py +++ b/tests/test_from_rtsp_to_rtmp.py @@ -16,7 +16,7 @@ sys.path.append(parent_directory) -from stream import SIYIRTSP, RTMPSender +from siyi_sdk.stream import SIYIRTSP, RTMPSender def test(): rtsp = SIYIRTSP(rtsp_url="rtsp://192.168.144.25:8554/main.264",debug=False) diff --git a/tests/test_get_fw_ver.py b/tests/test_get_fw_ver.py index 44915a1..830f001 100644 --- a/tests/test_get_fw_ver.py +++ b/tests/test_get_fw_ver.py @@ -14,7 +14,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK def test(): cam = SIYISDK(server_ip="192.168.144.25", port=37260) diff --git a/tests/test_get_gimbal_info.py b/tests/test_get_gimbal_info.py index f6c54a1..559cee9 100644 --- a/tests/test_get_gimbal_info.py +++ b/tests/test_get_gimbal_info.py @@ -15,7 +15,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK def test(): cam = SIYISDK(server_ip="192.168.144.25", port=37260) diff --git a/tests/test_get_hw_id.py b/tests/test_get_hw_id.py index 61fac60..e3335a5 100644 --- a/tests/test_get_hw_id.py +++ b/tests/test_get_hw_id.py @@ -15,7 +15,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK def test(): cam = SIYISDK(server_ip="192.168.144.25", port=37260) diff --git a/tests/test_gimbal_rotation.py b/tests/test_gimbal_rotation.py index 87fd689..8cf1930 100644 --- a/tests/test_gimbal_rotation.py +++ b/tests/test_gimbal_rotation.py @@ -15,7 +15,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK def test(): cam = SIYISDK(server_ip="192.168.144.25", port=37260) diff --git a/tests/test_lock_mode.py b/tests/test_lock_mode.py index add3f04..423480b 100644 --- a/tests/test_lock_mode.py +++ b/tests/test_lock_mode.py @@ -15,7 +15,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK def test(): cam = SIYISDK(server_ip="192.168.144.25", port=37260) diff --git a/tests/test_print_attitude.py b/tests/test_print_attitude.py index 73c535a..0d96c07 100644 --- a/tests/test_print_attitude.py +++ b/tests/test_print_attitude.py @@ -15,7 +15,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK def test(): cam = SIYISDK(server_ip="192.168.144.25", port=37260) diff --git a/tests/test_record_video.py b/tests/test_record_video.py index 9dca4d8..6c9048c 100644 --- a/tests/test_record_video.py +++ b/tests/test_record_video.py @@ -15,7 +15,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK def test(): cam = SIYISDK(server_ip="192.168.144.25", port=37260) diff --git a/tests/test_rtmp_stream.py b/tests/test_rtmp_stream.py index fb9fade..9b36fcd 100644 --- a/tests/test_rtmp_stream.py +++ b/tests/test_rtmp_stream.py @@ -16,7 +16,7 @@ sys.path.append(parent_directory) -from stream import RTMPSender +from siyi_sdk.stream import RTMPSender def test(): # Webcam diff --git a/tests/test_rtsp.py b/tests/test_rtsp.py index 613ba8c..a4d6674 100644 --- a/tests/test_rtsp.py +++ b/tests/test_rtsp.py @@ -14,8 +14,8 @@ sys.path.append(parent_directory) -from stream import SIYIRTSP -from siyi_sdk import SIYISDK +from siyi_sdk.stream import SIYIRTSP +from siyi_sdk.siyi_sdk import SIYISDK def test(): diff --git a/tests/test_set_angles.py b/tests/test_set_angles.py index 2c5002d..05bcc25 100644 --- a/tests/test_set_angles.py +++ b/tests/test_set_angles.py @@ -15,7 +15,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK def test(): cam = SIYISDK(server_ip="192.168.144.25", port=37260) diff --git a/tests/test_zoom.py b/tests/test_zoom.py index 7a89e5c..1e8416d 100644 --- a/tests/test_zoom.py +++ b/tests/test_zoom.py @@ -15,7 +15,7 @@ sys.path.append(parent_directory) -from siyi_sdk import SIYISDK +from siyi_sdk.siyi_sdk import SIYISDK def test(): cam = SIYISDK(server_ip="192.168.144.25", port=37260)