Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kiosk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
don
kiosk
Commits
f35911d5
Commit
f35911d5
authored
6 years ago
by
don
Browse files
Options
Downloads
Patches
Plain Diff
Cleaned up run script, added upload capability
parent
2d39a895
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bin/run
+82
-70
82 additions, 70 deletions
bin/run
bin/show
+1
-1
1 addition, 1 deletion
bin/show
loop
+0
-8
0 additions, 8 deletions
loop
with
83 additions
and
79 deletions
bin/run
+
82
−
70
View file @
f35911d5
...
...
@@ -7,10 +7,11 @@ statusfile = os.path.join(basedir, 'state', 'statusfile')
contentbase
=
os
.
path
.
join
(
basedir
,
'
content
'
)
slidebase
=
os
.
path
.
join
(
basedir
,
'
slides
'
)
tmpdir
=
os
.
path
.
join
(
basedir
,
'
tmp
'
)
loopfile
=
os
.
path
.
join
(
basedir
,
'
loop
'
)
looptmp
=
os
.
path
.
join
(
basedir
,
'
loop.tmp
'
)
loopfile
=
os
.
path
.
join
(
basedir
,
'
state
'
,
'
loop
'
)
looptmp
=
os
.
path
.
join
(
basedir
,
'
state
'
,
'
loop.tmp
'
)
confcsv
=
os
.
path
.
join
(
basedir
,
'
conf.csv
'
)
synccommand
=
[
'
/usr/bin/rclone
'
,
'
sync
'
,
remote
,
contentbase
]
rclonebase
=
[
'
/usr/bin/rclone
'
,
'
sync
'
]
synccommand
=
rclonebase
+
[
remote
,
contentbase
]
# File formats that "feh" can display directly with no processing
...
...
@@ -78,6 +79,77 @@ except:
keepcontent
=
{}
keepslides
=
{}
def
processfile
(
contentdir
,
f
):
print
(
'
processfile start
'
,
contentdir
,
f
)
slidedir
=
os
.
path
.
join
(
slidebase
,
contentdir
)
contentpath
=
os
.
path
.
join
(
contentbase
,
contentdir
)
filepath
=
os
.
path
.
join
(
contentpath
,
f
)
sb
=
os
.
stat
(
filepath
)
filetype
=
ms
.
file
(
filepath
)
filetag
=
os
.
path
.
join
(
contentdir
,
f
)
# Active file, save status record
keepcontent
[
filetag
]
=
True
if
filetag
in
filestatus
:
# Status record exists
# Check size and modification time
thisstatus
=
filestatus
[
filetag
]
if
(
thisstatus
[
'
s
'
]
==
sb
.
st_size
)
and
(
thisstatus
[
'
m
'
]
==
sb
.
st_mtime
)
and
(
thisstatus
[
'
t
'
]
==
filetype
):
# exact match, do not need to process this file
print
(
'
exact
'
,
f
)
# mark resulting slide files to save them
for
i
in
thisstatus
[
'
f
'
]:
keepslides
[
os
.
path
.
join
(
contentdir
,
i
)]
=
True
return
else
:
# something has changed
print
(
'
changed
'
,
f
)
thisstatus
[
'
s
'
]
=
sb
.
st_size
thisstatus
[
'
m
'
]
=
sb
.
st_mtime
thisstatus
[
'
t
'
]
=
filetype
else
:
# new file, no status record yet, so make one
print
(
'
new
'
,
f
)
filestatus
[
filetag
]
=
{}
filestatus
[
filetag
][
'
s
'
]
=
sb
.
st_size
filestatus
[
filetag
][
'
m
'
]
=
sb
.
st_mtime
filestatus
[
filetag
][
'
t
'
]
=
filetype
# Figure out some useful paths
tmppath
=
os
.
path
.
join
(
tmpdir
,
f
)
destpath
=
os
.
path
.
join
(
slidedir
,
f
)
direct
=
False
for
d
in
directformats
:
if
d
in
filetype
:
direct
=
True
if
direct
:
# files that can be displayed directly just need to be copied into place
print
(
'
direct
'
,
filepath
)
tmpcopy
(
contentdir
,
f
)
subprocess
.
call
([
'
/bin/cp
'
,
'
-p
'
,
'
-f
'
,
filepath
,
destpath
])
keepslides
[
filetag
]
=
True
elif
'
PDF document
'
in
filetype
:
tmpcopy
(
contentdir
,
f
)
subprocess
.
call
([
'
/home/pi/kiosk/bin/file-pdf
'
])
elif
'
PostScript document
'
in
filetype
:
tmpcopy
(
contentdir
,
f
)
subprocess
.
call
([
'
/home/pi/kiosk/bin/file-ps
'
])
elif
'
PowerPoint
'
in
filetype
or
'
Microsoft Word
'
in
filetype
or
'
Zip archive data
'
in
filetype
:
tmpcopy
(
contentdir
,
f
)
subprocess
.
call
([
'
/home/pi/kiosk/bin/file-office
'
])
elif
'
ASCII text
'
in
filetype
:
tmpcopy
(
contentdir
,
f
)
subprocess
.
call
([
'
/home/pi/kiosk/bin/file-text
'
])
else
:
print
(
'
unknown
'
,
filepath
)
print
(
filetype
)
filelist
=
tmpmove
(
contentdir
,
direct
)
filestatus
[
filetag
][
'
f
'
]
=
filelist
for
i
in
filelist
:
keepslides
[
os
.
path
.
join
(
contentdir
,
i
)]
=
True
print
(
'
processfile done
'
,
contentdir
,
f
)
# Process all files in one directory into one set of slides
def
processdir
(
contentdir
):
slidedir
=
os
.
path
.
join
(
slidebase
,
contentdir
)
contentpath
=
os
.
path
.
join
(
contentbase
,
contentdir
)
...
...
@@ -93,73 +165,7 @@ def processdir(contentdir):
# Examine all content files
for
f
in
files
:
filepath
=
os
.
path
.
join
(
contentpath
,
f
)
sb
=
os
.
stat
(
filepath
)
filetype
=
ms
.
file
(
filepath
)
processfile
=
True
filetag
=
os
.
path
.
join
(
contentdir
,
f
)
if
filetag
in
filestatus
:
# Status record exists
# Check size and modification time
thisstatus
=
filestatus
[
filetag
]
if
(
thisstatus
[
'
s
'
]
==
sb
.
st_size
)
and
(
thisstatus
[
'
m
'
]
==
sb
.
st_mtime
)
and
(
thisstatus
[
'
t
'
]
==
filetype
):
# exact match, do not need to process this file
print
(
'
exact
'
,
f
)
processfile
=
False
# mark resulting slide files to save them
for
i
in
thisstatus
[
'
f
'
]:
keepslides
[
os
.
path
.
join
(
contentdir
,
i
)]
=
True
else
:
# something has changed
print
(
'
changed
'
,
f
)
thisstatus
[
'
s
'
]
=
sb
.
st_size
thisstatus
[
'
m
'
]
=
sb
.
st_mtime
thisstatus
[
'
t
'
]
=
filetype
else
:
# new file, no status record yet, so make one
print
(
'
new
'
,
f
)
filestatus
[
filetag
]
=
{}
filestatus
[
filetag
][
'
s
'
]
=
sb
.
st_size
filestatus
[
filetag
][
'
m
'
]
=
sb
.
st_mtime
filestatus
[
filetag
][
'
t
'
]
=
filetype
# Active file, save status record
keepcontent
[
filetag
]
=
True
# if this content file needs to be made into slide file(s)
if
processfile
:
# Figure out some useful paths
tmppath
=
os
.
path
.
join
(
tmpdir
,
f
)
destpath
=
os
.
path
.
join
(
slidedir
,
f
)
direct
=
False
for
d
in
directformats
:
if
d
in
filetype
:
direct
=
True
if
direct
:
# files that can be displayed directly just need to be copied into place
print
(
'
direct
'
,
filepath
)
tmpcopy
(
contentdir
,
f
)
subprocess
.
call
([
'
/bin/cp
'
,
'
-p
'
,
'
-f
'
,
filepath
,
destpath
])
keepslides
[
filetag
]
=
True
elif
'
PDF document
'
in
filetype
:
tmpcopy
(
contentdir
,
f
)
subprocess
.
call
([
'
/home/pi/kiosk/bin/file-pdf
'
])
elif
'
PostScript document
'
in
filetype
:
tmpcopy
(
contentdir
,
f
)
subprocess
.
call
([
'
/home/pi/kiosk/bin/file-ps
'
])
elif
'
PowerPoint
'
in
filetype
or
'
Microsoft Word
'
in
filetype
or
'
Zip archive data
'
in
filetype
:
tmpcopy
(
contentdir
,
f
)
subprocess
.
call
([
'
/home/pi/kiosk/bin/file-office
'
])
elif
'
ASCII text
'
in
filetype
:
tmpcopy
(
contentdir
,
f
)
subprocess
.
call
([
'
/home/pi/kiosk/bin/file-text
'
])
else
:
print
(
'
unknown
'
,
filepath
)
print
(
filetype
)
filelist
=
tmpmove
(
contentdir
,
direct
)
filestatus
[
filetag
][
'
f
'
]
=
filelist
for
i
in
filelist
:
keepslides
[
os
.
path
.
join
(
contentdir
,
i
)]
=
True
processfile
(
contentdir
,
f
)
contentdirs
=
[
'
.
'
]
# Turn the configuration file from a Google Sheet to a CSV file
...
...
@@ -179,6 +185,12 @@ for confline in confdata[1:]:
loopscript
+=
"
cd ..
\n
"
contentdirs
+=
[
pathname
]
processdir
(
pathname
)
uppath
=
fields
[
3
].
strip
()
if
uppath
!=
'
-
'
:
upsrc
=
os
.
path
.
join
(
slidebase
,
pathname
)
updst
=
os
.
path
.
join
(
remote
,
uppath
)
doupload
=
rclonebase
+
[
upsrc
,
updst
]
subprocess
.
call
(
doupload
)
if
action
==
'
video
'
:
loopscript
+=
"
omxplayer -b
'
../content/%s
'
\n
"
%
pathname
...
...
This diff is collapsed.
Click to expand it.
bin/show
+
1
−
1
View file @
f35911d5
...
...
@@ -5,5 +5,5 @@ cd /home/pi/kiosk/content
feh
-FZ
background.png &
while
true
do
/home/pi/kiosk/loop
/home/pi/kiosk/
state/
loop
done
This diff is collapsed.
Click to expand it.
loop
deleted
100755 → 0
+
0
−
8
View file @
2d39a895
#!/bin/bash
cd
'Slideshow'
feh
--cycle-once
-FZ
-D
3
-R
3
cd
..
omxplayer
-b
'../content/weather.mp4'
cd
'MoreSlides'
feh
--cycle-once
-FZ
-D
8
-R
8
cd
..
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