def media_url(f, absolute=True): f = shard(f) cdn = _cfg("cdn") domain = _cfg("domain") base = _cfg("protocol") + "://" + domain if len(cdn) == 0 else cdn return '%s/%s' % (base, f) if absolute else '/%s' % f
def migrate(args): base = _cfg("storage_folder") for f in os.listdir(base): path = os.path.join(base, f) if os.path.isfile(path): newpath = os.path.join(base, shard(f)) try: print(("Moving " + path + " into " + newpath)) os.rename(path, newpath) except: print("Move failed")
def migrate(args): base = _cfg("storage_folder") for f in os.listdir(base): path = os.path.join(base, f) if os.path.isfile(path): newpath = os.path.join(base, shard(f)) try: print("Moving " + path + " into " + newpath) os.rename(path, newpath) except: print("Move failed")
def bbcode_still(self, h): return "[img]%s[/img]" % domain_url(shard(h))
def html_still(self, h): return "<img src='%s'>" % domain_url(shard(h))
def markdown_still(self, h): return "![](%s)" % domain_url(shard(h))