mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Replace "/" in file names with "."
This commit is contained in:
parent
616a8d96a2
commit
3019e4255b
@ -51,7 +51,7 @@ class FfM:
|
|||||||
|
|
||||||
for found in soup.find_all("a", href=self.LINK_RE):
|
for found in soup.find_all("a", href=self.LINK_RE):
|
||||||
url = found["href"]
|
url = found["href"]
|
||||||
filename = re.match(self.LINK_RE, url).group(1)
|
filename = re.match(self.LINK_RE, url).group(1).replace("/", ".")
|
||||||
logger.debug(f"Found file {filename} at {url}")
|
logger.debug(f"Found file {filename} at {url}")
|
||||||
|
|
||||||
old_path = pathlib.PurePath(filename)
|
old_path = pathlib.PurePath(filename)
|
||||||
|
@ -80,7 +80,7 @@ class ILIAS:
|
|||||||
|
|
||||||
found = soup.find_all("a", {"class": "il_ContainerItemTitle", "href": self.FILE_RE})
|
found = soup.find_all("a", {"class": "il_ContainerItemTitle", "href": self.FILE_RE})
|
||||||
for element in found:
|
for element in found:
|
||||||
file_stem = element.string.strip()
|
file_stem = element.string.strip().replace("/", ".")
|
||||||
file_type = element.parent.parent.parent.find("div", {"class": "il_ItemProperties"}).find("span").string.strip()
|
file_type = element.parent.parent.parent.find("div", {"class": "il_ItemProperties"}).find("span").string.strip()
|
||||||
file_id = re.search(self.FILE_RE, element.get("href")).group(1)
|
file_id = re.search(self.FILE_RE, element.get("href")).group(1)
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ class ILIAS:
|
|||||||
|
|
||||||
found = soup.find_all("a", {"class": "il_ContainerItemTitle", "href": self.DIR_RE})
|
found = soup.find_all("a", {"class": "il_ContainerItemTitle", "href": self.DIR_RE})
|
||||||
for element in found:
|
for element in found:
|
||||||
dir_name = element.string.strip()
|
dir_name = element.string.strip().replace("/", ".")
|
||||||
ref_id = re.search(self.DIR_RE, element.get("href")).group(1)
|
ref_id = re.search(self.DIR_RE, element.get("href")).group(1)
|
||||||
dir_id = f"fold_{ref_id}"
|
dir_id = f"fold_{ref_id}"
|
||||||
dirs.append((dir_name, dir_id))
|
dirs.append((dir_name, dir_id))
|
||||||
|
Loading…
Reference in New Issue
Block a user