diff --git a/bin/clockcurses b/bin/clockcurses index a236540..eceb4c9 100755 --- a/bin/clockcurses +++ b/bin/clockcurses @@ -101,9 +101,8 @@ def saddstr(win, y, x, s, a=None): pass -def drawcircle(win, cy, cx, r, s="·", attr=None): +def drawcircle(win, cy, cx, r, s="·", attr=None, precision=360): # TODO: get seconds?, color by angle, darkening to past. current seconds bright - precision = 360 for a in range(precision): alpha = 2.0 * math.pi * a / precision dy = int(round(cy - float(r) * math.cos(alpha))) @@ -233,6 +232,7 @@ def main(): is_alarm = False t_old = time.localtime(time.time()) tick_tock = False + exact_seconds = options.refresh % 1 == 0 try: # rows,columns = termsize() curses.cbreak() @@ -247,7 +247,7 @@ def main(): t_h, t_m = divmod(t_m, 60) f = 0 else: - f = now % 1 + f = 0 if exact_seconds else now % 1 t_s = float(t.tm_sec) t_m = float(t.tm_min) t_h = float(t.tm_hour) @@ -260,12 +260,16 @@ def main(): tick_tock = not tick_tock if options.refresh > 1 else t.tm_sec % 2 + #for s in range(60): + # drawline(stdscr, cy, cx, math.pi * s / 30.0, r-2, r / 2, "∙", + # attr=curses.color_pair(2) + curses.A_BOLD + curses.A_BLINK if is_alarm else curses.color_pair(8)) drawcircle( stdscr, cy, cx, r / 2, - attr=curses.color_pair(2) + curses.A_BOLD + curses.A_BLINK if is_alarm else curses.color_pair(1), + attr=curses.color_pair(2) + curses.A_BOLD + curses.A_BLINK if is_alarm else curses.color_pair(8), + precision=60 ) if options.seconds: drawline(stdscr, cy, cx, alphas, 1, r / 2, "■", curses.color_pair(2)) diff --git a/py-packages/SimpleWebPage.tgz b/py-packages/SimpleWebPage.tgz index 5a4bbc2..9f810e9 100644 Binary files a/py-packages/SimpleWebPage.tgz and b/py-packages/SimpleWebPage.tgz differ diff --git a/py-packages/SimpleWebPage/simplewebpage/__init__.py b/py-packages/SimpleWebPage/simplewebpage/__init__.py index 8e1ceb0..f46f9b5 100755 --- a/py-packages/SimpleWebPage/simplewebpage/__init__.py +++ b/py-packages/SimpleWebPage/simplewebpage/__init__.py @@ -22,7 +22,7 @@ try: except ImportError: MARKDOWN_AVAILABLE = False -VERSION = "20221124" +VERSION = "20240626" IMAGE_EXTENSIONS = ["png", "gif", "jpg", "jpeg", "tif", "tiff"] AUDIO_EXTENSIONS = ["wav", "mp3", "ogg"] VIDEO_EXTENSIONS = ["mp4", "ogg", "webm"] @@ -34,6 +34,7 @@ SAFE_OPTS = ( "images", "media", "includes", + "excludes", "no_readme", "no_wget", "reverse", @@ -141,6 +142,15 @@ def setup(): help="Glob match for files to be included in the table. ex. *.jpg. You can pass several includes.", nargs="*", ) + parser.add_argument( + "--exclude", + "-e", + action="store", + dest="excludes", + default=[""], + help="Glob match for files to be excluded from the table. ex. *.jpg. You can pass several excludes.", + nargs="*", + ) parser.add_argument("--version", action="version", version=VERSION) parser.add_argument( "path", @@ -247,8 +257,8 @@ def generate_index(opts): print_setup(opts) files = [f for f in files if f != opts.filename] files = [f for f in files if f != opts.password_filename] - files = match_files(files, opts.includes) - dirs = match_files(dirs, opts.includes) + files = match_files(files, opts.includes, opts.excludes) + dirs = match_files(dirs, opts.includes, opts.excludes) dirs.sort(reverse=opts.reverse) files.sort(reverse=opts.reverse) files.sort(key=lambda x: x.find("/") > 0) @@ -1081,12 +1091,14 @@ def is_videofile(fname): return False -def match_files(files, glob_list): +def match_files(files, include_list, exclude_list): matched = [] for f in files: - for g in glob_list: - if fnmatch.fnmatch(f, g): - matched.append(f) + for in_g in include_list: + if fnmatch.fnmatch(f, in_g): + for ex_g in exclude_list: + if not fnmatch.fnmatch(f, ex_g): + matched.append(f) break return matched