More efficient flat file list format and various UX improvements #3

Merged
leo merged 19 commits from major-upgrade into main 2023-11-12 23:20:40 +00:00
Showing only changes of commit 97c694a654 - Show all commits

View File

@ -1,6 +1,7 @@
import asyncio
import shutil
import stat
import sys
import threading
import time
from os import stat_result
@ -147,11 +148,12 @@ def watcher_thread(loop):
rootpath = config.config.path
i = inotify.adapters.InotifyTree(rootpath.as_posix())
# Initialize the tree from filesystem
old, new = state.root, walk()
if old != new:
new = walk()
with state.lock:
old = state.root
if old != new:
state.root = new
broadcast(format_root(new), loop)
broadcast(format_update(old, new), loop)
# The watching is not entirely reliable, so do a full refresh every minute
refreshdl = time.monotonic() + 60.0
@ -330,7 +332,7 @@ async def abroadcast(msg):
async def start(app, loop):
config.load_config()
use_inotify = False # sys.platform == "linux"
use_inotify = sys.platform == "linux"
app.ctx.watcher = threading.Thread(
target=watcher_thread if use_inotify else watcher_thread_poll,
args=[loop],