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
82824cb8
Commit
82824cb8
authored
5 years ago
by
42loop
Browse files
Options
Downloads
Patches
Plain Diff
added buttons for no video/no image
parent
649c7bab
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
assets/init.js
+47
-0
47 additions, 0 deletions
assets/init.js
hbue.py
+22
-2
22 additions, 2 deletions
hbue.py
imagewatcher.py
+3
-0
3 additions, 0 deletions
imagewatcher.py
videowatcher.py
+4
-0
4 additions, 0 deletions
videowatcher.py
with
76 additions
and
2 deletions
assets/init.js
+
47
−
0
View file @
82824cb8
...
@@ -109,6 +109,39 @@ function manual(f)
...
@@ -109,6 +109,39 @@ function manual(f)
});
});
}
}
function
noimage
(
sender
)
{
sender
.
style
.
background
=
"
yellow
"
;
console
.
log
(
sender
.
id
);
var
client
=
new
HttpClient
();
loc
=
'
/noimage?
'
;
console
.
log
(
loc
);
client
.
get
(
loc
,
function
(
response
)
{
// do something with response
});
getimages
();
setTimeout
(()
=>
{
sender
.
style
.
background
=
"
darkgray
"
;
},
500
);
}
function
novideo
(
sender
)
{
sender
.
style
.
background
=
"
yellow
"
;
console
.
log
(
sender
.
id
);
var
client
=
new
HttpClient
();
loc
=
'
/novideo?
'
;
console
.
log
(
loc
);
client
.
get
(
loc
,
function
(
response
)
{
// do something with response
});
getvideos
();
setTimeout
(()
=>
{
sender
.
style
.
background
=
"
darkgray
"
;
},
500
);
}
function
setcron
()
function
setcron
()
{
{
console
.
log
(
"
set cron
"
);
console
.
log
(
"
set cron
"
);
...
@@ -215,6 +248,20 @@ function isloaded()
...
@@ -215,6 +248,20 @@ function isloaded()
dayclick
(
sender
);
dayclick
(
sender
);
}
}
}
}
var
noimagebtn
=
document
.
getElementById
(
"
noimage
"
);
noimagebtn
.
onclick
=
function
(
e
)
{
if
(
!
e
)
e
=
window
.
event
;
var
sender
=
e
.
srcElement
||
e
.
target
;
noimage
(
sender
);
}
var
novideobtn
=
document
.
getElementById
(
"
novideo
"
);
novideobtn
.
onclick
=
function
(
e
)
{
if
(
!
e
)
e
=
window
.
event
;
var
sender
=
e
.
srcElement
||
e
.
target
;
novideo
(
sender
);
}
getfree
();
getfree
();
getcurrent
();
getcurrent
();
getimages
();
getimages
();
...
...
This diff is collapsed.
Click to expand it.
hbue.py
+
22
−
2
View file @
82824cb8
...
@@ -28,6 +28,7 @@ import subprocess
...
@@ -28,6 +28,7 @@ import subprocess
import
json
import
json
import
psutil
import
psutil
from
PIL
import
Image
from
PIL
import
Image
import
time
h_on
=
0
h_on
=
0
h_off
=
0
h_off
=
0
...
@@ -161,9 +162,11 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
...
@@ -161,9 +162,11 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
<hr/>
<hr/>
<h3>Select media to show:</h3>
<h3>Select media to show:</h3>
<!--
-->
<table><td><h3>Images</h3>current Image: <div id=
"
currentimage
"
></div><br>
<table><td><h3>Images</h3>
<table><td>
current Image: <div id=
"
currentimage
"
></div><
td align=
"
right
"
><div id=
"
noimage
"
class=
"
mbutton
"
>None</div></table><
br>
<td width=10><td><h3>Videos</h3>current Video: <div id=
"
currentvideo
"
></div><br><tr><td valign=top><ul id=
"
images
"
>
"""
<td width=10><td><h3>Videos</h3>
<table><td>
current Video: <div id=
"
currentvideo
"
></div><
td align=
"
right
"
><div onclick=
"
novideo()
"
id=
"
novideo
"
class=
"
mbutton
"
>None</div></table><
br><tr><td valign=top><ul id=
"
images
"
>
"""
self
.
wfile
.
write
(
bytes
(
page_tpl
,
'
UTF-8
'
))
self
.
wfile
.
write
(
bytes
(
page_tpl
,
'
UTF-8
'
))
...
@@ -236,6 +239,12 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
...
@@ -236,6 +239,12 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
if
param
==
"
on
"
:
if
param
==
"
on
"
:
print
(
"
hdmi on
"
)
print
(
"
hdmi on
"
)
os
.
system
(
"
/usr/bin/tvservice -p
"
)
os
.
system
(
"
/usr/bin/tvservice -p
"
)
#pngview output is missing after hdmi off/on, restore previous
os
.
system
(
"
pkill -f pngview
"
)
time
.
sleep
(.
2
)
current
=
os
.
listdir
(
"
/home/pi/image/
"
)[
0
]
os
.
system
(
"
/home/pi/raspidmx/pngview/pngview -l 10
"
+
"
/home/pi/image/
"
+
current
+
"
&
"
)
if
param
==
"
off
"
:
if
param
==
"
off
"
:
print
(
"
hdmi off
"
)
print
(
"
hdmi off
"
)
os
.
system
(
"
/usr/bin/tvservice -o
"
)
os
.
system
(
"
/usr/bin/tvservice -o
"
)
...
@@ -272,6 +281,17 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
...
@@ -272,6 +281,17 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
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
'
))
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
return
elif
page
==
'
/novideo
'
:
print
(
"
have novideo
"
)
os
.
system
(
"
pkill -f omxplayer
"
)
currentvideo
=
""
return
elif
page
==
'
/noimage
'
:
print
(
"
have noimage
"
)
currentimage
=
""
os
.
system
(
"
pkill -f pngview
"
)
return
elif
page
==
'
/getcurrent
'
:
elif
page
==
'
/getcurrent
'
:
print
(
"
have get current
"
)
print
(
"
have get current
"
)
...
...
This diff is collapsed.
Click to expand it.
imagewatcher.py
+
3
−
0
View file @
82824cb8
...
@@ -18,6 +18,9 @@ class ImagesEventHandler(RegexMatchingEventHandler):
...
@@ -18,6 +18,9 @@ class ImagesEventHandler(RegexMatchingEventHandler):
def
on_created
(
self
,
event
):
def
on_created
(
self
,
event
):
self
.
process
(
event
)
self
.
process
(
event
)
def
on_deleted
(
self
,
event
):
os
.
system
(
"
pkill -f pngview
"
)
def
process
(
self
,
event
):
def
process
(
self
,
event
):
print
(
"
processing
"
,
event
.
src_path
)
print
(
"
processing
"
,
event
.
src_path
)
os
.
system
(
"
pkill -f pngview
"
)
os
.
system
(
"
pkill -f pngview
"
)
...
...
This diff is collapsed.
Click to expand it.
videowatcher.py
+
4
−
0
View file @
82824cb8
...
@@ -18,6 +18,10 @@ class ImagesEventHandler(RegexMatchingEventHandler):
...
@@ -18,6 +18,10 @@ class ImagesEventHandler(RegexMatchingEventHandler):
def
on_created
(
self
,
event
):
def
on_created
(
self
,
event
):
self
.
process
(
event
)
self
.
process
(
event
)
def
on_deleted
(
self
,
event
):
os
.
system
(
"
pkill -f omxplayer
"
)
def
process
(
self
,
event
):
def
process
(
self
,
event
):
print
(
"
processing
"
,
event
.
src_path
)
print
(
"
processing
"
,
event
.
src_path
)
os
.
system
(
"
pkill -f omxplayer
"
)
os
.
system
(
"
pkill -f omxplayer
"
)
...
...
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