Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions motioneye_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,16 +301,16 @@ def get_image_url(self, camera_id: int, path: str, preview: bool = False) -> str
)

@classmethod
def is_file_type_image(self, file_type: int) -> bool:
def is_file_type_image(cls, file_type: int) -> bool:
"""Determine if a file_type represents an image."""
# It's an image if the event file_type is <8.
# See: https://github.com/Motion-Project/motion/blob/master/src/motion.h#L177
return file_type < 8

@classmethod
def is_file_type_movie(self, file_type: int) -> bool:
def is_file_type_movie(cls, file_type: int) -> bool:
"""Determine if a file_type represents an image."""
return not self.is_file_type_image(file_type)
return not cls.is_file_type_image(file_type)

async def async_get_movies(
self, camera_id: int, prefix: str | None = None
Expand Down
8 changes: 1 addition & 7 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import asyncio
from contextlib import closing
import logging
import socket
from typing import Any
from unittest.mock import AsyncMock
Expand All @@ -25,8 +24,6 @@
KEY_VIDEO_STREAMING,
)

_LOGGER = logging.getLogger(__name__)


async def _create_motioneye_server(aiohttp_server: Any, handlers: list[Any]) -> Any:
app = web.Application()
Expand Down Expand Up @@ -99,9 +96,6 @@ async def login_handler(request: web.Request) -> web.Response:
async def test_cannot_connect(caplog: Any, aiohttp_server: Any) -> None:
"""Test a failed connection."""

async def login_handler(request: web.Request) -> web.Response:
return web.Response(body="this is not json")

with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
s.bind(("localhost", 0))
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
Expand Down Expand Up @@ -474,7 +468,7 @@ async def test_is_file_type_image() -> None:

@pytest.mark.asyncio
async def test_is_file_type_movie() -> None:
"""Test is_file_type_image."""
"""Test is_file_type_movie."""

client = MotionEyeClient("http://localhost")
assert not client.is_file_type_movie(0)
Expand Down