Commit 08f37555 by murtaugh

feeder

parent 8da3d1ee
Showing with 9 additions and 9 deletions
......@@ -105,13 +105,6 @@ def wget (url, cachedir, blocksize=4*1000):
# n = re.sub(r"[^a-zA-Z0-9éèàùçëöäü_\-]", "", n)
# return n
def pagename_for_url (url):
""" Example: """
p = urlparse(url)
hostname = p.netloc
if ":" in hostname:
hostname = hostname.split(":")[0]
return os.path.join(hostname, os.path.basename(p.path))
# def filename_for_url (url):
# filename = get_url_filename(imgurl)
......@@ -171,6 +164,13 @@ def md5hash (x):
m.update(x.encode("utf-8"))
return m.hexdigest().upper()
def pagename_for_url (url):
""" Example: """
p = urlparse(url)
hostname = p.netloc
if ":" in hostname:
hostname = hostname.split(":")[0]
return os.path.join(hostname, os.path.basename(p.path))
def get_site_page_and_data (wiki, url):
result = wiki.get("cargoquery",
......@@ -222,12 +222,12 @@ def process_feed_item (item, source, cachedir, wiki=None, download=True, phpuplo
for i, pair in enumerate(transcode(filename, hsh)):
f, h = pair
_, ext = os.path.splitext(f)
wikifilename = basename+h+ext
# wikifilename = basename+h+ext
# print ("Uploading data from {0} to wiki as {1}".format(link, wikifilename), file=sys.stderr)
description = "{0} {1}".format(link, dt.strftime("%Y/%m/%d"))
if sourcefile:
description += "\n\nVersion de [[{0}]]".format(sourcefile.name)
wikifile = upload_file_to_wiki(wiki, f, wikifilename, description, phpuploader=phpuploader)
wikifile = upload_file_to_wiki(wiki, f, None, description, phpuploader=phpuploader)
if i == 0:
gallery.append(wikifile.name)
sourcefile = wikifile
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment