Skip to content

Commit

Permalink
add FTP source to the display menu
Browse files Browse the repository at this point in the history
  • Loading branch information
outdoorbits committed Feb 19, 2025
1 parent 64632f4 commit 91851cf
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 39 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<h2>Changelog</h2>
<ul>
<li>2025-02-18: The integrated FTP server can now be used as a backup source. This makes it possible to use the LBB as a bridge from a camera to (almost) any backup destination. Note: The user 'lbb' must be used for this.</li>
<li>2024-12-14: Add status bar to display</li>
<li>2021-11-16: To optimize automatic backups, thumbnails are now created during the secondary backup (to cloud storage) instead of between the primary (to local disk) and secondary backups. This approach maximizes computing and network efficiency, significantly reducing the overall backup time.</li>
<li>2021-10-19: Add option to rename media files after backup based on the files creation date and time. Example: &quot;Image.jpg&quot; from 2024/10/19 12:42:14 will be renamed to &quot;2024-10-19_12-42-14_-_Image.jpg&quot;</li>
Expand Down
27 changes: 14 additions & 13 deletions scripts/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,22 @@ def run(self):
if self.TargetDevice and (self.SourceStorageType not in ['thumbnails', 'database', 'exif', 'rename']):
self.backup()

# rename
if self.DoRenameFiles:
self.RenameFiles()
if not self.TransferMode is None:
# rename
if self.DoRenameFiles:
self.RenameFiles()

# sync database
if self.ForceSyncDatabase or self.__TIMSCopied:
self.syncDatabase()
# sync database
if self.ForceSyncDatabase or self.__TIMSCopied:
self.syncDatabase()

# update exif
if self.TargetDevice and self.DoUpdateEXIF:
self.updateEXIF()
# update exif
if self.TargetDevice and self.DoUpdateEXIF:
self.updateEXIF()

# generate thumbnails
if self.TargetDevice and self.DoGenerateThumbnails_primary:
self.generateThumbnails(Device=self.TargetDevice)
# generate thumbnails
if self.TargetDevice and self.DoGenerateThumbnails_primary:
self.generateThumbnails(Device=self.TargetDevice)

self.finish()

Expand Down Expand Up @@ -483,7 +484,7 @@ def backup(self):
self.SourceDevice.umount()
self.__display.message([f":{self.__lan.l('box_backup_break1')}", f":{self.__lan.l('box_backup_break2')}"])

sys.exit()
return()

# remember SourceStorageName for next run
if SourceStorageName=='camera':
Expand Down
3 changes: 1 addition & 2 deletions scripts/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def __init__(self):
if self.conf_MENU_ENABLED:
# start displaymenu as iternal background process
try:
thread = threading.Thread(target=displaymenu.menu, args=(self.maxLines, self.__setup, self.menu_controller))
thread = threading.Thread(target=displaymenu.menu, args=(self.maxLines -1 if self.conf_DISP_SHOW_STATUSBAR else self.maxLines, self.__setup, self.menu_controller))
thread.start()
except:
pass
Expand Down Expand Up @@ -578,7 +578,6 @@ def main(self):
if (
self.hardware_ready and
self.conf_DISP_SHOW_STATUSBAR and
len(Lines) >= self.const_DISPLAY_LINES_LIMIT and
time.time() - display_time >= self.const_DISPLAY_STATUSBAR_MAX_SEC
):
self.show(Lines, self.get_statusbar())
Expand Down
51 changes: 33 additions & 18 deletions scripts/displaymenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def __init__(self, DISPLAY_LINES, setup, menu_controller):
## NVMe available?
if lib_storage.get_available_partitions(StorageType='nvme'):
local_services.append('nvme')
local_targets.append('nvme')

# backups
cloudservices = []
Expand All @@ -107,6 +106,9 @@ def __init__(self, DISPLAY_LINES, setup, menu_controller):
for i in range(len(rclone_cloudservices)):
cloudservices.append(f'cloud:{rclone_cloudservices[i]}')

## ftp
cloudservices.append('ftp')

# generate menues
BACKUP_SOURCES_MENU = []

Expand All @@ -123,13 +125,13 @@ def __init__(self, DISPLAY_LINES, setup, menu_controller):

for target in (local_services + cloudservices):

# check invalid combinations of Source and Target
# check for invalid combinations of Source and Target
if (source == target) and (source != 'usb'):
continue

if target in ['anyusb', 'camera']:
if target in ['anyusb', 'camera', 'ftp']:
continue
if target == 'cloud_rsync' and source in ['anyusb', 'camera']:
if target == 'cloud_rsync' and source in ['anyusb', 'camera', 'ftp']:
continue

# format service parameters
Expand Down Expand Up @@ -258,6 +260,9 @@ def __init__(self, DISPLAY_LINES, setup, menu_controller):

self.GPIO_init()

# debug commands
self.debug()

# iternal loop
while menu_controller.proceed:
time.sleep(1)
Expand Down Expand Up @@ -512,16 +517,24 @@ def move_left(self):
self.display()

##debug
if __name__ == "__main__":
setup=lib_setup.setup()

menu_controller = MENU_CONTROLLER()
def debug(self):
return()

menuobj = menu(DISPLAY_LINES=10, setup=setup, menu_controller=menu_controller)
self.move_right()#debug
self.move_right()#debug
self.move_up()#debug

menuobj.move_right()#debug
menuobj.move_right()#debug
menuobj.move_right()#debug
if __name__ == "__main__":
# setup=lib_setup.setup()
#
# menu_controller = MENU_CONTROLLER()
#
# menuobj = menu(DISPLAY_LINES=10, setup=setup, menu_controller=menu_controller)
#
# menuobj.move_right()#debug
# menuobj.move_right()#debug
# menuobj.move_right()#debug
# menuobj.move_up()#debug
# menuobj.move_right()#debug
# menuobj.move_right()#debug
#
Expand All @@ -532,10 +545,12 @@ def move_left(self):
# time.sleep (0.5)
# menuobj.move_right()#debug
#
# menuobj.move_down(0)#debug
# menuobj.move_down(0)#debug
# menuobj.move_right(0)#debug
# menuobj.move_down(0)#debug
#menuobj.move_right(0)#debug
#menuobj.move_right(0)#debug
# menuobj.move_down()#debug
# menuobj.move_down()#debug
# menuobj.move_right()#debug
# menuobj.move_down()#debug
#menuobj.move_right()#debug
#menuobj.move_right()#debug
# time.sleep(20)

pass
5 changes: 3 additions & 2 deletions scripts/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@
"nvme": "NVMe SSD",
"nvmes": "NVMe SSDs",
"rename": "Umbenennen",
"ftp": "LBB's FTP-Server"
"ftp": "LBBs FTP-Server"
},
"nvme": "NVMe SSD",
"nvme_source": "USB-Quelle",
Expand Down Expand Up @@ -614,7 +614,8 @@
"internal": "Int.",
"nvme": "NVMe SSD",
"usb": "USB",
"anyusb": "alle USB"
"anyusb": "alle USB",
"ftp": "LBBs FTP-Server"
},
"stop": "STOP Backup"
}
Expand Down
5 changes: 3 additions & 2 deletions scripts/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"nvme": "NVMe SSD",
"nvmes": "NVMe SSDs",
"rename": "Rename",
"ftp": "LBB's FTP server"
"ftp": "LBBs FTP server"
},
"nvme": "NVMe SSD",
"nvme_source": "USB-source",
Expand Down Expand Up @@ -220,7 +220,8 @@
"internal": "Int.",
"nvme": "NVMe SSD",
"usb": "USB",
"anyusb": "any USB"
"anyusb": "any USB",
"ftp": "LBBs FTP server"
},
"stop": "STOP backup"
}
Expand Down
3 changes: 2 additions & 1 deletion scripts/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,8 @@
"internal": "Int.",
"nvme": "NVMe SSD",
"usb": "USB",
"anyusb": "todo USB"
"anyusb": "todo USB",
"ftp": "Servidor FTP de LBB"
},
"stop": "DETENER copia"
}
Expand Down
3 changes: 2 additions & 1 deletion scripts/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,8 @@
"internal": "Int.",
"nvme": "NVMe SSD",
"usb": "USB ",
"anyusb": "tout USB"
"anyusb": "tout USB",
"ftp": "Serveur FTP de LBB"
},
"stop": "ARRÊTER sauvegarde"
}
Expand Down

0 comments on commit 91851cf

Please sign in to comment.