--fetch-later now directly add to tour if a cached version already exists
This commit is contained in:
parent
26009c7f75
commit
e1ab504f69
|
@ -4,6 +4,7 @@
|
||||||
- Pictures are now displayed directely in terminal (suggested by kelbot)
|
- Pictures are now displayed directely in terminal (suggested by kelbot)
|
||||||
- Introducing the "open" command to open current page/image/file with external handler.
|
- Introducing the "open" command to open current page/image/file with external handler.
|
||||||
- "set width XX" will now work everywhere (thanks kelbot for reporting the bug)
|
- "set width XX" will now work everywhere (thanks kelbot for reporting the bug)
|
||||||
|
- RSS feeds are now rendered as Gemlogs to improve consistency while browsing
|
||||||
- Improved syncing performances and multiple bug/crash fixes.
|
- Improved syncing performances and multiple bug/crash fixes.
|
||||||
|
|
||||||
## 0.3 - Feb 11th 2022
|
## 0.3 - Feb 11th 2022
|
||||||
|
|
20
offpunk.py
20
offpunk.py
|
@ -422,7 +422,7 @@ class GopherRenderer(AbstractRenderer):
|
||||||
|
|
||||||
|
|
||||||
class FolderRenderer(GemtextRenderer):
|
class FolderRenderer(GemtextRenderer):
|
||||||
def prepare(self,body):
|
def prepare(self,body,mode=None):
|
||||||
def write_list(l):
|
def write_list(l):
|
||||||
path = os.path.join(listdir,l+".gmi")
|
path = os.path.join(listdir,l+".gmi")
|
||||||
gi = GeminiItem("file://" + path)
|
gi = GeminiItem("file://" + path)
|
||||||
|
@ -2944,8 +2944,6 @@ See also :
|
||||||
else:
|
else:
|
||||||
self.list_go_to_line(args[1],args[0].lower())
|
self.list_go_to_line(args[1],args[0].lower())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def do_help(self, arg):
|
def do_help(self, arg):
|
||||||
"""ALARM! Recursion detected! ALARM! Prepare to eject!"""
|
"""ALARM! Recursion detected! ALARM! Prepare to eject!"""
|
||||||
if arg == "!":
|
if arg == "!":
|
||||||
|
@ -3011,7 +3009,6 @@ current gemini browsing session."""
|
||||||
certfile = os.path.join(_CONFIG_DIR, "transient_certs", cert+ext)
|
certfile = os.path.join(_CONFIG_DIR, "transient_certs", cert+ext)
|
||||||
if os.path.exists(certfile):
|
if os.path.exists(certfile):
|
||||||
os.remove(certfile)
|
os.remove(certfile)
|
||||||
print()
|
|
||||||
print("You can close your screen!")
|
print("You can close your screen!")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
@ -3053,6 +3050,7 @@ def main():
|
||||||
# Instantiate client
|
# Instantiate client
|
||||||
gc = GeminiClient(restricted=args.restricted,synconly=args.sync)
|
gc = GeminiClient(restricted=args.restricted,synconly=args.sync)
|
||||||
|
|
||||||
|
if not args.sync and not args.fetch_later:
|
||||||
# Process config file
|
# Process config file
|
||||||
rcfile = os.path.join(_CONFIG_DIR, "offpunkrc")
|
rcfile = os.path.join(_CONFIG_DIR, "offpunkrc")
|
||||||
if os.path.exists(rcfile):
|
if os.path.exists(rcfile):
|
||||||
|
@ -3069,9 +3067,6 @@ def main():
|
||||||
print("Skipping rc command \"%s\" due to provided URLs." % line)
|
print("Skipping rc command \"%s\" due to provided URLs." % line)
|
||||||
continue
|
continue
|
||||||
gc.cmdqueue.append(line)
|
gc.cmdqueue.append(line)
|
||||||
|
|
||||||
# Say hi
|
|
||||||
if not args.sync and not args.fetch_later:
|
|
||||||
print("Welcome to Offpunk!")
|
print("Welcome to Offpunk!")
|
||||||
if args.restricted:
|
if args.restricted:
|
||||||
print("Restricted mode engaged!")
|
print("Restricted mode engaged!")
|
||||||
|
@ -3099,14 +3094,13 @@ def main():
|
||||||
# Endless interpret loop
|
# Endless interpret loop
|
||||||
if args.fetch_later:
|
if args.fetch_later:
|
||||||
if args.url:
|
if args.url:
|
||||||
# we go offline to fetch later and in sync-only to not display anything
|
|
||||||
gc.onecmd("offline")
|
|
||||||
gc.sync_only = True
|
gc.sync_only = True
|
||||||
for u in args.url:
|
for u in args.url:
|
||||||
gc.onecmd("go %s"%u)
|
gi = GeminiItem(u)
|
||||||
if gc.gi and u in gc.gi.url and gc.gi.is_cache_valid():
|
if gi and gi.is_cache_valid():
|
||||||
# forcing re-fetch in case an old catch already exists
|
gc.list_add_line("tour",gi)
|
||||||
gc.onecmd("reload")
|
else:
|
||||||
|
gc.list_add_line("to_fetch",gi)
|
||||||
else:
|
else:
|
||||||
print("--fetch-later requires an URL (or a list of URLS) as argument")
|
print("--fetch-later requires an URL (or a list of URLS) as argument")
|
||||||
elif args.sync:
|
elif args.sync:
|
||||||
|
|
Loading…
Reference in New Issue