Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
astabeamer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
42loop
astabeamer
Commits
756142ee
Commit
756142ee
authored
5 years ago
by
42loop
Browse files
Options
Downloads
Patches
Plain Diff
scriptified
parent
76715715
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
hbue.py
+64
-33
64 additions, 33 deletions
hbue.py
with
64 additions
and
33 deletions
hbue.py
+
64
−
33
View file @
756142ee
...
...
@@ -162,48 +162,18 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
<h3>Select media to show:</h3>
<table><td><h3>Images</h3>current Image:
"""
+
currentimage
+
"""
<br>
<td width=10><td><h3>Videos</h3>current Video:
"""
+
currentvideo
+
"""
<br><tr><td valign=top><ul>
"""
<table><td><h3>Images</h3>current Image:
<div id=
"
currentimage
"
></div>
<br>
<td width=10><td><h3>Videos</h3>current Video:
<div id=
"
currentvideo
"
></div>
<br><tr><td valign=top><ul
id=
"
images
"
>
"""
self
.
wfile
.
write
(
bytes
(
page_tpl
,
'
UTF-8
'
))
mypath
=
self
.
server
.
context
.
folder
#os.path.abspath(relpath) # ; print abspath
for
dp
,
dn
,
filenames
in
os
.
walk
(
mypath
):
for
f
in
sorted
(
filenames
):
meta
=
self
.
getmetadata
(
f
)
fname
=
f
fname
,
fe
=
os
.
path
.
splitext
(
fname
)
fthumb
=
"
thumbnails?
"
+
os
.
path
.
basename
(
fname
)
+
"
_thumbnail.png
"
f
=
os
.
path
.
join
(
dp
,
f
)
if
f
.
find
(
"
.png
"
)
!=-
1
:
if
fname
+
fe
==
currentimage
:
self
.
wfile
.
write
(
bytes
(
"
\t\t
<li class=
\"
selectmedia
\"
><table><td align=center width=145><img src=
\"
"
+
fthumb
+
"
\"
><td><a title=
\"
delete
\"
class=
\"
delete
\"
href=
\"
/delete?%s
\"
>delete</a><td><a title=
\"
select
\"
class=
\"
selected
\"
href=
\"
/execute?%s
\"
>select</a><td width=145><a href=
\"
/download?%s
\"
>%s</a><br>%s</table></li>
\n
"
%
(
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
fname
,
meta
)
,
'
UTF-8
'
))
else
:
self
.
wfile
.
write
(
bytes
(
"
\t\t
<li class=
\"
selectmedia
\"
><table><td align=center width=145><img src=
\"
"
+
fthumb
+
"
\"
><td><a title=
\"
delete
\"
class=
\"
delete
\"
href=
\"
/delete?%s
\"
>delete</a><td><a title=
\"
select
\"
class=
\"
select
\"
href=
\"
/execute?%s
\"
>select</a><td width=145><a href=
\"
/download?%s
\"
>%s</a><br>%s</table></li>
\n
"
%
(
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
fname
,
meta
)
,
'
UTF-8
'
))
page_tpl
=
"""
</ul></td><td><td valign=top><ul>
"""
page_tpl
=
"""
</ul></td><td><td valign=top><ul id=
"
videos
"
>
"""
self
.
wfile
.
write
(
bytes
(
page_tpl
,
'
UTF-8
'
))
for
dp
,
dn
,
filenames
in
os
.
walk
(
mypath
):
for
f
in
sorted
(
filenames
):
meta
=
self
.
getmetadata
(
f
)
fname
=
f
fname
,
fe
=
os
.
path
.
splitext
(
fname
)
fthumb
=
"
thumbnails?
"
+
os
.
path
.
basename
(
fname
)
+
"
_thumbnail.png
"
f
=
os
.
path
.
join
(
dp
,
f
)
if
f
.
find
(
"
.png
"
)
==-
1
:
if
fname
+
fe
==
currentvideo
:
self
.
wfile
.
write
(
bytes
(
"
\t\t
<li class=
\"
selectmedia
\"
><table><td align=center width=145><img src=
\"
"
+
fthumb
+
"
\"
><td><a title=
\"
delete
\"
class=
\"
delete
\"
href=
\"
/delete?%s
\"
>delete</a><td><a title=
\"
select
\"
class=
\"
selected
\"
href=
\"
/execute?%s
\"
>select</a><td width=145><a href=
\"
/download?%s
\"
>%s</a><br>%s</table></li>
\n
"
%
(
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
fname
,
meta
)
,
'
UTF-8
'
))
else
:
self
.
wfile
.
write
(
bytes
(
"
\t\t
<li class=
\"
selectmedia
\"
><table><td align=center width=145><img src=
\"
"
+
fthumb
+
"
\"
><td><a title=
\"
delete
\"
class=
\"
delete
\"
href=
\"
/delete?%s
\"
>delete</a><td><a title=
\"
select
\"
class=
\"
select
\"
href=
\"
/execute?%s
\"
>select</a><td width=145><a href=
\"
/download?%s
\"
>%s</a><br>%s</table></li>
\n
"
%
(
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
fname
,
meta
)
,
'
UTF-8
'
))
page_tpl
=
"""
</ul></table></body></html>
"""
self
.
wfile
.
write
(
bytes
(
page_tpl
,
'
UTF-8
'
))
...
...
@@ -281,6 +251,67 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
return
elif
page
==
'
/getimages
'
:
print
(
"
have get images
"
)
self
.
send_response
(
200
)
self
.
send_header
(
'
Content-type
'
,
'
text/html; charset=UTF-8
'
)
self
.
end_headers
()
mypath
=
self
.
server
.
context
.
folder
#os.path.abspath(relpath) # ; print abspath
for
dp
,
dn
,
filenames
in
os
.
walk
(
mypath
):
for
f
in
sorted
(
filenames
):
meta
=
self
.
getmetadata
(
f
)
fname
=
f
fname
,
fe
=
os
.
path
.
splitext
(
fname
)
fthumb
=
"
thumbnails?
"
+
os
.
path
.
basename
(
fname
)
+
"
_thumbnail.png
"
f
=
os
.
path
.
join
(
dp
,
f
)
if
f
.
find
(
"
.png
"
)
!=-
1
:
if
fname
+
fe
==
currentimage
:
self
.
wfile
.
write
(
bytes
(
"
\t\t
<li class=
\"
selectmedia
\"
><table><td align=center width=145><img src=
\"
"
+
fthumb
+
"
\"
><td><a title=
\"
delete
\"
class=
\"
delete
\"
href=
\"
/delete?%s
\"
>delete</a><td><a title=
\"
select
\"
class=
\"
selected
\"
href=
\"
/execute?%s
\"
>select</a><td width=145><a href=
\"
/download?%s
\"
>%s</a><br>%s</table></li>
\n
"
%
(
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
fname
,
meta
)
,
'
UTF-8
'
))
else
:
self
.
wfile
.
write
(
bytes
(
"
\t\t
<li class=
\"
selectmedia
\"
><table><td align=center width=145><img src=
\"
"
+
fthumb
+
"
\"
><td><a title=
\"
delete
\"
class=
\"
delete
\"
href=
\"
/delete?%s
\"
>delete</a><td><a title=
\"
select
\"
class=
\"
select
\"
href=
\"
/execute?%s
\"
>select</a><td width=145><a href=
\"
/download?%s
\"
>%s</a><br>%s</table></li>
\n
"
%
(
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
fname
,
meta
)
,
'
UTF-8
'
))
return
elif
page
==
'
/getcurrent
'
:
print
(
"
have get current
"
)
self
.
send_response
(
200
)
self
.
send_header
(
'
Content-type
'
,
'
text/plain; charset=UTF-8
'
)
self
.
end_headers
()
currentimage
=
os
.
listdir
(
"
/home/pi/image
"
)[
0
]
currentvideo
=
os
.
listdir
(
"
/home/pi/video
"
)[
0
]
self
.
wfile
.
write
(
bytes
((
currentimage
+
"
|
"
+
currentvideo
),
encoding
=
'
utf8
'
))
return
elif
page
==
'
/getvideos
'
:
print
(
"
have get videos
"
)
self
.
send_response
(
200
)
self
.
send_header
(
'
Content-type
'
,
'
text/html; charset=UTF-8
'
)
self
.
end_headers
()
mypath
=
self
.
server
.
context
.
folder
#os.path.abspath(relpath) # ; print abspath
for
dp
,
dn
,
filenames
in
os
.
walk
(
mypath
):
for
f
in
sorted
(
filenames
):
meta
=
self
.
getmetadata
(
f
)
fname
=
f
fname
,
fe
=
os
.
path
.
splitext
(
fname
)
fthumb
=
"
thumbnails?
"
+
os
.
path
.
basename
(
fname
)
+
"
_thumbnail.png
"
f
=
os
.
path
.
join
(
dp
,
f
)
if
f
.
find
(
"
.png
"
)
==-
1
:
if
fname
+
fe
==
currentvideo
:
self
.
wfile
.
write
(
bytes
(
"
\t\t
<li class=
\"
selectmedia
\"
><table><td align=center width=145><img src=
\"
"
+
fthumb
+
"
\"
><td><a title=
\"
delete
\"
class=
\"
delete
\"
href=
\"
/delete?%s
\"
>delete</a><td><a title=
\"
select
\"
class=
\"
selected
\"
href=
\"
/execute?%s
\"
>select</a><td width=145><a href=
\"
/download?%s
\"
>%s</a><br>%s</table></li>
\n
"
%
(
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
fname
,
meta
)
,
'
UTF-8
'
))
else
:
self
.
wfile
.
write
(
bytes
(
"
\t\t
<li class=
\"
selectmedia
\"
><table><td align=center width=145><img src=
\"
"
+
fthumb
+
"
\"
><td><a title=
\"
delete
\"
class=
\"
delete
\"
href=
\"
/delete?%s
\"
>delete</a><td><a title=
\"
select
\"
class=
\"
select
\"
href=
\"
/execute?%s
\"
>select</a><td width=145><a href=
\"
/download?%s
\"
>%s</a><br>%s</table></li>
\n
"
%
(
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
urllib
.
parse
.
unquote
(
f
),
fname
,
meta
)
,
'
UTF-8
'
))
return
elif
page
==
'
/getfree
'
:
print
(
"
have get free
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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