added the --fetch-later command line
This commit is contained in:
parent
7a17f04343
commit
7ff4065493
|
@ -73,7 +73,7 @@ To avoid using unstable or too recent libraries, the rule of thumb is that a lib
|
||||||
* Support "subscriptions" to a page. New content seen in bookmarked pages are automatically added to your next tour.
|
* Support "subscriptions" to a page. New content seen in bookmarked pages are automatically added to your next tour.
|
||||||
* TOFU or CA server certificate validation
|
* TOFU or CA server certificate validation
|
||||||
* Extensive client certificate support if an `openssl` binary is available
|
* Extensive client certificate support if an `openssl` binary is available
|
||||||
* Ability to specify external handler programs for different MIME types
|
* Ability to specify external handler programs for different MIME types (use `handler`)
|
||||||
* Gopher proxy support (e.g. for use with
|
* Gopher proxy support (e.g. for use with
|
||||||
[Agena](https://tildegit.org/solderpunk/agena))
|
[Agena](https://tildegit.org/solderpunk/agena))
|
||||||
* Advanced navigation tools like `tour` and `mark` (as per VF-1). Unlike AV-98, tour is saved on disk accross sessions.
|
* Advanced navigation tools like `tour` and `mark` (as per VF-1). Unlike AV-98, tour is saved on disk accross sessions.
|
||||||
|
|
23
offpunk.py
23
offpunk.py
|
@ -617,7 +617,7 @@ class GeminiItem():
|
||||||
cache.write(str(datetime.datetime.now())+"\n")
|
cache.write(str(datetime.datetime.now())+"\n")
|
||||||
cache.write("ERROR while caching %s\n" %self.url)
|
cache.write("ERROR while caching %s\n" %self.url)
|
||||||
cache.write(str(err))
|
cache.write(str(err))
|
||||||
cache.write("If you believe this error was temporary, type ""reload"".\n")
|
cache.write("\n\nIf you believe this error was temporary, type ""reload"".\n")
|
||||||
cache.write("The ressource will be tentatively fetched during next sync.\n")
|
cache.write("The ressource will be tentatively fetched during next sync.\n")
|
||||||
cache.write("\n")
|
cache.write("\n")
|
||||||
cache.close()
|
cache.close()
|
||||||
|
@ -1696,6 +1696,7 @@ Use with "raw" to copy the content as seen in your terminal (not gemtext)"""
|
||||||
line = self.gi.url + '\n'
|
line = self.gi.url + '\n'
|
||||||
sf.write(line)
|
sf.write(line)
|
||||||
sf.close()
|
sf.close()
|
||||||
|
print("%s marked for syncing" %self.gi.url)
|
||||||
else:
|
else:
|
||||||
self._go_to_gi(self.gi, check_cache=False)
|
self._go_to_gi(self.gi, check_cache=False)
|
||||||
|
|
||||||
|
@ -2142,6 +2143,8 @@ def main():
|
||||||
parser.add_argument('--restricted', action="store_true", help='Disallow shell, add, and save commands')
|
parser.add_argument('--restricted', action="store_true", help='Disallow shell, add, and save commands')
|
||||||
parser.add_argument('--sync', action='store_true',
|
parser.add_argument('--sync', action='store_true',
|
||||||
help='run non-interactively to build cache by exploring bookmarks')
|
help='run non-interactively to build cache by exploring bookmarks')
|
||||||
|
parser.add_argument('--fetch-later', action='store_true',
|
||||||
|
help='run non-interactively with an URL as argument to fetch it later')
|
||||||
parser.add_argument('--cache-validity',
|
parser.add_argument('--cache-validity',
|
||||||
help='duration for which a cache is valid before sync (seconds)')
|
help='duration for which a cache is valid before sync (seconds)')
|
||||||
parser.add_argument('--version', action='store_true',
|
parser.add_argument('--version', action='store_true',
|
||||||
|
@ -2176,7 +2179,7 @@ def main():
|
||||||
gc.cmdqueue.append(line)
|
gc.cmdqueue.append(line)
|
||||||
|
|
||||||
# Say hi
|
# Say hi
|
||||||
if not args.sync:
|
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!")
|
||||||
|
@ -2199,7 +2202,21 @@ def main():
|
||||||
gc.cmdqueue.append("tour")
|
gc.cmdqueue.append("tour")
|
||||||
|
|
||||||
# Endless interpret loop
|
# Endless interpret loop
|
||||||
if args.sync:
|
if args.fetch_later:
|
||||||
|
if args.url:
|
||||||
|
# we go offline to fetch later and in sync-only to not display anything
|
||||||
|
gc.onecmd("offline")
|
||||||
|
gc.sync_only = True
|
||||||
|
for u in args.url:
|
||||||
|
gc.onecmd("go %s"%u)
|
||||||
|
if gc.gi and u in gc.gi.url and gc.gi.is_cache_valid():
|
||||||
|
# forcing re-fetch in case an old catch already exists
|
||||||
|
# FIXME : this will be fetched too many times,
|
||||||
|
# should be handled on the to_fetch level
|
||||||
|
gc.onecmd("reload")
|
||||||
|
else:
|
||||||
|
print("--netch-later requires an URL (or a list of URLS) as argument")
|
||||||
|
elif args.sync:
|
||||||
# fetch_cache is the core of the sync algorithm.
|
# fetch_cache is the core of the sync algorithm.
|
||||||
# It takes as input :
|
# It takes as input :
|
||||||
# - a GeminiItem to be fetched
|
# - a GeminiItem to be fetched
|
||||||
|
|
Loading…
Reference in New Issue
Block a user