Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
outdoorbits committed Mar 1, 2025
1 parent 98d13bb commit 9f45a9f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
17 changes: 7 additions & 10 deletions scripts/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ def get_statusbar(self):

def show(self, Lines, statusbar=None):

# fill line count to const_DISPLAY_LINES_LIMIT
while len(Lines) < self.const_DISPLAY_LINES_LIMIT:
Lines.append("s=b:")

if ":IMAGE=" in Lines[0]:
# PRINT IMAGE FROM FILE
# Only the first line can be interpreted as image. In This case no further text will be printed.
Expand Down Expand Up @@ -549,10 +553,6 @@ def main(self):
Line = "s=b:{}".format(Line)
Lines.append(Line)

# fill line count to const_DISPLAY_LINES_LIMIT
while len(Lines) < self.const_DISPLAY_LINES_LIMIT:
Lines.append("s=b:")

# remove content file
os.remove(ContentFile)

Expand All @@ -565,11 +565,12 @@ def main(self):
newCF.write(f"\nset:hidden={hidden_info}")

# move lines to old lines file
if hidden_info:
Lines.append(f"set:hidden={hidden_info}")
with open(self.const_DISPLAY_CONTENT_OLD_FILE, 'w') as oCF:
oCF.write("\n".join(Lines))

if hidden_info:
LoCF.write(f"\nset:hidden={hidden_info}")

if self.hardware_ready:
self.show(Lines, self.get_statusbar())
display_time = time.time()
Expand All @@ -580,10 +581,6 @@ def main(self):
self.conf_DISP_SHOW_STATUSBAR and
time.time() - display_time >= self.const_DISPLAY_STATUSBAR_MAX_SEC
):
# fill line count to const_DISPLAY_LINES_LIMIT
while len(Lines) < self.const_DISPLAY_LINES_LIMIT:
Lines.append("s=b:")

self.show(Lines, self.get_statusbar())
display_time = time.time()

Expand Down
1 change: 0 additions & 1 deletion scripts/lib_proftpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def setDefaultRoot(self, FTP_DefaultRoot=''):
try:
with open(self.configfile,'w') as f:
f.write(f'DefaultRoot {self.FTP_DefaultRoot} lbb\n')
print(f"setDefaultRoot: {self.FTP_DefaultRoot}")
except:
print("Error writing proftpd config file.")
return()
Expand Down
4 changes: 2 additions & 2 deletions scripts/stop_backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
WORKING_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)

ps -ef | grep "${WORKING_DIR}/backup" | grep -v grep | awk '{print $2}' | sudo xargs -r kill -9
sudo python3 ${WORKING_DIR}/lib_display.py "$(python3 ${WORKING_DIR}/lib_language.py box_backup_break1)" "$(python3 ${WORKING_DIR}/lib_language.py box_backup_break2)"

sudo python3 /var/www/little-backup-box/lib_proftpd.py --Action 'setDefaultRoot' --DefaultRoot ''
sudo python3 /var/www/little-backup-box/lib_proftpd.py --Action 'setDefaultRoot' --DefaultRoot '' &

sudo python3 ${WORKING_DIR}/lib_display.py "$(python3 ${WORKING_DIR}/lib_language.py box_backup_break1)" "$(python3 ${WORKING_DIR}/lib_language.py box_backup_break2)"

0 comments on commit 9f45a9f

Please sign in to comment.