def __init__(self): loadCfg(self.path+"/config.ini", self.cfg) loadCfg(self.path+"/channel.ini", self.chan) with open(self.path+"/description.txt", 'r') as myfile: self.description = myfile.read() self.checkServer(ts3lib.getCurrentServerConnectionHandlerID()) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(), self.name, self.author))
def stop(self, reason=" because plugin was stopped", schid=0, target=0): ts3lib.printMessageToCurrentTab("{} {}: [color=orange]No longer auto-following[/color] {}{}!".format(timestamp(),self.name,clientURL(schid, target) if target else "anyone", reason)) if schid and target != "anyone": del self.targets[schid] else: self.targets = {}
def __init__(self): content = [] with open(self.pwpath, encoding="utf8") as f: content = f.readlines() self.pws = [x.strip() for x in content] self.timer.timeout.connect(self.tick) ts3lib.requestServerVariables(ts3lib.getCurrentServerConnectionHandlerID()) if self.debug: ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(),self.name,self.author))
def __init__(self): loadCfg(self.ini, self.cfg) url = self.cfg.get("general", "template") if url: self.nwmc_template = QNetworkAccessManager() self.nwmc_template.connect("finished(QNetworkReply*)", self.loadTemplates) self.nwmc_template.get(QNetworkRequest(QUrl(url))) url = self.cfg.get("general", "whitelist") if url: self.nwmc_whitelist = QNetworkAccessManager() self.nwmc_whitelist.connect("finished(QNetworkReply*)", self.loadWhitelist) self.nwmc_whitelist.get(QNetworkRequest(QUrl(url))) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(),self.name,self.author))
def __init__(self): self.dlg = None if os.path.isfile(self.ini): self.cfg.read(self.ini) else: self.cfg['general'] = { "Debug": "False", "Colored": "False", "Autorequest Server Variables": "False", "Autorequest Client Variables": "False" } self.cfg.add_section('VirtualServerProperties') self.cfg.add_section('VirtualServerPropertiesRare') self.cfg.add_section('ChannelProperties') self.cfg.add_section('ChannelPropertiesRare') self.cfg.add_section('ClientProperties') self.cfg.add_section('ClientPropertiesRare') self.cfg.add_section('ConnectionProperties') self.cfg.add_section('ConnectionPropertiesRare') self.cfg.set("VirtualServerProperties", "LAST_REQUESTED", "True") self.cfg.set("VirtualServerProperties", "TYPE", "True") for name, value in getmembers(VirtualServerProperties): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER'): self.cfg.set("VirtualServerProperties", name, "False") for name, value in getmembers(VirtualServerPropertiesRare): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER_RARE'): self.cfg.set("VirtualServerPropertiesRare", name, "False") self.cfg.set("ChannelProperties", "LAST_REQUESTED", "True") self.cfg.set("ChannelProperties", "TYPE", "True") self.cfg.set("ChannelProperties", "ID", "True") for name, value in getmembers(ChannelProperties): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER'): self.cfg.set("ChannelProperties", name, "False") for name, value in getmembers(ChannelPropertiesRare): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER_RARE'): self.cfg.set("ChannelPropertiesRare", name, "False") self.cfg.set("ClientProperties", "LAST_REQUESTED", "True") self.cfg.set("ClientProperties", "TYPE", "True") self.cfg.set("ClientProperties", "ID", "True") self.cfg.set("ClientProperties", "DISPLAYNAME", "True") for name, value in getmembers(ClientProperties): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER'): self.cfg.set("ClientProperties", name, "False") for name, value in getmembers(ClientPropertiesRare): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER_RARE'): self.cfg.set("ClientPropertiesRare", name, "False") for name, value in getmembers(ConnectionProperties): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER'): self.cfg.set("ConnectionProperties", name, "False") for name, value in getmembers(ConnectionPropertiesRare): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER_RARE'): self.cfg.set('ConnectionPropertiesRare', name, 'False') with open(self.ini, 'w') as configfile: self.cfg.write(configfile) if self.cfg.getboolean('general', 'Debug'): ts3lib.printMessageToCurrentTab( "{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded." .format(timestamp(), self.name, self.author))
def __init__(self): self.timer.timeout.connect(self.tick) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(),self.name,self.author))
def __init__(self): # schid = ts3lib.getCurrentServerConnectionHandlerID() # err, clid = ts3lib.getClientID(schid) # err, self.mychan = ts3lib.getChannelOfClient(schid, clid) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(),self.name,self.author))
def __init__(self): self.installer = PluginInstaller(self.print_msg) # if self.auto_update_pip: self.to_install.append("--upgrade pip") _installed = installedPackages() installed = [] for package in _installed: name = package["name"] if not name in installed: installed.append(name) """ dir = listdir(getPluginPath("scripts")) print(dir) """ # noinspection PyTypeChecker for subdir, dirs, files in walklevel(getPluginPath("scripts"), 1): for file in files: file_lower = file.lower() if not file_lower.endswith(".txt"): continue if file_lower == "requirements.txt": requirements = [] # noinspection PyArgumentList with open(path.join(subdir, file), encoding="utf-8") as f: requirements = [line.strip() for line in f.readlines()] if len(requirements) < 1: continue for requirement in requirements: requirement_stripped = self.strip(requirement) if requirement in self.to_install: continue if requirement_stripped in installed: continue try: __import__(requirement_stripped) except ImportError: self.to_install.append(requirement) break if len(self.to_install) > 0: ts3lib.printMessageToCurrentTab("[color=red]Found missing dependencies %s in \"requirements.txt\" files from scrips, installing..."%self.to_install) QTimer.singleShot(0, self.install) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(), self.name, self.author))
def onClientMoveMovedEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moverID, moverName, moverUniqueIdentifier, moveMessage): if moverID == 0 or self.backup is None: return (err, ownID) = ts3lib.getClientID(schid) if clientID != ownID or moverID == ownID or moverID == 0: return (err, sgids) = ts3lib.getClientVariable(schid, clientID, ts3defines.ClientPropertiesRare.CLIENT_SERVERGROUPS) if not set(sgids).isdisjoint(self.whitelistSGIDs): return (err, uid) = ts3lib.getClientVariable(schid, clientID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) if uid in self.whitelistUIDs: return self.backup = {"schid": schid, "cid": oldChannelID} delay = randint(self.delay[0], self.delay[1]) ts3lib.printMessageToCurrentTab("{} {}: Switching back to channel {} in {}ms".format(timestamp(),self.name,channelURL(schid, self.backup["cid"]), delay))# clientURL(schid, self.backup["schid"]), QTimer.singleShot(delay, self.moveBack)
def __init__(self): event_handler = LoggingEventHandler() self.observer = Observer() self.observer.schedule(event_handler, ts3lib.getConfigPath(), recursive=True) self.observer.start() try: while True: time.sleep(1) except KeyboardInterrupt: self.observer.stop() self.observer.join() if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(), self.name, self.author))
def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL and menuItemID == 0: if self.backup is None: self.backup = {} ts3lib.printMessageToCurrentTab("{}[color=green]Enabled[/color] {}".format(timestamp(),self.name)) else: self.backup = None ts3lib.printMessageToCurrentTab("{}[color=red]Disabled[/color] {}".format(timestamp(),self.name))
def __init__(self): self.timer.timeout.connect(self.tick) self.timer.setTimerType(2) with open(self.suffixes) as f: self.suffixes = f.read().splitlines() if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(), self.name, self.author))
def __init__(self): addons = getAddons() for k in addons: if addons[k]["name"] == "TS3Hook": self.hook = True; break self.timer.timeout.connect(self.tick) self.timer.setTimerType(2) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(), self.name, self.author))
def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if menuItemID != 0: return if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL: if schid in self.targets: self.stop("", schid, self.targets[schid]) else: ts3lib.printMessageToCurrentTab("{} {}: [color=red]Not following anyone on this tab.[/color]".format(timestamp(),self.name)) uid = inputBox(self.name, "UID:", QApplication.clipboard().text()) parsed = parseClientURL(uid) if parsed: uid = parsed[1] elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT: (err, ownID) = ts3lib.getClientID(schid) if selectedItemID == ownID: return (err, uid) = ts3lib.getClientVariable(schid, selectedItemID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) if not uid: ts3lib.printMessageToCurrentTab( "{} {}: [color=red]Cannot follow[/color] {}".format(timestamp(), self.name, selectedItemID)) return self.targets[schid] = uid ts3lib.printMessageToCurrentTab("{} {}: [color=green]Now auto-following[/color] {}".format(timestamp(),self.name,clientURL(schid, selectedItemID))) if PluginHost.cfg.getboolean("general", "verbose"): print(self.name,"> self.targets[schid]",self.targets[schid],"selectedItemID",selectedItemID) self.joinTarget(schid)
def __init__(self): if "aaa_ts3Ext" in PluginHost.active: self.ts3host = PluginHost.active["aaa_ts3Ext"].ts3host else: self.ts3host = ts3SessionHost(self) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(),self.name,self.author))
def join(self, schid, clid, cid): (err, ownID) = ts3lib.getClientID(schid) (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID) if not cid: (err, cid) = ts3lib.getChannelOfClient(schid, self.targets[schid]) if ownCID == cid: return delay = randint(self.delay[0], self.delay[1]) ts3lib.printMessageToCurrentTab("{} {}: Auto-following {} in channel {} in {}ms".format(timestamp(), self.name, clientURL(schid, clid), channelURL(schid, cid), delay)) self.cid = cid QTimer.singleShot(delay, self.joinTarget)
def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if menuItemID != 0: return if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL: if schid in self.targets: ts3lib.printMessageToCurrentTab("{} {}: [color=orange]No longer auto-dragging[/color] {}".format(timestamp(),self.name,clientURL(schid, self.targets[schid]))) del self.targets[schid] else: ts3lib.printMessageToCurrentTab("{} {}: [color=red]Not dragging anyone on this tab.[/color]".format(timestamp(),self.name)) elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT: (err, ownID) = ts3lib.getClientID(schid) if selectedItemID == ownID: return self.targets[schid] = selectedItemID ts3lib.printMessageToCurrentTab("{} {}: [color=green]Now auto-dragging[/color] {}".format(timestamp(),self.name,clientURL(schid, selectedItemID))) self.dragTarget(schid)
def onUpdateClientEvent(self, schid, clid, invokerID, invokerName, invokerUniqueIdentifier): if clid != self.clid: return self.clid = 0 err, description = ts3lib.getClientVariable(schid, clid, ts3defines.ClientPropertiesRare.CLIENT_DESCRIPTION) description = "{} {}: {}".format(description, timestamp(), invokerID) ts3lib.requestClientEditDescription(schid, clid, description)
def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moveMessage): if not schid in self.targets: return (err, ownID) = ts3lib.getClientID(schid) if not clientID in [ownID,self.targets[schid]] : return # (err, ownCID) = ts3lib.getChannelOfClient(schid, ownID) delay = randint(self.delay[0], self.delay[1]) ts3lib.printMessageToCurrentTab("{} {}: Auto-dragging {} in channel {} in {}ms".format(timestamp(),self.name,clientURL(schid, self.targets[schid]), channelURL(schid, newChannelID), delay)) QTimer.singleShot(delay, self.dragTarget)
def __init__(self): if "aaa_ts3Ext" in PluginHost.active: ts3ext = PluginHost.active["aaa_ts3Ext"] self.ts3host = ts3ext.ts3host self.tabs = ts3ext.tabs else: retry = 1000 self.timer.singleShot(retry, self.__init__) ts3lib.printMessageToCurrentTab("{}: [color=red]Dependency not yet loaded, retrying in {} second(s)!".format(self.name, retry/1000)) return if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(),self.name,self.author))
def onClientMoveMovedEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moverID, moverName, moverUniqueIdentifier, moveMessage): if not schid in self.targets: return if self.targets[schid] != clientID: return (err, ownID) = ts3lib.getClientID(schid) if clientID != ownID or moverID == ownID: return ts3lib.printMessageToCurrentTab("{} {}: [color=orange]No longer auto-dragging[/color] {} because we were moved!".format(timestamp(),self.name,clientURL(schid, self.targets[schid]))) del self.targets[schid]
def __init__(self): if self.debug: ts3lib.printMessageToCurrentTab( "{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded." .format(timestamp(), self.name, self.author))
def __init__(self): content = [] if not path.exists(self.whitelist_ini): with open(self.whitelist_ini, 'w'): pass with open(self.whitelist_ini, encoding="utf-8") as f: content = f.readlines() self.whitelist = [x.strip() for x in content] self.nwmc.connect("finished(QNetworkReply*)", self.reply) self.nwmc_resolver.connect("finished(QNetworkReply*)", self.resolveReply) if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(timestamp(), self.name, self.author))