Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
VT2 Видеотехнологии
Onvif proxy
Commits
559d4c4c
Commit
559d4c4c
authored
2 years ago
by
Boyarskiy Andrew
Browse files
Options
Download
Patches
Plain Diff
Correct mistakes, new urls added, delete volume from docker
parent
a56cc691
master
argparse
dev
flask
flask-docker
1 merge request
!1
Correcting mistakes, support of ew cameras added
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
Dockerfile
+2
-1
Dockerfile
django-app/Onvif_proxy/apps/onvif_proccesser/conf.json
+90
-0
django-app/Onvif_proxy/apps/onvif_proccesser/conf.json
django-app/Onvif_proxy/apps/onvif_proccesser/urls.py
+5
-0
django-app/Onvif_proxy/apps/onvif_proccesser/urls.py
django-app/Onvif_proxy/apps/onvif_proccesser/views.py
+17
-10
django-app/Onvif_proxy/apps/onvif_proccesser/views.py
docker-compose.yml
+0
-5
docker-compose.yml
with
114 additions
and
16 deletions
+114
-16
Dockerfile
+
2
−
1
View file @
559d4c4c
...
...
@@ -5,6 +5,7 @@ ENV PYTHONUNBUFFERED=1
COPY
django-app django-app
WORKDIR
django-app
RUN
pip
install
-r
requirements.txt
RUN
cat
Onvif_proxy/apps/onvif_proccesser/conf.json
RUN
cat
Onvif_proxy/apps/onvif_proccesser/views.py
RUN
ls
RUN
pwd
VOLUME
[ "/django-app" ]
This diff is collapsed.
Click to expand it.
django-app/Onvif_proxy/apps/onvif_proccesser/conf.json
+
90
−
0
View file @
559d4c4c
{
"cameras"
:
{
"52"
:
{
"ip"
:
"172.18.191.52"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7052/main"
},
"53"
:
{
"ip"
:
"172.18.191.53"
,
"port"
:
"80"
,
...
...
@@ -30,6 +35,11 @@
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7064/main"
},
"65"
:
{
"ip"
:
"172.18.191.65"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7065/main"
},
"73"
:
{
"ip"
:
"172.18.191.73"
,
"port"
:
"80"
,
...
...
@@ -64,6 +74,86 @@
"ip"
:
"172.18.191.86"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7086/main"
},
"93"
:
{
"ip"
:
"172.18.191.93"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7093/main"
},
"94"
:
{
"ip"
:
"172.18.191.94"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7094/main"
},
"95"
:
{
"ip"
:
"172.18.191.95"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7095/main"
},
"96"
:
{
"ip"
:
"172.18.191.96"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7096/main"
},
"103"
:
{
"ip"
:
"172.18.191.103"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7103/main"
},
"104"
:
{
"ip"
:
"172.18.191.104"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7104/main"
},
"105"
:
{
"ip"
:
"172.18.191.105"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7105/main"
},
"106"
:
{
"ip"
:
"172.18.191.106"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7106/main"
},
"190"
:
{
"ip"
:
"172.18.191.190"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7190/main"
},
"191"
:
{
"ip"
:
"172.18.191.191"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7191/main"
},
"192"
:
{
"ip"
:
"172.18.191.192"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7192/main"
},
"193"
:
{
"ip"
:
"172.18.191.193"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7193/main"
},
"194"
:
{
"ip"
:
"172.18.191.194"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7194/main"
},
"196"
:
{
"ip"
:
"172.18.191.196"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7196/main"
},
"200"
:
{
"ip"
:
"172.18.191.200"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7200/main"
},
"201"
:
{
"ip"
:
"172.18.191.201"
,
"port"
:
"80"
,
"streamuri"
:
"rtsp://172.18.130.40:7201/main"
}
}
}
This diff is collapsed.
Click to expand it.
django-app/Onvif_proxy/apps/onvif_proccesser/urls.py
+
5
−
0
View file @
559d4c4c
...
...
@@ -44,4 +44,9 @@ urlpatterns = {
path
(
'<int:number>/onvif/event_service'
,
views
.
index
,
name
=
'index'
),
path
(
'<int:number>/onvif/imaging_service'
,
views
.
index
,
name
=
'index'
),
path
(
'<int:number>/onvif/media_service'
,
views
.
index
,
name
=
'index'
),
path
(
'<int:number>/onvif/Analytics'
,
views
.
index
,
name
=
'index'
),
path
(
'<int:number>/onvif/Event'
,
views
.
index
,
name
=
'index'
),
path
(
'<int:number>/onvif/Imaging'
,
views
.
index
,
name
=
'index'
),
path
(
'<int:number>/onvif/Media'
,
views
.
index
,
name
=
'index'
),
path
(
'<int:number>/onvif/PTZ'
,
views
.
index
,
name
=
'index'
)
}
This diff is collapsed.
Click to expand it.
django-app/Onvif_proxy/apps/onvif_proccesser/views.py
+
17
−
10
View file @
559d4c4c
...
...
@@ -11,10 +11,13 @@ from django.views.decorators.csrf import csrf_exempt
#python manage.py runserver 192.168.1.187:8000
HOST_IP
=
'172.18.191.31'
def
get_replace_template
(
ipport
,
ip
):
to_replace
=
r
'http://{}:8000/{}/'
.
format
(
HOST_IP
,
ip
)
dict
=
{
r
'{}'
.
format
(
ipport
):
r
'http://192.168.1.187:8000/{}/'
.
format
(
ip
)
,
r
'http://255.255.255.255:80/'
:
r
'http://192.168.1.187:8000/{}/'
.
format
(
ip
)
r
'{}'
.
format
(
ipport
):
to_replace
,
r
'http://255.255.255.255:80/'
:
to_replace
}
return
dict
...
...
@@ -34,14 +37,17 @@ def index(request, number):
data
=
settings
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'conf.json'
))
cameras
=
data
.
return_data
()
try
:
cam
=
str
(
number
)
ip
=
cameras
[
'cameras'
][
cam
][
'ip'
]
logging
.
info
(
'Камера {}'
.
format
(
cam
))
except
KeyError
:
logging
.
error
(
'Нет камеры {}'
.
format
(
cam
))
cam
=
list
(
cameras
[
'cameras'
].
keys
())[
0
]
ip
=
cameras
[
'cameras'
][
cam
][
'ip'
]
logging
.
info
(
'Вход Камера {}'
.
format
(
number
))
logging
.
info
(
'Вход Камера {}'
.
format
(
type
(
number
)))
# try:
cam
=
str
(
number
)
ip
=
cameras
[
'cameras'
][
cam
][
'ip'
]
logging
.
info
(
'Камера {}'
.
format
(
cam
))
# except KeyError:
# logging.error('Нет камеры {}'.format(cam))
# cam = list(cameras['cameras'].keys())[0]
# ip = cameras['cameras'][cam]['ip']
port
=
cameras
[
'cameras'
][
cam
][
'port'
]
ipport
=
'http://{}:{}/'
.
format
(
ip
,
port
)
...
...
@@ -61,6 +67,7 @@ def index(request, number):
response
=
Onvif
.
make_request
(
'device_service'
,
body
)
response
=
replace_all
(
response
.
text
,
get_replace_template
(
ipport
,
cam
))
response
=
replace_all
(
response
,
get_replace_template
(
r
'http://{}/'
.
format
(
ip
),
cam
))
response
=
response
.
encode
()
return
return_soap
(
response
)
...
...
This diff is collapsed.
Click to expand it.
docker-compose.yml
+
0
−
5
View file @
559d4c4c
...
...
@@ -5,10 +5,5 @@ services:
build
:
.
container_name
:
onvif-proxy
command
:
python ./manage.py runserver 0.0.0.0:8000
volumes
:
-
"
django-app:/django-app"
ports
:
-
"
8000:8000"
volumes
:
django-app
:
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets