Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3 #192

Open
wants to merge 101 commits into
base: python3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 97 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
b6d2053
Update debug.py
Feb 24, 2021
0bf9013
Update shutdown.py
Feb 24, 2021
2b352e1
Update helper.py
Feb 25, 2021
4a2c00c
Update debug.py
Feb 27, 2021
ba3b6ab
Update helper.py
Feb 27, 2021
66eb329
Update base.py
Mar 8, 2021
079d761
Update display.py
Mar 9, 2021
2a2dc70
Update servicemanager.py
Mar 11, 2021
cd47273
Update oauth.py
Mar 11, 2021
6633fc8
Update oauthlink.py
Mar 11, 2021
4dc9064
Update README.md
May 4, 2021
fa84132
Update svc_googlephotos.py
May 5, 2021
f05a321
Update colormatch.py
May 5, 2021
aff4765
Update README.md
May 5, 2021
91bc4ec
Update helper.py
May 5, 2021
e06d83e
Update README.md
May 5, 2021
6a36c79
Update helper.py
May 5, 2021
b9c8f50
Update helper.py
May 5, 2021
cf5deeb
Update helper.py
May 5, 2021
e23c136
Update colormatch.py
May 18, 2021
ac4ed48
Update colormatch.py
May 18, 2021
f1f2548
Update colormatch.py
May 18, 2021
4a251b6
Update colormatch.py
May 18, 2021
9617546
Update colormatch.py
May 18, 2021
7f89b2d
Update colormatch.py
May 18, 2021
914b09e
Update colormatch.py
May 19, 2021
91b767c
Update colormatch.py
May 19, 2021
1992a47
Update colormatch.py
May 19, 2021
c8b1864
Update colormatch.py
May 19, 2021
91c3e4e
Update colormatch.py
May 19, 2021
8e8845e
reduce Warnings and clean up update script
May 19, 2021
169276e
Update README.md
May 19, 2021
781dacb
Update README.md
May 19, 2021
15c5fcc
Update README.md
May 19, 2021
a12cc11
update to install instructions
May 19, 2021
072da2d
Re-written temp logic
May 21, 2021
108928e
syntax bug
May 21, 2021
8cc2028
Monitor brightness fix
May 21, 2021
1e1ca4e
Run from port 80
May 21, 2021
6487cb7
Update README.md
May 23, 2021
e13b98e
Update svc_usb.py
May 23, 2021
576238e
Merge pull request #1 from dadr/Philip
Jun 8, 2021
cf1e744
Update README.md
Jun 8, 2021
c6e4581
Update Readme
Jun 8, 2021
7f31f27
Update Readme
Jun 8, 2021
2c6ff44
point repo to mrworf
Jun 8, 2021
8a1c664
Update README.md
Jun 8, 2021
5ffb18a
Screen Standby
Jun 9, 2021
fba4690
Update README.md
Jun 9, 2021
3cc375a
Update README.md
Jun 9, 2021
e7baad4
Update maintenance.py
Jun 11, 2021
8dfee5b
screen buttons
Jun 11, 2021
9ee63d6
Update maintenance.py
Jun 11, 2021
d4142df
Merge pull request #2 from dadr/feature/screen-off-url
Jun 12, 2021
f43294f
Update README.md
Jun 12, 2021
a3b205a
Finish feature
Jun 12, 2021
9afc531
Bugfix
Jun 12, 2021
db9057d
Update main.js
Jun 12, 2021
92c1cce
Update main.js
Jun 12, 2021
422bbc3
Return web pages
Jun 12, 2021
e0aa548
Update maintenance.py
Jun 12, 2021
df90112
Update maintenance.py
Jun 12, 2021
e736bd5
Merge branch 'python3' into feature/backup
Jun 12, 2021
62dad93
Merge pull request #3 from dadr/feature/backup
Jun 12, 2021
2e94072
Update README.md
Jun 14, 2021
ec390d9
Update base.py
Jun 17, 2021
3732562
Work with files
Jun 17, 2021
2e52fa7
Update main.js
Jun 17, 2021
7794c9b
Update upload.py
Jun 17, 2021
bbd453e
Update maintenance.py
Jun 17, 2021
9387079
Finish Download
Jun 17, 2021
936764c
Upload config changes
Jun 17, 2021
b73f91f
Style adjust
Jun 17, 2021
70d86c6
Update upload.py
Jun 17, 2021
8883555
Update upload.py
Jun 17, 2021
228331e
restart
Jun 17, 2021
29db0b7
Merge pull request #4 from dadr/feature/backup
Jun 17, 2021
b5d9ae7
Update main.html
Jun 17, 2021
566254b
Update upload.py
Jun 17, 2021
65e5d11
Update main.js
Jun 17, 2021
2f96e5c
Merge pull request #5 from dadr/feature/backup
Jun 17, 2021
d532232
Update main.html
Jun 18, 2021
61d09c3
Update main.html
Jun 18, 2021
fbf4653
Config Page Formatting
Jun 18, 2021
020e6ef
Update main.html
Jun 18, 2021
c3e6f01
Update main.html
Jun 18, 2021
38b97d9
Update main.html
Jun 18, 2021
d33f8db
Merge pull request #6 from dadr/feature/Configuration
Jun 18, 2021
7a74b7f
Initial partial commit
Jul 5, 2021
2ac8c75
Second set of work
Jul 8, 2021
81d5977
Rework restore to run as separate process.
Aug 17, 2021
96c993a
Create Version File
Jan 10, 2022
a584370
Merge pull request #8 from dadr/feature/backup
dadr Jan 10, 2022
b215564
Final Bugfixes for backup feature
Jan 17, 2022
ad2a43e
Merge pull request #9 from dadr/feature/backup
dadr Jan 17, 2022
42e5130
Last Bugfixes
Jan 17, 2022
da233e9
Merge pull request #10 from dadr/feature/backup
dadr Jan 17, 2022
6e57772
Error checking on tar
Jan 18, 2022
8ca44ca
Merge pull request #11 from dadr/feature/backup
dadr Jan 18, 2022
471c4f8
Indent error
Jan 18, 2022
95ecaa1
Merge pull request #12 from dadr/feature/backup
dadr Jan 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,4 @@ ENV/

# from developer leogaube
/useful_commands
.DS_Store
9 changes: 0 additions & 9 deletions MIGRATION.md

This file was deleted.

312 changes: 248 additions & 64 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
parser = argparse.ArgumentParser(description="PhotoFrame - A RaspberryPi based digital photoframe",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--logfile', default=None, help="Log to file instead of stdout")
parser.add_argument('--port', default=7777, type=int, help="Port to listen on")
parser.add_argument('--port', default=80, type=int, help="Port to listen on")
parser.add_argument('--countdown', default=10, type=int, help="Set seconds to countdown before starting slideshow")
parser.add_argument('--listen', default="0.0.0.0", help="Address to listen on")
parser.add_argument('--debug', action='store_true', default=False, help='Enable loads more logging')
Expand Down Expand Up @@ -143,7 +143,7 @@ def setupWebserver(self, listen, port):
self._loadRoute('keywords', 'RouteKeywords', self.serviceMgr, self.slideshow)
self._loadRoute('orientation', 'RouteOrientation', self.cacheMgr)
self._loadRoute('overscan', 'RouteOverscan', self.cacheMgr)
self._loadRoute('maintenance', 'RouteMaintenance', self.emulator, self.driverMgr, self.slideshow)
self._loadRoute('maintenance', 'RouteMaintenance', self.emulator, self.driverMgr, self.slideshow, self.timekeeperMgr)
self._loadRoute('details', 'RouteDetails', self.displayMgr, self.driverMgr,
self.colormatch, self.slideshow, self.serviceMgr, self.settingsMgr)
self._loadRoute('upload', 'RouteUpload', self.settingsMgr, self.driverMgr)
Expand Down
95 changes: 95 additions & 0 deletions load_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!/usr/bin/env python3
#
# This file is part of photoframe (https://github.com/mrworf/photoframe).
#
# photoframe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# photoframe is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with photoframe. If not, see <http://www.gnu.org/licenses/>.
#
# Synopsis:
# load_config.py settings.tar.gz
#
# Description:
# This program loads a saved configuration into the system. It will:
# Verify config file,
# stop frame process,
# backup current config,
# set desired config.
# Note: restarting the frame service is up to the caller.
#
#
import sys
import os
import subprocess
import magic
import shutil

from modules.path import path

# Make sure we run from our own directory
os.chdir(os.path.dirname(sys.argv[0]))

# get input filename from command line
if len(sys.argv) < 2:
print('Argument missing')
print('Usage:', sys.argv[0], ' settings.tar.gz')
sys.exit(1)
if len(sys.argv) > 2:
print('Too many arguments')
print('Usage:', sys.argv[0], ' settings.tar.gz')
sys.exit(1)
updatefile = sys.argv[1]

# test that the file exists and is a tar.gz file
if not os.path.isfile(updatefile):
print('file not found: ', updatefile)
sys.exit(1)
if magic.from_file(updatefile, mime=True) != 'application/gzip':
print(updatefile, 'is not a tar.gz archive')
sys.exit(1)

#Stop existing frame thread
# Do NOT kill the service itself, since it will actually tear down the python script
subprocess.call(['pkill', '-SIGHUP', '-f', 'frame.py'])

# move existing config if necessary
configdir=path.CONFIGFOLDER
if os.path.isdir(configdir):
had_config = True
shutil.rmtree(configdir + '.bak', ignore_errors = True)
os.rename(configdir, configdir + '.bak')
else:
had_config = False
try:
os.mkdir(configdir)
except Exception:
print('Cannot make new configuration directory:', configdir)
os.rename(configdir + '.bak', configdir)
sys.exit(1)

#Un-tar the config file
try:
subprocess.call(['/usr/bin/tar', '-xzf', updatefile, '-C', configdir])
except Exception:
print('tar failed to unpack', updatefile, 'into', configdir)
if had_config:
print('Restoring Previous configuration')
shutil.rmtree(configdir, ignore_errors = True)
os.rename(configdir + '.bak', configdir)
sys.exit(1)

#Todo test config data for validity
#Todo test that video mode is supported by current hardware

#All done
print('Successfully loaded new config from ', updatefile)
sys.exit(0)
Loading