diwakargrandhi / imscc-file-converter

Convert an imscc file to a folder with all the content with proper structure
MIT License
8 stars 2 forks source link

Does not properly handle links to websites #9

Open DavidAyliffe opened 7 years ago

DavidAyliffe commented 7 years ago

I have exported an IMSCC from Schoology (our LMS). This LMS allows us to add links to websites The attached image shows that the item "City pictures · Pexels · Free Stock Photos" is just a link to this website: https://www.pexels.com/search/city/

Your script falls over when it encounters such an error.

Here is the debug logs:

[2017-05-10 10:00:24,032] {convert_imscc_file.py:156} DEBUG - XML element obtained is:

City pictures · Pexels · Free Stock Photos

[2017-05-10 10:00:24,032] {convert_imscc_file.py:159} DEBUG - src_folder_identifier obtained is: ccres0000052 [2017-05-10 10:00:24,033] {convert_imscc_file.py:327} ERROR - Error converting imscc file: Home-Speaking-2.imscc Traceback (most recent call last): File "convert_imscc_file.py", line 316, in process_xml_data(xml_data, imscc_zip_file_extracted_path, tmp_folder_for_structured_data_path) File "convert_imscc_file.py", line 233, in process_xml_data process_node(child_item_node, resources_data, src_dir_path, dst_dir_path) File "convert_imscc_file.py", line 177, in process_node process_node(each_item, resources_data, new_src_dir_path, new_dst_dir_path) File "convert_imscc_file.py", line 177, in process_node process_node(each_item, resources_data, new_src_dir_path, new_dst_dir_path) File "convert_imscc_file.py", line 177, in process_node process_node(each_item, resources_data, new_src_dir_path, new_dst_dir_path) File "convert_imscc_file.py", line 163, in process_node logger.debug("title node obtained is: {0}".format(xml_element.getElementsByTagName('title')[0].toprettyxml(indent = ' '))) UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 21: ordinal not in range(128) [2017-05-10 10:00:24,033] {convert_imscc_file.py:51} DEBUG - Deleting directory /Users/ydo/Downloads/IMSCC/temp [2017-05-10 10:00:24,033] {convert_imscc_file.py:331} INFO - Ending convert_imscc_to_zip script.

Attached is the .xml file for the weblink (rename to .xml) ccres0000052.xml.txt

link

Thank you very much for your work on this. If you want the entire archive I'm using your script to try to reconstruct, drop me an email (ayliffe.david@gmail.com)

DavidAyliffe commented 7 years ago

the desired behaviour is the creation of a .webloc file which links to the referenced website