diff options
author | Juhani Krekelä | 2024-10-11 22:33:31 +0300 |
---|---|---|
committer | Wolfgang Müller | 2024-10-26 19:24:09 +0200 |
commit | 90121061eb9cb42f07b15027e2a920841cfe4dfe (patch) | |
tree | 1bf053f30aa8244bafcd720982aedbc8a3e424c9 | |
parent | 4edfbe1745587a54a7900e1528d3c95c6edceafb (diff) | |
download | later-90121061eb9cb42f07b15027e2a920841cfe4dfe.tar.gz |
Pass title_map explicitly when formatting WatchLaterEntry
WatchLaterEntry's __str__ method implicitly depends on the title_map
variable existing in the global scope. This makes the dependency on the
title_map explicit.
-rwxr-xr-x | later | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -42,7 +42,7 @@ class WatchLaterEntry: path: str mtime: dt - def __str__(self): + def format(self, title_map): def format_time(time): now = dt.now() if time < now - datetime.timedelta(days=7): @@ -171,6 +171,6 @@ args = parser.parse_args() title_map = TitleMap(title_map_file, update=args.update_titles) for entry in entries(): - print(entry) + print(entry.format(title_map)) title_map.maybe_commit() |