mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-12 02:23:43 +00:00
lint fixes
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#============================================================================#
|
# ========================================================================== #
|
||||||
# #
|
# #
|
||||||
# uStreamer - Lightweight and fast MJPG-HTTP streamer. #
|
# uStreamer - Lightweight and fast MJPG-HTTP streamer. #
|
||||||
# #
|
# #
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License #
|
# You should have received a copy of the GNU General Public License #
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
||||||
# #
|
# #
|
||||||
#============================================================================#
|
# ========================================================================== #
|
||||||
|
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env -S python3 -B
|
#!/usr/bin/env -S python3 -B
|
||||||
#============================================================================#
|
# ========================================================================== #
|
||||||
# #
|
# #
|
||||||
# uStreamer - Lightweight and fast MJPG-HTTP streamer. #
|
# uStreamer - Lightweight and fast MJPG-HTTP streamer. #
|
||||||
# #
|
# #
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License #
|
# You should have received a copy of the GNU General Public License #
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
||||||
# #
|
# #
|
||||||
#============================================================================#
|
# ========================================================================== #
|
||||||
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env -S python3 -B
|
#!/usr/bin/env -S python3 -B
|
||||||
#============================================================================#
|
# ========================================================================== #
|
||||||
# #
|
# #
|
||||||
# uStreamer - Lightweight and fast MJPG-HTTP streamer. #
|
# uStreamer - Lightweight and fast MJPG-HTTP streamer. #
|
||||||
# #
|
# #
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License #
|
# You should have received a copy of the GNU General Public License #
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
||||||
# #
|
# #
|
||||||
#============================================================================#
|
# ========================================================================== #
|
||||||
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@@ -26,7 +26,6 @@ import io
|
|||||||
import struct
|
import struct
|
||||||
|
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import common
|
import common
|
||||||
|
|
||||||
@@ -38,14 +37,15 @@ def _get_jpeg_size(data: bytes) -> Tuple[int, int]:
|
|||||||
stream = io.BytesIO(data)
|
stream = io.BytesIO(data)
|
||||||
while True:
|
while True:
|
||||||
marker = struct.unpack(">H", stream.read(2))[0]
|
marker = struct.unpack(">H", stream.read(2))[0]
|
||||||
|
if marker == 0xFFD9:
|
||||||
|
raise RuntimeError("Can't find jpeg size")
|
||||||
|
|
||||||
if (
|
if (
|
||||||
marker == 0xFFD8 # Start of image
|
marker == 0xFFD8 # Start of image
|
||||||
or marker == 0xFF01 # Private marker
|
or marker == 0xFF01 # Private marker
|
||||||
or (marker >= 0xFFD0 and marker <= 0xFFD7) # Restart markers
|
or 0xFFD0 <= marker <= 0xFFD7 # Restart markers
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
elif marker == 0xFFD9:
|
|
||||||
raise RuntimeError("Can't find jpeg size")
|
|
||||||
|
|
||||||
# All other markers specify chunks with lengths
|
# All other markers specify chunks with lengths
|
||||||
length = struct.unpack(">H", stream.read(2))[0]
|
length = struct.unpack(">H", stream.read(2))[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user