aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xlater25
1 files changed, 13 insertions, 12 deletions
diff --git a/later b/later
index da7d791..0ba6498 100755
--- a/later
+++ b/later
@@ -43,7 +43,18 @@ def entries():
for entry in sorted(entries, key=get_mtime):
if entry.is_file():
mtime = dt.fromtimestamp(get_mtime(entry))
- yield entry.path, entry.name, mtime
+
+ with open(entry.path, "r") as handle:
+ first = handle.readline().rstrip()
+
+ name = entry.name
+ if first.startswith("# "):
+ name = first.strip("# ")
+
+ if name == "redirect entry":
+ continue
+
+ yield entry.path, name, mtime
parser = argparse.ArgumentParser(
@@ -78,17 +89,7 @@ except json.decoder.JSONDecodeError:
except Exception as err:
sys.exit(f"later: {err}")
-for path, basename, mtime in entries():
- with open(path, "r") as handle:
- first = handle.readline().rstrip()
-
- name = basename
- if first.startswith("# "):
- name = first.strip("# ")
-
- if name == "redirect entry":
- continue
-
+for path, name, mtime in entries():
if args.update_titles and name not in title_map:
if re.fullmatch(r"https?://.*", name):
try: