# Path: lib/Utility.py
# RE_COMPILED_TYPE = type(re.compile(''))
# POE_NINJA_API = 'http://api.poe.ninja/api/Data/'
#     CONFIG_FNAME = "cfg\\app.ini"
# class MsgType(IntEnum):
# class Messenger:
# class AppException(Exception):
# class CompileException(AppException):
# class AppConfiguration:
# class NoIndent(object):
# class NoIndentEncoder(json.JSONEncoder):
# class ConfidenceLevel(IntEnum):
#     def __init__(self):
#     def send_tmsg(self, msg, log_level=logging.NOTSET, tag=None):
#     def send_msg(self, msg, log_level=logging.NOTSET, timed=False, tag=None):
#     def send_stopped(self):
#     def send_update_id(self, id):
#     def send_object(self, obj):
#     def __init__(self):
#     def load(self):
#     def load_default(self):
#     def _load_settings(self, settings=None):
#     def update(self, cfg):
#     def save(self):
# def getBytesFromURL(url, handle=None, max_attempts=1, connect_timeout=None, timeout=None, gzip=True):
# def getJsonFromURL(url, handle=None, max_attempts=1, gzip=True):
# def getDataFromUrl(url, callback, max_attempts=1):
# def str2bool(val):
# def round_up(num):
# def round_down(num):
# def dround(num, ndigits=2):
# def tmsg(msg):
# def getBaseUrl(url):
# def isAbsoluteUrl(url):
# def logexception():
# def get_verror_msg(verror, data=None):
#     def __init__(self, value):
#     def __init__(self, *args, **kwargs):
#     def default(self, o):
#     def encode(self, o):
# def utc_to_local(utc_dt):
# def namify(text):
# def normalize_id(text):


import logging
import threading
import time
import gntp.errors
import gntp.notifier
import pyperclip
import winsound
from queue import Queue
from lib.Utility import config, msgr
_APP_NAME = "Stash Scanner"
ALERT_FNAME = "res\\alert.wav"

class NotifyThread(threading.Thread):
    def __init__(self,):
        threading.Thread.__init__(self)
        self.ntfy_queue = Queue()
        self._finished = False
        self.daemon = True
        self.registered = False
        self.growl = gntp.notifier.GrowlNotifier(
            applicationName=_APP_NAME,
            notifications=["Item Alert"],
            defaultNotifications=["Item Alert"])

    def send(self, item):
        self.ntfy_queue.put(item)

    def stop(self):
        self._finished = True
        self.ntfy_queue.put(None)

    def run(self):
        while not self._finished:
            item = self.ntfy_queue.get()
            if item is None:
                break
            title, msg, whisperMsg = item

            if config.notify:

# Path: lib/Utility.py
# RE_COMPILED_TYPE = type(re.compile(''))
# POE_NINJA_API = 'http://api.poe.ninja/api/Data/'
#     CONFIG_FNAME = "cfg\\app.ini"
# class MsgType(IntEnum):
# class Messenger:
# class AppException(Exception):
# class CompileException(AppException):
# class AppConfiguration:
# class NoIndent(object):
# class NoIndentEncoder(json.JSONEncoder):
# class ConfidenceLevel(IntEnum):
#     def __init__(self):
#     def send_tmsg(self, msg, log_level=logging.NOTSET, tag=None):
#     def send_msg(self, msg, log_level=logging.NOTSET, timed=False, tag=None):
#     def send_stopped(self):
#     def send_update_id(self, id):
#     def send_object(self, obj):
#     def __init__(self):
#     def load(self):
#     def load_default(self):
#     def _load_settings(self, settings=None):
#     def update(self, cfg):
#     def save(self):
# def getBytesFromURL(url, handle=None, max_attempts=1, connect_timeout=None, timeout=None, gzip=True):
# def getJsonFromURL(url, handle=None, max_attempts=1, gzip=True):
# def getDataFromUrl(url, callback, max_attempts=1):
# def str2bool(val):
# def round_up(num):
# def round_down(num):
# def dround(num, ndigits=2):
# def tmsg(msg):
# def getBaseUrl(url):
# def isAbsoluteUrl(url):
# def logexception():
# def get_verror_msg(verror, data=None):
#     def __init__(self, value):
#     def __init__(self, *args, **kwargs):
#     def default(self, o):
#     def encode(self, o):
# def utc_to_local(utc_dt):
# def namify(text):
# def normalize_id(text):


# Path: lib/NotifyThread.py
import logging
import threading
import time
import gntp.errors
import gntp.notifier
import pyperclip
import winsound
from queue import Queue
from lib.Utility import config, msgr

_APP_NAME = "Stash Scanner"
ALERT_FNAME = "res\\alert.wav"

class NotifyThread(threading.Thread):
    def __init__(self,):
        threading.Thread.__init__(self)
        self.ntfy_queue = Queue()
        self._finished = False
        self.daemon = True
        self.registered = False
        self.growl = gntp.notifier.GrowlNotifier(
            applicationName=_APP_NAME,
            notifications=["Item Alert"],
            defaultNotifications=["Item Alert"])

    def send(self, item):
        self.ntfy_queue.put(item)

    def stop(self):
        self._finished = True
        self.ntfy_queue.put(None)

    def run(self):
        while not self._finished:
            item = self.ntfy_queue.get()
            if item is None:
                break
            title, msg, whisperMsg = item

            if config.notify:

                if config.notify_copy_msg: