mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Detect and skip ILIAS tests
This commit is contained in:
parent
342076ee0e
commit
492ec6a932
@ -17,6 +17,7 @@ TargetType = Union[str, int]
|
|||||||
class IliasElementType(Enum):
|
class IliasElementType(Enum):
|
||||||
EXERCISE = "exercise"
|
EXERCISE = "exercise"
|
||||||
EXERCISE_FILES = "exercise_files" # own submitted files
|
EXERCISE_FILES = "exercise_files" # own submitted files
|
||||||
|
TEST = "test" # an online test. Will be ignored currently.
|
||||||
FILE = "file"
|
FILE = "file"
|
||||||
FOLDER = "folder"
|
FOLDER = "folder"
|
||||||
FORUM = "forum"
|
FORUM = "forum"
|
||||||
@ -373,9 +374,8 @@ class IliasPage:
|
|||||||
if "target=file_" in parsed_url.query:
|
if "target=file_" in parsed_url.query:
|
||||||
return IliasElementType.FILE
|
return IliasElementType.FILE
|
||||||
|
|
||||||
# Skip forums
|
# TODO: Match based on CMD_CLASS or icon? The folder_like check looks at the icon,
|
||||||
if "cmd=showThreads" in parsed_url.query:
|
# but we could also match the command class. I am not sure what's more stable.
|
||||||
return IliasElementType.FORUM
|
|
||||||
|
|
||||||
# Everything with a ref_id can *probably* be opened to reveal nested things
|
# Everything with a ref_id can *probably* be opened to reveal nested things
|
||||||
# video groups, directories, exercises, etc
|
# video groups, directories, exercises, etc
|
||||||
@ -432,6 +432,9 @@ class IliasPage:
|
|||||||
if str(img_tag["src"]).endswith("sess.svg"):
|
if str(img_tag["src"]).endswith("sess.svg"):
|
||||||
return IliasElementType.MEETING
|
return IliasElementType.MEETING
|
||||||
|
|
||||||
|
if str(img_tag["src"]).endswith("icon_tst.svg"):
|
||||||
|
return IliasElementType.TEST
|
||||||
|
|
||||||
return IliasElementType.FOLDER
|
return IliasElementType.FOLDER
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -274,6 +274,10 @@ class KitIliasWebCrawler(HttpCrawler):
|
|||||||
log.explain_topic(f"Decision: Crawl {fmt_path(element_path)}")
|
log.explain_topic(f"Decision: Crawl {fmt_path(element_path)}")
|
||||||
log.explain("Forums are not supported")
|
log.explain("Forums are not supported")
|
||||||
log.explain("Answer: No")
|
log.explain("Answer: No")
|
||||||
|
elif element.type == IliasElementType.TEST:
|
||||||
|
log.explain_topic(f"Decision: Crawl {fmt_path(element_path)}")
|
||||||
|
log.explain("Tests contain no relevant files")
|
||||||
|
log.explain("Answer: No")
|
||||||
elif element.type == IliasElementType.LINK:
|
elif element.type == IliasElementType.LINK:
|
||||||
await self._download_link(element, element_path)
|
await self._download_link(element, element_path)
|
||||||
elif element.type == IliasElementType.VIDEO:
|
elif element.type == IliasElementType.VIDEO:
|
||||||
|
Loading…
Reference in New Issue
Block a user