Skip to content

Commit

Permalink
Remove dublicate printers from the list
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeoLacruz committed Jan 18, 2025
1 parent 1dbbf87 commit f217aa9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ your setup. When the Get Printer Info switch is set ON, the driver calls each pr
once a minute and collects some info about it. It calls the printer configured
in the settings as well as all printers it finds in the label templates.
In case a printer is unreachable, an error message is shown.

![Printer Info](https://github.com/SergeoLacruz/inventree-zebra-plugin/blob/master/pictures/printer_info.png)

## How it works
Expand Down
4 changes: 3 additions & 1 deletion inventree_zebra/zebra_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def print_label(self, **kwargs):
def get_generated_file(self, **kwargs):
return self.preview_result

# -----------------------------------------------------------------------------
def ping_printer(self, *args, **kwargs):

printer_data = []
Expand Down Expand Up @@ -342,7 +343,8 @@ def collect_all_ipprinter(self):
for template in all_templates:
try:
if 'ip_address' in template.metadata:
all_printer.append(template.metadata['ip_address'])
if template.metadata['ip_address'] not in all_printer:
all_printer.append(template.metadata['ip_address'])
except Exception:
pass
return all_printer

0 comments on commit f217aa9

Please sign in to comment.