Compare commits

...

1 Commits

Author SHA1 Message Date
zakhy
58fabdce11 Зачин модуля
#TODO - перенос на CBV.
2025-03-07 09:37:15 +07:00
24 changed files with 1202 additions and 2 deletions

View File

@ -40,7 +40,10 @@ repos:
rev: v1.15.0
hooks:
- id: mypy
args: [ --ignore-missing-imports, --disallow-untyped-defs ] # Игнорирует отсутствующие импорты и требует аннотации типов.
args: [ --ignore-missing-imports, --disallow-untyped-defs, --explicit-package-bases] # Игнорирует отсутствующие импорты и требует аннотации типов.
exclude: "migrations/"
additional_dependencies:
- types-requests
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.9

0
app/apps/cam/__init__.py Normal file
View File

13
app/apps/cam/admin.py Normal file
View File

@ -0,0 +1,13 @@
from apps.cam.models.model_channel import Channel
from apps.cam.models.model_channelgroup import ChannelGroup
from django.contrib import admin
@admin.register(Channel)
class ChannelAdmin(admin.ModelAdmin):
pass
@admin.register(ChannelGroup)
class ChannelGroupAdmin(admin.ModelAdmin):
pass

6
app/apps/cam/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class CamConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.cam"

View File

@ -0,0 +1,5 @@
from django import forms
class DeleteForm(forms.Form):
delete = forms.HiddenInput()

View File

@ -0,0 +1,5 @@
from django import forms
class ChannelStreamSelectForm(forms.Form):
stream = forms.CharField(max_length=128, widget=forms.HiddenInput)

View File

@ -0,0 +1,44 @@
from typing import Any
from apps.cam.models.model_channelgroup import ChannelGroup
from django import forms
class ChannelGroupEditForm(forms.ModelForm):
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
self.fields["title"].widget.attrs.update({"class": "form-control"})
self.fields["title"].label = "Новое наименование группы"
class Meta:
model = ChannelGroup
fields = ("title",)
class ChannelGroupCreateForm(forms.ModelForm):
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
self.fields["title"].widget.attrs.update({"class": "form-control"})
self.fields["title"].label = "Наименование группы"
self.fields["channels"].widget.attrs.update({"class": "form-control h-100"})
self.fields["channels"].label = "Выберите камеры"
class Meta:
model = ChannelGroup
fields = ("title", "channels")
class ChannelGroupAddForm(forms.ModelForm):
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
self.fields["channels"].label = "Камеры:"
self.fields["channels"].widget.attrs.update({"class": "form-control mb-2"})
self.fields["title"].label = "Наименование:"
self.fields["title"].widget.attrs.update({"class": "form-control mb-2"})
self.fields["active"].widget.attrs.update(
{"active": "form-control mb-2", "id": "active"}
)
class Meta:
model = ChannelGroup
fields = ("channels", "title", "active")

View File

@ -0,0 +1,73 @@
# Generated by Django 4.2.19 on 2025-03-06 09:31
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Channel",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=255)),
("guid", models.CharField(max_length=50, unique=True)),
("codec", models.CharField(default="h264", max_length=50)),
("have_mainstream", models.BooleanField(default=False)),
("have_substream", models.BooleanField(default=False)),
("active", models.BooleanField(default=True)),
],
options={
"verbose_name": "камера",
"verbose_name_plural": "камеры",
},
),
migrations.CreateModel(
name="ChannelGroup",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=128)),
("active", models.BooleanField(default=True)),
("channels", models.ManyToManyField(to="cam.channel")),
],
options={
"verbose_name": "группа камер",
"verbose_name_plural": "группы камер",
},
),
migrations.AddIndex(
model_name="channel",
index=models.Index(fields=["title"], name="cam_channel_title_09fbb8_idx"),
),
migrations.AddIndex(
model_name="channel",
index=models.Index(fields=["guid"], name="cam_channel_guid_40e858_idx"),
),
migrations.AddIndex(
model_name="channel",
index=models.Index(fields=["active"], name="cam_channel_active_ad3a4d_idx"),
),
migrations.AddIndex(
model_name="channelgroup",
index=models.Index(fields=["title"], name="cam_channel_title_c1c1af_idx"),
),
]

View File

View File

View File

@ -0,0 +1,22 @@
from django.db import models
class Channel(models.Model):
title = models.CharField(max_length=255)
guid = models.CharField(max_length=50, unique=True)
codec = models.CharField(max_length=50, default="h264")
have_mainstream = models.BooleanField(default=False)
have_substream = models.BooleanField(default=False)
active = models.BooleanField(default=True)
def __str__(self) -> str:
return self.title
class Meta:
verbose_name = "камера"
verbose_name_plural = "камеры"
indexes = [
models.Index(fields=("title",)),
models.Index(fields=("guid",)),
models.Index(fields=("active",)),
]

View File

@ -0,0 +1,17 @@
from django.db import models
class ChannelGroup(models.Model):
title = models.CharField(max_length=128)
channels = models.ManyToManyField("Channel")
active = models.BooleanField(default=True)
def __str__(self) -> str:
return self.title
class Meta:
verbose_name = "группа камер"
verbose_name_plural = "группы камер"
indexes = [
models.Index(fields=("title",)),
]

View File

@ -0,0 +1,58 @@
{% extends 'eps_base.html' %}
{% load mysettings %}
{% load static %}
{% block style_sheets %}
<link href="{% static 'eps/bootstrap.min.css' %}?ver={% settings_value 'APP_VER' %}" rel="stylesheet">
{% endblock %}
{% block nav_header %}
{% include 'adminLTE_custom_templates/_header.html' %}
{% endblock %}
{% block breadcrumbs %}
<nav aria-label="breadcrumb">
<ol class="breadcrumb p-2" style="margin-bottom: 0;">
<li class="breadcrumb-item">
<a href="{% url 'eps:cam_list' %}" style="text-decoration: none">Список
камер</a></li>
<li class="breadcrumb-item" aria-current="page">
<a href="{% url 'eps:manage_channels' %}" style="text-decoration: none"> Управление группами камер</a>
</li>
<li class="breadcrumb-item active" aria-current="page">Удаление камеры из группы {{ group.title }}</li>
</ol>
</nav>
{% endblock %}
{% block nav_sidebar %}
{% include 'adminLTE_custom_templates/_sidebar.html' %}
{% endblock %}
{% block content %}
<div class="container">
<div class="row d-flex justify-content-center">
<div class="col-6">
<div class="card card-danger">
<div class="card-header">
<h3 class="card-title">Удаление канала: из группы "{{ group.title }}"</h3>
</div>
<form method="post">
{{ form }}
{% csrf_token %}
<div class="card-body">
<div class="card-desc">
<p>
Вы действительно хотите удалить камеру <b>"{{ channel.title }}"</b> из группы
<b>"{{ group.title }}"</b>
</p>
</div>
<div class="">
<button type="submit" class="btn btn-danger">Удалить</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,136 @@
{% extends 'eps_base.html' %}
{% load static %}
{% block title %}
Камеры внутри фабрики
{% endblock %}
{% block nav_sidebar %}
{% include 'adminLTE_custom_templates/_sidebar.html' %}
{% endblock %}
{% block nav_btns %} {% endblock %}
{% block content_wrapper %}
<div class="content-wrapper d-flex flex-column">
{% block breadcrumbs %}
<nav aria-label="breadcrumb">
<ol class="breadcrumb p-2" style="margin-bottom: 0;">
<li class="breadcrumb-item">
<a href="{% url 'eps:main_index' %}" style="text-decoration: none">
Система определения местоположения сотрудников
</a>
</li>
<li class="breadcrumb-item">
<a href="{% url 'eps:cam_list' %}" style="text-decoration: none">
{{ current_group.title }}
</a>
</li>
<li class="breadcrumb-item active" aria-current="page">{{ current_channel.title }}</li>
</ol>
</nav>
{% endblock breadcrumbs %}
<div class="d-flex justify-content-center align-items-center m-4">
<div class="" style="width: 70%;background-color: #F4F6F9;">
<div class="nav navbar navbar-expand-lg navbar-white navbar-light border-bottom p-0"
style="gap:10px">
<div class="dropdown">
<a class="btn btn-info dropdown-toggle" id="currentStream" type="button" data-toggle="dropdown"
aria-expanded="false" data-stream="main">
Основной поток
</a>
<div class="dropdown-menu">
<button type="button" id="streamSwitch" class="dropdown-item">
Дополнительный поток
</button>
</div>
</div>
<a type="button" class="btn btn-outline-primary" href="{% url 'eps:get_screenshot' guid %}">
Скриншот</a>
<div class="d-flex ml-auto">
<a class="nav-link ml-auto" id="camExpand" href="#">
<i class="fas fa-expand"></i>
</a>
</div>
</div>
<div class="tab-content">
<div class="tab-pane fade active show" id="panel-index" role="tabpanel" aria-labelledby="tab-index">
<img src="http://192.168.100.249:555/{{ camera_token }}" style="width: 100%; height: 100%;"
id="cam-img"
alt="" onerror="getCameraToken('main')">
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block nav_footer %}
{% endblock %}
{% block extra_js %}
<script>
const img = document.querySelector('#cam-img');
const expandBtn = document.querySelector('#camExpand')
expandBtn.addEventListener('click', function (e) {
img.requestFullscreen();
})
img.addEventListener('dblclick', () => {
img.requestFullscreen();
})
{#img.onerror = getCameraToken()#}
function getCookie(name) {
let cookieArr = document.cookie.split(';');
for (let i = 0; i < cookieArr.length; i++) {
let cookiePair = cookieArr[i].split("=");
let cookieName = cookiePair[0].trim();
if (cookieName === name) {
return decodeURIComponent(cookiePair[1]);
}
}
return null;
}
async function getCameraToken(stream) {
return await fetch(`${stream}/`)
.then(response => {
if (!response.ok) {
console.error(response)
}
return response.json()
})
.then(data => {
return data.token
})
}
function switchStream() {
const stream = getCookie('currentStream')
if (stream === 'main') {
document.cookie = 'currentStream=sub'
return 'sub'
} else {
document.cookie = 'currentStream=main'
return 'main'
}
}
const streamSwitchButton = document.querySelector('#streamSwitch')
const currentStream = document.querySelector('#currentStream')
document.cookie = 'currentStream=main'
streamSwitchButton.addEventListener('click', async (e) => {
const stream = switchStream()
const new_token = await getCameraToken(stream)
if (stream === 'main') {
currentStream.textContent = 'Основной поток'
streamSwitchButton.textContent = 'Дополнительный поток'
} else {
currentStream.textContent = 'Дополнительный поток'
streamSwitchButton.textContent = 'Основной поток'
}
img.src = `http://192.168.100.249:555/${new_token}`
})
</script>
{% endblock %}

View File

@ -0,0 +1,37 @@
{% extends 'eps_base.html' %}
{% load static %}
{% block nav_header %}
{% include 'adminLTE_custom_templates/_header.html' %}
{% endblock %}
{% block breadcrumbs %}
{% endblock %}
{% block nav_sidebar %}
{% include 'adminLTE_custom_templates/_sidebar.html' %}
{% endblock %}
{% block nav_heading %}{% endblock %}
{% block content %}
<div class="container">
<div class="row d-flex justify-content-center">
<div class="col-6">
<div class="card card-danger collapsed-card">
<div class="card-header">
<h3 class="card-title">Камеры не добавлены</h3>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse"><i
class="fas fa-plus"></i>
</button>
</div>
</div>
<div class="card-body" style="display: none;">
Необходимо добавить камеры
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,119 @@
{% extends 'eps_base.html' %}
{% load static %}
{% block title %}
Добавление камеры в группу
{% endblock %}
{% block nav_header %}
{% include 'adminLTE_custom_templates/_header.html' %}]
{% endblock %}
{% block nav_sidebar %}
{% include 'adminLTE_custom_templates/_sidebar.html' %}
{% endblock %}
{% block breadcrumbs %}
<nav aria-label="breadcrumb">
<ol class="breadcrumb p-2" style="margin-bottom: 0;">
<li class="breadcrumb-item">
<a href="{% url 'eps:cam_list' %}" style="text-decoration: none">Список
камер</a></li>
<li class="breadcrumb-item" aria-current="page">
<a href="{% url 'eps:manage_channels' %}" style="text-decoration: none"> Управление группами камер</a>
</li>
<li class="breadcrumb-item active" aria-current="page">Добавить камеру в группу {{ obj.title }}</li>
</ol>
</nav>
{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-xl-4 col-lg-6 col-sm-12">
<div class="card card-primary">
<div class="card-header">
<h3 class="card-title">Выберите камеру</h3>
</div>
<form method="post">
<div class="card-body" style="display: grid;">
{% csrf_token %}
<label for="id_title">
{{ channel_add_form.title.label }}
</label>
{{ channel_add_form.title }}
<label for="id_channels">
{{ channel_add_form.channels.label }}
</label>
{{ channel_add_form.channels }}
<div class="d-flex align-items-center" style="gap: 20px">
<label for="active-w">Активна:</label>
<div class="icheck-primary d-inline" id="active-w">
{{ channel_add_form.active }}
<label for="active">
</label>
</div>
</div>
<button type="submit" class="btn btn-primary mt-3">Редактировать</button>
</div>
</form>
</div>
</div>
<div class="col-xl-8 col-lg-6 col-sm-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title">Группа: {{ obj.title }}</h3>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
<i class="fas fa-minus"></i>
</button>
</div>
</div>
<div class="card-body p-0" style="display: block;">
<table class="table">
<thead>
<tr>
<th>Наименование камеры</th>
<th>
</th>
</tr>
</thead>
<tbody>
{% for channel in obj.channels.all %}
<tr>
<td>{{ channel.title }}</td>
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
{# <a href="{% url 'eps:cam_detail' channel.guid %}"#}
{# class="btn btn-info"><i#}
{# class="fas fa-eye"></i></a>#}
{# <a href="" class="btn btn-danger"><i class="fas fa-trash"></i></a>#}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{# <div class="col-xl-4 col-lg-6 col-sm-12">#}
{# <div class="card card-primary">#}
{# <div class="card-header">#}
{# <h3 class="card-title">Редактирование группы</h3>#}
{# </div>#}
{# <form method="post">#}
{# <div class="card-body">#}
{# {% csrf_token %}#}
{# {{ group_form }}#}
{# <button type="submit" class="btn btn-primary mt-3">Сохранить</button>#}
{# </div>#}
{# </form>#}
{# </div>#}
{# </div>#}
</div>
</div>
{% endblock %}
{% block nav_footer %}
{% endblock %}

View File

@ -0,0 +1,135 @@
{% extends 'eps_base.html' %}
{% load static %}
{% block title %}
Управление группами камер
{% endblock %}
{% block nav_header %}
{% include 'adminLTE_custom_templates/_header.html' %}
{% endblock %}
{% block nav_btns %} {% endblock %}
{% block breadcrumbs %}
<nav aria-label="breadcrumb">
<ol class="breadcrumb p-2" style="margin-bottom: 0;">
<li class="breadcrumb-item">
<a href="{% url 'eps:main_index' %}" style="text-decoration: none">
Система определения местоположения сотрудников
</a>
</li>
<li class="breadcrumb-item active" aria-current="page">Управление группами камер</li>
</ol>
</nav>
{% endblock %}
{% block content %}
<div class="p-4">
<div class="row mb-3">
<div class="menu-btns">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
Создать группу
</button>
</div>
</div>
<div class="row">
{% for group in groups %}
<div class="col-md-6 col-lg-6 col-sm-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title">Группа: {{ group.title }}</h3>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
<i class="fas fa-minus"></i>
</button>
</div>
</div>
<div class="card-body p-0" style="display: block;">
<table class="table">
<thead>
<tr>
<th>Наименование камеры</th>
<th>
<div class="d-flex justify-content-end align-items-center"
style="gap: 10px">
<a class="btn btn-outline-primary"
href="{% url 'eps:cam_group_add' group.id %}">
Редактировать
</a>
</div>
</th>
</tr>
</thead>
<tbody>
{% for channel in group.channels.all %}
<tr>
<td>{{ channel.title }}</td>
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="{% url 'eps:cam_detail' channel.guid %}"
class="btn btn-info"><i
class="fas fa-eye"></i></a>
<a href="{% url 'eps:cam_remove_from_group' group.id channel.id %}"
class="btn btn-danger">
<i class="fas fa-trash"></i>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
<tr>
<td>
{% if group.active %}
<a href="{% url 'eps:change_group_visibility' group.id %}"
class="btn btn-outline-secondary">Скрыть группу</a>
{% else %}
<a href="{% url 'eps:change_group_visibility' group.id %}"
class="btn btn-outline-primary">Показывать группу</a>
{% endif %}
</td>
<td class="d-flex justify-content-end">
<a href="{% url 'eps:group_delete' group.id %}"
class="btn btn-outline-danger">
Удалить группу</a></td>
</tr>
</table>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<form class="modal-content" method="post">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Создание группы</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div>
{% csrf_token %}
<b>{{ form.title.label }}</b>
{{ form.title }}
<b>{{ form.channels.label }}</b>
<div style="height: 500px">
{{ form.channels }}
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
<button type="submit" class="btn btn-primary">Создать</button>
</div>
</form>
</div>
</div>
{% endblock %}
{% block nav_footer %}
{% endblock %}
{% block extra_js %}
<script src="{% static 'eps/bootstrap.bundle.js' %}"></script>
{% endblock %}

View File

@ -0,0 +1,54 @@
{% extends 'eps_base.html' %}
{% load static %}
{% block nav_header %}
{% include 'adminLTE_custom_templates/_header.html' %}
{% endblock %}
{% block breadcrumbs %}
<nav aria-label="breadcrumb">
<ol class="breadcrumb p-2" style="margin-bottom: 0;">
<li class="breadcrumb-item">
<a href="{% url 'eps:cam_list' %}" style="text-decoration: none">Список
камер</a></li>
<li class="breadcrumb-item" aria-current="page">
<a href="{% url 'eps:manage_channels' %}" style="text-decoration: none"> Управление группами камер</a>
</li>
<li class="breadcrumb-item active" aria-current="page">Удаление камеры из группы {{ group.title }}</li>
</ol>
</nav>
{% endblock %}
{% block nav_sidebar %}
{% include 'adminLTE_custom_templates/_sidebar.html' %}
{% endblock %}
{% block content %}
<div class="container">
<div class="row d-flex justify-content-center">
<div class="col-6">
<div class="card card-danger">
<div class="card-header">
<h3 class="card-title">Удаление группы "{{ group.title }}"</h3>
</div>
<form method="post">
{{ form }}
{% csrf_token %}
<div class="card-body">
<div class="card-desc">
<p>
Вы действительно хотите удалить группу
<b>"{{ group.title }}"</b>
</p>
</div>
<div class="">
<button type="submit" class="btn btn-danger">Удалить</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

1
app/apps/cam/tests.py Normal file
View File

@ -0,0 +1 @@
# Create your tests here.

116
app/apps/cam/trassir.py Normal file
View File

@ -0,0 +1,116 @@
import requests
import urllib3
# from apps.general.views.settingsmodule import get_settings
from django.http import HttpRequest
# from sabron.util import logging
urllib3.disable_warnings()
# trassir_host = get_settings("trassir_host", "https://192.168.100.249:8080")
# trassir_login = get_settings("trassir_login", "Cybercode")
# trassir_password = get_settings("trassir_password", "Cybercode")
Headers = {
"Accept": "*/*",
# "Host": trassir_host,
"Accept-Encoding": "gzip, deflate, br",
"Connection": "keep-alive",
"verify": "False",
}
def check_trassir_session(request: HttpRequest) -> bool:
session = request.COOKIES.get("session")
if session:
pass
# response = requests.get(
# url=f"{trassir_host}/channels?sid={session}",
# headers=Headers,
# verify=False,
# timeout=5,
# )
# if response.status_code == 200:
# response_json = json.loads(response.text)
# if (
# "channels" in response_json
# ): # Если в ответе есть каналы то сессия валидна
# return True
return False
def get_trassir_session(request: HttpRequest) -> str | None:
if check_trassir_session(request):
return request.COOKIES.get("session")
else:
# response = requests.get(
# url=f"{trassir_host}/login?username={trassir_login}&password={trassir_password}",
# headers=Headers,
# verify=False,
# timeout=10,
# )
# if response.status_code == 200:
# response_json = json.loads(response.text)
# if response_json["success"] == 1:
# session = SessionStore()
# session["session_id"] = response_json["sid"]
# session.save()
# return response_json["sid"]
# logging.error(f"Trassir: auth error \n {response.text}")
return None
def get_camera_token(session: str, guid: str, stream: str = "main") -> str | None:
# response = requests.get(
# f"{trassir_host}/get_video?channel={guid}&container=mjpeg&quality=100&stream={stream}&framerate=0&sid={session}",
# headers=Headers,
# verify=False,
# timeout=5,
# )
# if response.status_code == 200:
# response_json = json.loads(response.text)
# if response_json["success"] == 1:
# return response_json["token"]
# # logging.error(f"Trassir: get camera token error \n {response.text}")
return None
def get_channels(trassir_session: str) -> list:
def get_sort_key(value: dict) -> int | float:
try:
return int(value["name"].split()[0])
except ValueError:
return float("inf")
# response = requests.get(
# f"{trassir_host}/channels?sid={trassir_session}",
# headers=Headers,
# verify=False,
# timeout=5,
# )
# if response.status_code == 200:
# response_json = json.loads(response.text)["channels"]
# channels_factory_sorted = sorted(response_json, key=get_sort_key)
# for channel in channels_factory_sorted:
# if channel["have_mainstream"] == "0" and channel["have_substream"] == "0":
# channels_factory_sorted.remove(channel)
# return channels_factory_sorted
return []
# logging.error(f"Trassir: get channels list error \n {response.text}")
def get_camera_screenshot(trassir_session: str, guid: str) -> requests.Response | None:
# image = requests.get(
# f"{trassir_host}/screenshot/{guid}?sid={trassir_session}",
# headers=Headers,
# verify=False,
# timeout=5,
# )
# if image.status_code == 200:
# if image.headers["Content-Type"] == "image/jpeg":
# return image
# else:
# logging.error(f"Trassir: get screenshot \n {image.text}")
# pass
return None

169
app/apps/cam/views.py Normal file
View File

@ -0,0 +1,169 @@
from apps.cam.forms.form_cam import DeleteForm
from apps.cam.forms.form_channel_group import (
ChannelGroupAddForm,
ChannelGroupCreateForm,
)
from apps.cam.models.model_channel import Channel
from apps.cam.models.model_channelgroup import ChannelGroup
from apps.cam.trassir import (
get_camera_screenshot,
get_camera_token,
get_channels,
get_trassir_session,
)
from django.http import (
HttpRequest,
HttpResponse,
HttpResponsePermanentRedirect,
HttpResponseRedirect,
JsonResponse,
)
from django.shortcuts import get_object_or_404, redirect, render
def switch_stream(request: HttpRequest, guid: str, stream: str) -> JsonResponse:
session = get_trassir_session(request)
token = get_camera_token(session, guid, stream)
return JsonResponse({"token": token})
def cam_detail(request: HttpRequest, guid: str) -> HttpResponse:
session = get_trassir_session(request)
current_channel = Channel.objects.get(guid=guid)
current_group = ChannelGroup.objects.filter(
channels__guid=guid, active=True
).first()
groups = ChannelGroup.objects.filter(active=True)
stream = request.COOKIES.get("stream")
camera_token = get_camera_token(session, guid)
response = render(
request,
"cam/cam_detail.html",
{
"guid": guid,
"session_id": session,
"camera_token": camera_token,
"current_channel": current_channel,
"current_group": current_group,
"groups": groups,
"stream": stream,
},
)
response.set_cookie("session", session)
return response
def cam_list(request: HttpRequest) -> HttpResponse | (
HttpResponsePermanentRedirect | HttpResponseRedirect
):
if Channel.objects.first():
return redirect("eps:cam_detail", guid="F3anZHZa")
else:
return render(request, "cam/cam_empty.html", {}) # Временное решение
def get_screenshot(request: HttpRequest, guid: str) -> HttpResponse:
session = get_trassir_session(request)
image = get_camera_screenshot(session, guid)
current_channel = Channel.objects.get(guid=guid)
response = HttpResponse(image, content_type="image/jpeg")
response["Content-Disposition"] = (
f'attachment; filename="{current_channel.guid}.jpg"'
)
return response
def refresh_channels(
request: HttpRequest,
) -> HttpResponsePermanentRedirect | HttpResponseRedirect:
session = get_trassir_session(request)
channels_from_api = get_channels(session)
channels_from_db = Channel.objects.all().values_list("guid")
for channel in channels_from_api:
if channel["guid"] in channels_from_db:
continue
try:
Channel.objects.create(
title=channel["name"],
guid=channel["guid"],
codec=channel["codec"],
have_mainstream=channel["have_mainstream"],
have_substream=channel["have_substream"],
active=False,
)
except Exception:
pass
response = redirect("eps:cam_list")
response.set_cookie(key="session", value=session)
return response
def manage_channels(request: HttpRequest) -> HttpResponse:
groups = ChannelGroup.objects.all()
form = ChannelGroupCreateForm()
if request.method == "POST":
form = ChannelGroupCreateForm(request.POST)
if form.is_valid():
form.save()
return render(
request, "cam/cam_group_manage.html", {"groups": groups, "form": form}
)
def channel_edit(request: HttpRequest, pk: int) -> HttpResponse | (
HttpResponsePermanentRedirect | HttpResponseRedirect
):
groups = ChannelGroup.objects.filter(active=True)
group = get_object_or_404(ChannelGroup, pk=pk)
channel_add_form = ChannelGroupAddForm(instance=group)
if request.method == "POST":
channel_add_form = ChannelGroupAddForm(request.POST, instance=group)
if channel_add_form.is_valid():
channel_add_form.save()
return redirect("eps:manage_channels")
return render(
request,
"cam/cam_group_add.html",
{"groups": groups, "obj": group, "channel_add_form": channel_add_form},
)
def cam_remove_from_group(request: HttpRequest, group_id: int, pk: int) -> HttpResponse:
groups = ChannelGroup.objects.filter(active=True)
group = get_object_or_404(ChannelGroup, id=group_id)
channel = get_object_or_404(Channel, id=pk)
form = DeleteForm()
if request.method == "POST":
group.channels.remove(channel)
group.save()
return redirect("eps:manage_channels")
return render(
request,
"cam/cam_delete_confirm.html",
{"groups": groups, "group": group, "channel": channel, "form": form},
)
def group_delete(request: HttpRequest, pk: int) -> HttpResponse:
group = get_object_or_404(ChannelGroup, id=pk)
form = DeleteForm()
if request.method == "POST":
group.delete()
return redirect("eps:manage_channels")
return render(
request, "cam/group_delete_confirm.html", {"group": group, "form": form}
)
def change_group_visibility(
request: HttpRequest, pk: int
) -> HttpResponsePermanentRedirect | HttpResponseRedirect:
group = get_object_or_404(ChannelGroup, id=pk)
if group.active:
group.active = False
else:
group.active = True
group.save()
return redirect("eps:manage_channels")

186
app/poetry.lock generated
View File

@ -65,6 +65,18 @@ d = ["aiohttp (>=3.10)"]
jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
uvloop = ["uvloop (>=0.15.2)"]
[[package]]
name = "certifi"
version = "2025.1.31"
description = "Python package for providing Mozilla's CA Bundle."
optional = false
python-versions = ">=3.6"
groups = ["main"]
files = [
{file = "certifi-2025.1.31-py3-none-any.whl", hash = "sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe"},
{file = "certifi-2025.1.31.tar.gz", hash = "sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651"},
]
[[package]]
name = "cfgv"
version = "3.4.0"
@ -77,6 +89,108 @@ files = [
{file = "cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560"},
]
[[package]]
name = "charset-normalizer"
version = "3.4.1"
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
optional = false
python-versions = ">=3.7"
groups = ["main"]
files = [
{file = "charset_normalizer-3.4.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:91b36a978b5ae0ee86c394f5a54d6ef44db1de0815eb43de826d41d21e4af3de"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7461baadb4dc00fd9e0acbe254e3d7d2112e7f92ced2adc96e54ef6501c5f176"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e218488cd232553829be0664c2292d3af2eeeb94b32bea483cf79ac6a694e037"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:80ed5e856eb7f30115aaf94e4a08114ccc8813e6ed1b5efa74f9f82e8509858f"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b010a7a4fd316c3c484d482922d13044979e78d1861f0e0650423144c616a46a"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4532bff1b8421fd0a320463030c7520f56a79c9024a4e88f01c537316019005a"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d973f03c0cb71c5ed99037b870f2be986c3c05e63622c017ea9816881d2dd247"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:3a3bd0dcd373514dcec91c411ddb9632c0d7d92aed7093b8c3bbb6d69ca74408"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:d9c3cdf5390dcd29aa8056d13e8e99526cda0305acc038b96b30352aff5ff2bb"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:2bdfe3ac2e1bbe5b59a1a63721eb3b95fc9b6817ae4a46debbb4e11f6232428d"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:eab677309cdb30d047996b36d34caeda1dc91149e4fdca0b1a039b3f79d9a807"},
{file = "charset_normalizer-3.4.1-cp310-cp310-win32.whl", hash = "sha256:c0429126cf75e16c4f0ad00ee0eae4242dc652290f940152ca8c75c3a4b6ee8f"},
{file = "charset_normalizer-3.4.1-cp310-cp310-win_amd64.whl", hash = "sha256:9f0b8b1c6d84c8034a44893aba5e767bf9c7a211e313a9605d9c617d7083829f"},
{file = "charset_normalizer-3.4.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:8bfa33f4f2672964266e940dd22a195989ba31669bd84629f05fab3ef4e2d125"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:28bf57629c75e810b6ae989f03c0828d64d6b26a5e205535585f96093e405ed1"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f08ff5e948271dc7e18a35641d2f11a4cd8dfd5634f55228b691e62b37125eb3"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:234ac59ea147c59ee4da87a0c0f098e9c8d169f4dc2a159ef720f1a61bbe27cd"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd4ec41f914fa74ad1b8304bbc634b3de73d2a0889bd32076342a573e0779e00"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eea6ee1db730b3483adf394ea72f808b6e18cf3cb6454b4d86e04fa8c4327a12"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c96836c97b1238e9c9e3fe90844c947d5afbf4f4c92762679acfe19927d81d77"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:4d86f7aff21ee58f26dcf5ae81a9addbd914115cdebcbb2217e4f0ed8982e146"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:09b5e6733cbd160dcc09589227187e242a30a49ca5cefa5a7edd3f9d19ed53fd"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:5777ee0881f9499ed0f71cc82cf873d9a0ca8af166dfa0af8ec4e675b7df48e6"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:237bdbe6159cff53b4f24f397d43c6336c6b0b42affbe857970cefbb620911c8"},
{file = "charset_normalizer-3.4.1-cp311-cp311-win32.whl", hash = "sha256:8417cb1f36cc0bc7eaba8ccb0e04d55f0ee52df06df3ad55259b9a323555fc8b"},
{file = "charset_normalizer-3.4.1-cp311-cp311-win_amd64.whl", hash = "sha256:d7f50a1f8c450f3925cb367d011448c39239bb3eb4117c36a6d354794de4ce76"},
{file = "charset_normalizer-3.4.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:73d94b58ec7fecbc7366247d3b0b10a21681004153238750bb67bd9012414545"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dad3e487649f498dd991eeb901125411559b22e8d7ab25d3aeb1af367df5efd7"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c30197aa96e8eed02200a83fba2657b4c3acd0f0aa4bdc9f6c1af8e8962e0757"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2369eea1ee4a7610a860d88f268eb39b95cb588acd7235e02fd5a5601773d4fa"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc2722592d8998c870fa4e290c2eec2c1569b87fe58618e67d38b4665dfa680d"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ffc9202a29ab3920fa812879e95a9e78b2465fd10be7fcbd042899695d75e616"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:804a4d582ba6e5b747c625bf1255e6b1507465494a40a2130978bda7b932c90b"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:0f55e69f030f7163dffe9fd0752b32f070566451afe180f99dbeeb81f511ad8d"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:c4c3e6da02df6fa1410a7680bd3f63d4f710232d3139089536310d027950696a"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:5df196eb874dae23dcfb968c83d4f8fdccb333330fe1fc278ac5ceeb101003a9"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e358e64305fe12299a08e08978f51fc21fac060dcfcddd95453eabe5b93ed0e1"},
{file = "charset_normalizer-3.4.1-cp312-cp312-win32.whl", hash = "sha256:9b23ca7ef998bc739bf6ffc077c2116917eabcc901f88da1b9856b210ef63f35"},
{file = "charset_normalizer-3.4.1-cp312-cp312-win_amd64.whl", hash = "sha256:6ff8a4a60c227ad87030d76e99cd1698345d4491638dfa6673027c48b3cd395f"},
{file = "charset_normalizer-3.4.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:aabfa34badd18f1da5ec1bc2715cadc8dca465868a4e73a0173466b688f29dda"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22e14b5d70560b8dd51ec22863f370d1e595ac3d024cb8ad7d308b4cd95f8313"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8436c508b408b82d87dc5f62496973a1805cd46727c34440b0d29d8a2f50a6c9"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2d074908e1aecee37a7635990b2c6d504cd4766c7bc9fc86d63f9c09af3fa11b"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:955f8851919303c92343d2f66165294848d57e9bba6cf6e3625485a70a038d11"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:44ecbf16649486d4aebafeaa7ec4c9fed8b88101f4dd612dcaf65d5e815f837f"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:0924e81d3d5e70f8126529951dac65c1010cdf117bb75eb02dd12339b57749dd"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2967f74ad52c3b98de4c3b32e1a44e32975e008a9cd2a8cc8966d6a5218c5cb2"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:c75cb2a3e389853835e84a2d8fb2b81a10645b503eca9bcb98df6b5a43eb8886"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:09b26ae6b1abf0d27570633b2b078a2a20419c99d66fb2823173d73f188ce601"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fa88b843d6e211393a37219e6a1c1df99d35e8fd90446f1118f4216e307e48cd"},
{file = "charset_normalizer-3.4.1-cp313-cp313-win32.whl", hash = "sha256:eb8178fe3dba6450a3e024e95ac49ed3400e506fd4e9e5c32d30adda88cbd407"},
{file = "charset_normalizer-3.4.1-cp313-cp313-win_amd64.whl", hash = "sha256:b1ac5992a838106edb89654e0aebfc24f5848ae2547d22c2c3f66454daa11971"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f30bf9fd9be89ecb2360c7d94a711f00c09b976258846efe40db3d05828e8089"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:97f68b8d6831127e4787ad15e6757232e14e12060bec17091b85eb1486b91d8d"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7974a0b5ecd505609e3b19742b60cee7aa2aa2fb3151bc917e6e2646d7667dcf"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fc54db6c8593ef7d4b2a331b58653356cf04f67c960f584edb7c3d8c97e8f39e"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:311f30128d7d333eebd7896965bfcfbd0065f1716ec92bd5638d7748eb6f936a"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:7d053096f67cd1241601111b698f5cad775f97ab25d81567d3f59219b5f1adbd"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_i686.whl", hash = "sha256:807f52c1f798eef6cf26beb819eeb8819b1622ddfeef9d0977a8502d4db6d534"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_ppc64le.whl", hash = "sha256:dccbe65bd2f7f7ec22c4ff99ed56faa1e9f785482b9bbd7c717e26fd723a1d1e"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_s390x.whl", hash = "sha256:2fb9bd477fdea8684f78791a6de97a953c51831ee2981f8e4f583ff3b9d9687e"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:01732659ba9b5b873fc117534143e4feefecf3b2078b0a6a2e925271bb6f4cfa"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-win32.whl", hash = "sha256:7a4f97a081603d2050bfaffdefa5b02a9ec823f8348a572e39032caa8404a487"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:7b1bef6280950ee6c177b326508f86cad7ad4dff12454483b51d8b7d673a2c5d"},
{file = "charset_normalizer-3.4.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:ecddf25bee22fe4fe3737a399d0d177d72bc22be6913acfab364b40bce1ba83c"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8c60ca7339acd497a55b0ea5d506b2a2612afb2826560416f6894e8b5770d4a9"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b7b2d86dd06bfc2ade3312a83a5c364c7ec2e3498f8734282c6c3d4b07b346b8"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dd78cfcda14a1ef52584dbb008f7ac81c1328c0f58184bf9a84c49c605002da6"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e27f48bcd0957c6d4cb9d6fa6b61d192d0b13d5ef563e5f2ae35feafc0d179c"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:01ad647cdd609225c5350561d084b42ddf732f4eeefe6e678765636791e78b9a"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:619a609aa74ae43d90ed2e89bdd784765de0a25ca761b93e196d938b8fd1dbbd"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:89149166622f4db9b4b6a449256291dc87a99ee53151c74cbd82a53c8c2f6ccd"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:7709f51f5f7c853f0fb938bcd3bc59cdfdc5203635ffd18bf354f6967ea0f824"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:345b0426edd4e18138d6528aed636de7a9ed169b4aaf9d61a8c19e39d26838ca"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:0907f11d019260cdc3f94fbdb23ff9125f6b5d1039b76003b5b0ac9d6a6c9d5b"},
{file = "charset_normalizer-3.4.1-cp38-cp38-win32.whl", hash = "sha256:ea0d8d539afa5eb2728aa1932a988a9a7af94f18582ffae4bc10b3fbdad0626e"},
{file = "charset_normalizer-3.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:329ce159e82018d646c7ac45b01a430369d526569ec08516081727a20e9e4af4"},
{file = "charset_normalizer-3.4.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:b97e690a2118911e39b4042088092771b4ae3fc3aa86518f84b8cf6888dbdb41"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:78baa6d91634dfb69ec52a463534bc0df05dbd546209b79a3880a34487f4b84f"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1a2bc9f351a75ef49d664206d51f8e5ede9da246602dc2d2726837620ea034b2"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:75832c08354f595c760a804588b9357d34ec00ba1c940c15e31e96d902093770"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0af291f4fe114be0280cdd29d533696a77b5b49cfde5467176ecab32353395c4"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0167ddc8ab6508fe81860a57dd472b2ef4060e8d378f0cc555707126830f2537"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:2a75d49014d118e4198bcee5ee0a6f25856b29b12dbf7cd012791f8a6cc5c496"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:363e2f92b0f0174b2f8238240a1a30142e3db7b957a5dd5689b0e75fb717cc78"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:ab36c8eb7e454e34e60eb55ca5d241a5d18b2c6244f6827a30e451c42410b5f7"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:4c0907b1928a36d5a998d72d64d8eaa7244989f7aaaf947500d3a800c83a3fd6"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:04432ad9479fa40ec0f387795ddad4437a2b50417c69fa275e212933519ff294"},
{file = "charset_normalizer-3.4.1-cp39-cp39-win32.whl", hash = "sha256:3bed14e9c89dcb10e8f3a29f9ccac4955aebe93c71ae803af79265c9ca5644c5"},
{file = "charset_normalizer-3.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:49402233c892a461407c512a19435d1ce275543138294f7ef013f0b63d5d3765"},
{file = "charset_normalizer-3.4.1-py3-none-any.whl", hash = "sha256:d98b1668f06378c6dbefec3b92299716b931cd4e6061f3c875a71ced1780ab85"},
{file = "charset_normalizer-3.4.1.tar.gz", hash = "sha256:44251f18cd68a75b56585dd00dae26183e102cd5e0f9f1466e6df5da2ed64ea3"},
]
[[package]]
name = "click"
version = "8.1.8"
@ -208,6 +322,21 @@ files = [
[package.extras]
license = ["ukkonen"]
[[package]]
name = "idna"
version = "3.10"
description = "Internationalized Domain Names in Applications (IDNA)"
optional = false
python-versions = ">=3.6"
groups = ["main"]
files = [
{file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"},
{file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"},
]
[package.extras]
all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"]
[[package]]
name = "isort"
version = "6.0.1"
@ -555,6 +684,28 @@ files = [
{file = "pyyaml-6.0.2.tar.gz", hash = "sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e"},
]
[[package]]
name = "requests"
version = "2.32.3"
description = "Python HTTP for Humans."
optional = false
python-versions = ">=3.8"
groups = ["main"]
files = [
{file = "requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"},
{file = "requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"},
]
[package.dependencies]
certifi = ">=2017.4.17"
charset-normalizer = ">=2,<4"
idna = ">=2.5,<4"
urllib3 = ">=1.21.1,<3"
[package.extras]
socks = ["PySocks (>=1.5.6,!=1.5.7)"]
use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
[[package]]
name = "setuptools"
version = "75.8.2"
@ -634,6 +785,21 @@ files = [
{file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"},
]
[[package]]
name = "types-requests"
version = "2.32.0.20250306"
description = "Typing stubs for requests"
optional = false
python-versions = ">=3.9"
groups = ["main"]
files = [
{file = "types_requests-2.32.0.20250306-py3-none-any.whl", hash = "sha256:25f2cbb5c8710b2022f8bbee7b2b66f319ef14aeea2f35d80f18c9dbf3b60a0b"},
{file = "types_requests-2.32.0.20250306.tar.gz", hash = "sha256:0962352694ec5b2f95fda877ee60a159abdf84a0fc6fdace599f20acb41a03d1"},
]
[package.dependencies]
urllib3 = ">=2"
[[package]]
name = "typing-extensions"
version = "4.12.2"
@ -660,6 +826,24 @@ files = [
{file = "tzdata-2025.1.tar.gz", hash = "sha256:24894909e88cdb28bd1636c6887801df64cb485bd593f2fd83ef29075a81d694"},
]
[[package]]
name = "urllib3"
version = "2.3.0"
description = "HTTP library with thread-safe connection pooling, file post, and more."
optional = false
python-versions = ">=3.9"
groups = ["main"]
files = [
{file = "urllib3-2.3.0-py3-none-any.whl", hash = "sha256:1cee9ad369867bfdbbb48b7dd50374c0967a0bb7710050facf0dd6911440e3df"},
{file = "urllib3-2.3.0.tar.gz", hash = "sha256:f8c5449b3cf0861679ce7e0503c7b44b5ec981bec0d1d3795a07f1ba96f0204d"},
]
[package.extras]
brotli = ["brotli (>=1.0.9) ; platform_python_implementation == \"CPython\"", "brotlicffi (>=0.8.0) ; platform_python_implementation != \"CPython\""]
h2 = ["h2 (>=4,<5)"]
socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"]
zstd = ["zstandard (>=0.18.0)"]
[[package]]
name = "versioning"
version = "0.1.0"
@ -704,4 +888,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess
[metadata]
lock-version = "2.1"
python-versions = "^3.10"
content-hash = "26ac8850d861ebdd5b566ffd197b95a794480cdcd22261d240b16f5447660d10"
content-hash = "ae43f1c5f66740a1a900bc991c7d7e67264cf0c4d09309427585e94ff2853cae"

View File

@ -6,6 +6,7 @@ INSTALLED_APPS = [
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"apps.cam.apps.CamConfig",
]
# Информация о приложении

View File

@ -13,6 +13,8 @@ gunicorn = "^23.0.0"
psycopg2-binary = "^2.9.10"
colorama = "^0.4.6"
versioning = { git = "https://git.cybercode.pro/zakhy/versioning.git", branch = "django-4.2" }
requests = "^2.32.3"
types-requests = "^2.32.0.20250306"
[tool.poetry.group.dev.dependencies]
setuptools = "^75.8.2"