Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Move port and path constants
Browse files Browse the repository at this point in the history
  • Loading branch information
OskarSoderberg committed Aug 26, 2022
1 parent 1af9935 commit 64df172
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/g3pylib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@
from g3pylib.recordings import Recordings
from g3pylib.rudimentary import Rudimentary
from g3pylib.settings import Settings
from g3pylib.streams import DEFAULT_RTPS_LIVE_PATH, DEFAULT_RTSP_PORT, Streams
from g3pylib.streams import Streams
from g3pylib.system import System
from g3pylib.websocket import G3WebSocketClientProtocol
from g3pylib.zeroconf import DEFAULT_WEBSOCKET_PATH, G3Service, G3ServiceDiscovery

__version__ = "0.2.0-alpha"

DEFAULT_HTTP_PORT = "80"
DEFAULT_RTSP_LIVE_PATH = "/live/all"
DEFAULT_RTSP_PORT = 8554
DEFAULT_HTTP_PORT = 80

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -231,7 +233,7 @@ async def _urls_from_hostname(
if not using_zeroconf:
return (
f"ws://{hostname}{DEFAULT_WEBSOCKET_PATH}",
f"rtsp://{hostname}:{DEFAULT_RTSP_PORT}{DEFAULT_RTPS_LIVE_PATH}",
f"rtsp://{hostname}:{DEFAULT_RTSP_PORT}{DEFAULT_RTSP_LIVE_PATH}",
f"http://{hostname}:{DEFAULT_HTTP_PORT}",
)
else:
Expand Down
2 changes: 0 additions & 2 deletions src/g3pylib/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
from g3pylib import _utils
from g3pylib.g3typing import JSONObject

DEFAULT_RTPS_LIVE_PATH = "/live/all"
DEFAULT_RTSP_PORT = 8554
TIMESTAMP_GRANULARITY = 90000
FRAME_QUEUE_SIZE = 10
DATA_QUEUE_SIZE = 100
Expand Down
10 changes: 7 additions & 3 deletions tests/test_connect_to_glasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

import pytest

from g3pylib import DEFAULT_HTTP_PORT, connect_to_glasses
from g3pylib.streams import DEFAULT_RTPS_LIVE_PATH, DEFAULT_RTSP_PORT
from g3pylib import (
DEFAULT_HTTP_PORT,
DEFAULT_RTSP_LIVE_PATH,
DEFAULT_RTSP_PORT,
connect_to_glasses,
)
from g3pylib.zeroconf import DEFAULT_WEBSOCKET_PATH, G3ServiceDiscovery


Expand Down Expand Up @@ -53,7 +57,7 @@ async def test_connect_with_hostname_no_zeroconf(g3_hostname: str):
async def test_connect_with_urls(g3_hostname: str):
async with connect_to_glasses.with_url(
f"ws://{g3_hostname}{DEFAULT_WEBSOCKET_PATH}",
f"rtsp://{g3_hostname}:{DEFAULT_RTSP_PORT}{DEFAULT_RTPS_LIVE_PATH}",
f"rtsp://{g3_hostname}:{DEFAULT_RTSP_PORT}{DEFAULT_RTSP_LIVE_PATH}",
f"http://{g3_hostname}:{DEFAULT_HTTP_PORT}",
) as g3:
serial = await g3.system.get_recording_unit_serial()
Expand Down

0 comments on commit 64df172

Please sign in to comment.