Skip to content

Commit

Permalink
0.1.2
Browse files Browse the repository at this point in the history
fix byte encoding errors
resolve conflict with CommandSplitter plugin
  • Loading branch information
jneilliii committed May 23, 2020
1 parent d56a152 commit bd43a4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions octoprint_prusaslicerthumbnails/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def _extract_thumbnail(self, gcode_filename, thumbnail_filename):
with open(gcode_filename,"rb") as gcode_file:
for line in gcode_file:
lineNum += 1
line = line.decode("utf-8", "ignore")
gcode = octoprint.util.comm.gcode_command_for_cmd(line)
extrusionMatch = octoprint.util.comm.regexes_parameters["floatE"].search(line)
if gcode == "G1" and extrusionMatch:
Expand All @@ -67,8 +68,8 @@ def _extract_thumbnail(self, gcode_filename, thumbnail_filename):
if line.startswith(";") or line.startswith("\n"):
collectedString += line
self._logger.debug(collectedString)
test_str = collectedString
test_str = test_str.replace(octoprint.util.to_native_str('\r\n'),octoprint.util.to_native_str('\n'))
test_str = collectedString.replace(octoprint.util.to_native_str('\r\n'),octoprint.util.to_native_str('\n'))
test_str = test_str.replace(octoprint.util.to_native_str(';\n;\n'),octoprint.util.to_native_str(';\n\n;\n'))
matches = re.findall(regex, test_str, re.MULTILINE)
if len(matches) > 0:
path = os.path.dirname(thumbnail_filename)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
plugin_name = "PrusaSlicer Thumbnails"

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

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

0 comments on commit bd43a4d

Please sign in to comment.