forked from solderpunk/AV-98
first netcache
This commit is contained in:
parent
644e8ba08e
commit
a6974bb404
|
@ -0,0 +1,17 @@
|
|||
#!/bin/python
|
||||
import os
|
||||
|
||||
cache_home = os.environ.get('XDG_CACHE_HOME') or\
|
||||
os.path.join(_home,'.cache')
|
||||
_CACHE_PATH = os.path.join(cache_home,"offpunk/")
|
||||
|
||||
if not os.path.exists(_CACHE_PATH):
|
||||
print("Creating cache directory {}".format(_CACHE_PATH))
|
||||
os.makedirs(_CACHE_PATH)
|
||||
|
||||
|
||||
def get_cache_path(url):
|
||||
|
||||
def is_cache_valid(url,validity=0):
|
||||
|
||||
|
|
@ -99,9 +99,6 @@ data_home = os.environ.get('XDG_DATA_HOME') or \
|
|||
os.path.join(_home,'.local','share')
|
||||
config_home = os.environ.get('XDG_CONFIG_HOME') or \
|
||||
os.path.join(_home,'.config')
|
||||
cache_home = os.environ.get('XDG_CACHE_HOME') or\
|
||||
os.path.join(_home,'.cache')
|
||||
_CACHE_PATH = os.path.join(cache_home,"offpunk/")
|
||||
_CONFIG_DIR = os.path.join(config_home,"offpunk/")
|
||||
_DATA_DIR = os.path.join(data_home,"offpunk/")
|
||||
_old_config = os.path.expanduser("~/.offpunk/")
|
||||
|
@ -468,7 +465,7 @@ class GeminiItem():
|
|||
newgi = GeminiItem(url)
|
||||
toreturn.append(newgi)
|
||||
elif url and mode != "links_only" and url.startswith("data:image/"):
|
||||
imgurl,imgdata = looks_like_base64(url,self.url)
|
||||
imgurl,imgdata = ansirenderer.looks_like_base64(url,self.url)
|
||||
if imgurl:
|
||||
toreturn.append(GeminiItem(imgurl))
|
||||
else:
|
||||
|
@ -3218,7 +3215,7 @@ def main():
|
|||
GeminiClient.do_version(None,None)
|
||||
sys.exit()
|
||||
else:
|
||||
for f in [_CONFIG_DIR, _CACHE_PATH, _DATA_DIR]:
|
||||
for f in [_CONFIG_DIR, _DATA_DIR]:
|
||||
if not os.path.exists(f):
|
||||
print("Creating config directory {}".format(f))
|
||||
os.makedirs(f)
|
||||
|
|
Loading…
Reference in New Issue