Skip to content

Commit bd43a4d

Browse files
committed
0.1.2
fix byte encoding errors resolve conflict with CommandSplitter plugin
1 parent d56a152 commit bd43a4d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

octoprint_prusaslicerthumbnails/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def _extract_thumbnail(self, gcode_filename, thumbnail_filename):
5959
with open(gcode_filename,"rb") as gcode_file:
6060
for line in gcode_file:
6161
lineNum += 1
62+
line = line.decode("utf-8", "ignore")
6263
gcode = octoprint.util.comm.gcode_command_for_cmd(line)
6364
extrusionMatch = octoprint.util.comm.regexes_parameters["floatE"].search(line)
6465
if gcode == "G1" and extrusionMatch:
@@ -67,8 +68,8 @@ def _extract_thumbnail(self, gcode_filename, thumbnail_filename):
6768
if line.startswith(";") or line.startswith("\n"):
6869
collectedString += line
6970
self._logger.debug(collectedString)
70-
test_str = collectedString
71-
test_str = test_str.replace(octoprint.util.to_native_str('\r\n'),octoprint.util.to_native_str('\n'))
71+
test_str = collectedString.replace(octoprint.util.to_native_str('\r\n'),octoprint.util.to_native_str('\n'))
72+
test_str = test_str.replace(octoprint.util.to_native_str(';\n;\n'),octoprint.util.to_native_str(';\n\n;\n'))
7273
matches = re.findall(regex, test_str, re.MULTILINE)
7374
if len(matches) > 0:
7475
path = os.path.dirname(thumbnail_filename)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
plugin_name = "PrusaSlicer Thumbnails"
1515

1616
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
17-
plugin_version = "0.1.1"
17+
plugin_version = "0.1.2"
1818

1919
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
2020
# module

0 commit comments

Comments
 (0)