mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Ignore SCORM learning modules
This commit is contained in:
parent
df3514cd03
commit
50b50513c6
@ -30,6 +30,7 @@ ambiguous situations.
|
|||||||
- Remove size suffix for files in content pages
|
- Remove size suffix for files in content pages
|
||||||
- Sanitize ascii control characters on Windows
|
- Sanitize ascii control characters on Windows
|
||||||
- Crawling of paginated past meetings
|
- Crawling of paginated past meetings
|
||||||
|
- Ignore SCORM learning modules
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- `no-delete-prompt-override` conflict resolution strategy
|
- `no-delete-prompt-override` conflict resolution strategy
|
||||||
|
@ -27,6 +27,7 @@ class IliasElementType(Enum):
|
|||||||
BOOKING = "booking"
|
BOOKING = "booking"
|
||||||
MEETING = "meeting"
|
MEETING = "meeting"
|
||||||
SURVEY = "survey"
|
SURVEY = "survey"
|
||||||
|
SCORM_LEARNING_MODULE = "scorm_learning_module"
|
||||||
MEDIACAST_VIDEO_FOLDER = "mediacast_video_folder"
|
MEDIACAST_VIDEO_FOLDER = "mediacast_video_folder"
|
||||||
MEDIACAST_VIDEO = "mediacast_video"
|
MEDIACAST_VIDEO = "mediacast_video"
|
||||||
OPENCAST_VIDEO = "opencast_video"
|
OPENCAST_VIDEO = "opencast_video"
|
||||||
@ -953,6 +954,9 @@ class IliasPage:
|
|||||||
if "baseClass=ilMediaCastHandlerGUI" in parsed_url.query:
|
if "baseClass=ilMediaCastHandlerGUI" in parsed_url.query:
|
||||||
return IliasElementType.MEDIACAST_VIDEO_FOLDER
|
return IliasElementType.MEDIACAST_VIDEO_FOLDER
|
||||||
|
|
||||||
|
if "baseClass=ilSAHSPresentationGUI" in parsed_url.query:
|
||||||
|
return IliasElementType.SCORM_LEARNING_MODULE
|
||||||
|
|
||||||
# Booking and Meeting can not be detected based on the link. They do have a ref_id though, so
|
# Booking and Meeting can not be detected based on the link. They do have a ref_id though, so
|
||||||
# try to guess it from the image.
|
# try to guess it from the image.
|
||||||
|
|
||||||
@ -1031,6 +1035,9 @@ class IliasPage:
|
|||||||
if str(img_tag["src"]).endswith("icon_mcst.svg"):
|
if str(img_tag["src"]).endswith("icon_mcst.svg"):
|
||||||
return IliasElementType.MEDIACAST_VIDEO_FOLDER
|
return IliasElementType.MEDIACAST_VIDEO_FOLDER
|
||||||
|
|
||||||
|
if str(img_tag["src"]).endswith("icon_sahs.svg"):
|
||||||
|
return IliasElementType.SCORM_LEARNING_MODULE
|
||||||
|
|
||||||
return IliasElementType.FOLDER
|
return IliasElementType.FOLDER
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -403,6 +403,14 @@ instance's greatest bottleneck.
|
|||||||
"[bright_black](surveys contain no relevant data)"
|
"[bright_black](surveys contain no relevant data)"
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
elif element.type == IliasElementType.SCORM_LEARNING_MODULE:
|
||||||
|
log.status(
|
||||||
|
"[bold bright_black]",
|
||||||
|
"Ignored",
|
||||||
|
fmt_path(element_path),
|
||||||
|
"[bright_black](scorm learning modules are not supported)"
|
||||||
|
)
|
||||||
|
return None
|
||||||
elif element.type == IliasElementType.LEARNING_MODULE:
|
elif element.type == IliasElementType.LEARNING_MODULE:
|
||||||
return await self._handle_learning_module(element, element_path)
|
return await self._handle_learning_module(element, element_path)
|
||||||
elif element.type == IliasElementType.LINK:
|
elif element.type == IliasElementType.LINK:
|
||||||
@ -897,7 +905,7 @@ instance's greatest bottleneck.
|
|||||||
soup = soupify(await request.read())
|
soup = soupify(await request.read())
|
||||||
if self._is_logged_in(soup):
|
if self._is_logged_in(soup):
|
||||||
return self._verify_page(soup, url, root_page_allowed)
|
return self._verify_page(soup, url, root_page_allowed)
|
||||||
raise CrawlError("get_page failed even after authenticating")
|
raise CrawlError(f"get_page failed even after authenticating on {url!r}")
|
||||||
|
|
||||||
def _verify_page(self, soup: BeautifulSoup, url: str, root_page_allowed: bool) -> BeautifulSoup:
|
def _verify_page(self, soup: BeautifulSoup, url: str, root_page_allowed: bool) -> BeautifulSoup:
|
||||||
if IliasPage.is_root_page(soup) and not root_page_allowed:
|
if IliasPage.is_root_page(soup) and not root_page_allowed:
|
||||||
|
Loading…
Reference in New Issue
Block a user