コード例 #1
0
 def onTabChangedEvent(self, schid, status=None):
     if status is None: (err, status) = ts3lib.getConnectionStatus(schid)
     if PluginHost.cfg.getboolean("general", "verbose"):
         print(self.name, schid, status)
     if status == ts3defines.ConnectStatus.STATUS_DISCONNECTED:
         if schid in self.tabs:
             del self.tabs[schid]
         start = time()
         self.activity["timestamps"]["start"] = start
         self.activity["details"] = "Disconnected"
         self.activity["state"] = ""
         if hasattr(self.activity, "party"): del self.activity["party"]
         self.activity["assets"] = {
             "small_text": "Disconnected",
             "small_image": "",
             "large_text": "TeamSpeak 3",
             "large_image": "logo"
         }
         self.update = True
     elif status == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         if schid in self.tabs:
             self.activity["timestamps"]["start"] = self.tabs[schid]
         else:
             start = time()
             self.tabs[schid] = start
             if PluginHost.cfg.getboolean("general", "verbose"):
                 print(self.name, "self.tabs[schid]", self.tabs[schid])
             self.activity["timestamps"]["start"] = start
         self.updateServer(schid)
         self.updateChannel(schid)
         self.updateVoice(schid)
         self.updateClient(schid)
コード例 #2
0
 def restoreTabs(self):
     try:
         err, schids = ts3lib.getServerConnectionHandlerList()
         if err != ERROR_ok: return
         if len(schids) > 1: return
         for schid in schids:
             (err, status) = ts3lib.getConnectionStatus(schid)
             if err != ERROR_ok: return
             if status != ConnectStatus.STATUS_DISCONNECTED: return
         self._tabs = {}
         self._timers = []
         with open(self.backup_file) as f:
             self._tabs = load(f)
         i = 0
         self._delay = self.delay
         for tab in self._tabs:
             i += 1
             # if self._tabs[tab]["status"] == ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
             timer = QTimer()
             self._timers.append(timer)
             timer.singleShot(self._delay, self.restoreTab)
             # self.restoreTab(tab)
             self._delay += self.increase
     except:
         ts3lib.logMessage(format_exc(), LogLevel.LogLevel_ERROR, "pyTSon",
                           0)
コード例 #3
0
ファイル: __init__.py プロジェクト: pogolek/pyTSon_plugins
 def __init__(self):
     try:
         import unidecode
     except ImportError:
         PluginInstaller().installPackages(['unidecode'])
     try:
         from discoIPC import ipc
     except ImportError:
         PluginInstaller().installPackages(['discoIPC'])
         from discoIPC import ipc
     self.discord = ipc.DiscordIPC("450824928841957386")
     try:
         self.discord.connect()
     except:
         ts3lib.logMessage("Discord not running!",
                           ts3defines.LogLevel.LogLevel_WARNING,
                           "pyTSon Discord Rich Presence", 0)
     self.timer.timeout.connect(self.tick)
     self.timer.setTimerType(2)
     self.timer.start(1000)
     self.update = True
     schid = ts3lib.getCurrentServerConnectionHandlerID()
     (err, status) = ts3lib.getConnectionStatus(schid)
     if status == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         self.updateServer(schid)
         self.updateChannel(schid)
         self.updateVoice(schid)
         self.updateClient(schid)
     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))
コード例 #4
0
 def checkMenus(self, schid=0):
     if not self.name in PluginHost.active: return
     if schid < 1: schid = ts3lib.getCurrentServerConnectionHandlerID()
     err, status = ts3lib.getConnectionStatus(schid)
     if status != ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED: return
     (err, suid) = ts3lib.getServerVariable(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
     if suid != self.suid: self.toggleMenus(False)
     else: self.toggleMenus(True)
コード例 #5
0
 def __init__(self):
     schid = ts3lib.getCurrentServerConnectionHandlerID()
     (err, status) = ts3lib.getConnectionStatus(schid)
     if err == ts3defines.ERROR_ok and status == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         self.saveTab(schid)
     self.log(
         LogLevel.LogLevel_DEBUG,
         "Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded."
         .format(self.timestamp(), self.name, self.author))
コード例 #6
0
ファイル: __init__.py プロジェクト: spyderwan/pyTSon_plugins
 def disconnect(self, schid=0, close_tab=False):
     if schid < 1: schid = ts3lib.getCurrentServerConnectionHandlerID()
     (err, status) = ts3lib.getConnectionStatus(schid)
     if status != ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         return
     clipboard = QApplication.clipboard().text()
     msg = inputBox("Disconnect", "Message", clipboard)
     if close_tab: self.schid = schid
     ts3lib.stopConnection(schid, msg if msg else "")
コード例 #7
0
 def __init__(self):
     self.ts3host = ts3SessionHost(self)
     err, schids = ts3lib.getServerConnectionHandlerList()
     for schid in schids:
         (err, status) = ts3lib.getConnectionStatus(schid)
         self.onConnectStatusChangeEvent(schid, status, err)
     log(
         self, LogLevel.LogLevel_DEBUG,
         "[color=orange]{name}[/color] Plugin for pyTSon by [url=https://github.com/{author}]{author}[/url] loaded."
         .format(name=self.name, author=self.author), 0)
コード例 #8
0
ファイル: __init__.py プロジェクト: Lukaz1234/pyTSon_plugins
 def __init__(self):
     if path.isfile(self.ini):
         self.cfg.read(self.ini)
     else:
         self.cfg['general'] = {"cfgversion": "1", "debug": "False", "enabled": "True", "infodata": "False", "activeonly": "False"}
         with open(self.ini, 'w') as cfg:
             self.cfg.write(cfg)
     schid = ts3.getCurrentServerConnectionHandlerID()
     err, status = ts3.getConnectionStatus(schid)
     if not err and status == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED: self.setMeta(ts3.getCurrentServerConnectionHandlerID())
     if pluginhost.PluginHost.cfg.getboolean("general", "verbose"): ts3.printMessageToCurrentTab("{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.".format(self.timestamp(),self.name,self.author))
コード例 #9
0
ファイル: __init__.py プロジェクト: spyderwan/pyTSon_plugins
 def checkServer(self):
     if self.schid > 0: (err, status) = ts3lib.getConnectionStatus(self.schid)
     else: status = ts3defines.ConnectStatus.STATUS_DISCONNECTED
     try:
         if status == ts3defines.ConnectStatus.STATUS_DISCONNECTED:
             ts3lib.setPluginMenuEnabled(PluginHost.globalMenuID(self, self.menuItems[0][1]), True)
             ts3lib.setPluginMenuEnabled(PluginHost.globalMenuID(self, self.menuItems[1][1]), False)
         elif status == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
             ts3lib.setPluginMenuEnabled(PluginHost.globalMenuID(self, self.menuItems[0][1]), False)
             ts3lib.setPluginMenuEnabled(PluginHost.globalMenuID(self, self.menuItems[1][1]), True)
     except: pass
コード例 #10
0
ファイル: __init__.py プロジェクト: lydemon/pyTSon_plugins
 def __init__(self):
     self.timer.timeout.connect(self.tick)
     self.timer.setTimerType(2)
     err, schids = ts3lib.getServerConnectionHandlerList()
     for schid in schids:
         err, status = ts3lib.getConnectionStatus(schid)
         self.onConnectStatusChangeEvent(schid, status, err)
     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))
コード例 #11
0
 def __init__(self):
     if self.enabled:
         schid = ts3lib.getCurrentServerConnectionHandlerID()
         (err, status) = ts3lib.getConnectionStatus(schid)
         if status == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
             err, clid = ts3lib.getClientID(schid)
             err, self.mychan = ts3lib.getChannelOfClient(schid, clid)
             self.schid = schid
     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))
コード例 #12
0
ファイル: __init__.py プロジェクト: pogolek/pyTSon_plugins
 def __init__(self):
     self.ts3host = ts3SessionHost(self)
     schid = ts3lib.getCurrentServerConnectionHandlerID()
     (err, status) = ts3lib.getConnectionStatus(schid)
     self.onConnectStatusChangeEvent(schid, status, err)
     if PluginHost.cfg.getboolean("general", "verbose"):
         i = 1
         for active in PluginHost.active:
             print(i, active)
             i += 1
         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))
コード例 #13
0
ファイル: __init__.py プロジェクト: spyderwan/pyTSon_plugins
 def checkServer(self, schid=0, status=None):
     if schid < 1: schid = ts3lib.getCurrentServerConnectionHandlerID()
     if status is None: (err, status) = ts3lib.getConnectionStatus(schid)
     if status == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         status = True
     elif status == ts3defines.ConnectStatus.STATUS_DISCONNECTED:
         status = False
     else:
         return
     for menuItem in self.menuItems:
         try:
             ts3lib.setPluginMenuEnabled(
                 PluginHost.globalMenuID(self, menuItem[1]), status)
         except:
             pass
コード例 #14
0
ファイル: __init__.py プロジェクト: pogolek/pyTSon_plugins
 def onTabChangedEvent(self, schid, status=None):
     if status is None: (err, status) = ts3lib.getConnectionStatus(schid)
     if status == ts3defines.ConnectStatus.STATUS_DISCONNECTED:
         self.activity["details"] = "Disconnected"
         self.activity["state"] = ""
         if hasattr(self.activity, "party"): del self.activity["party"]
         self.activity["assets"] = {
             "small_text": "Disconnected",
             "small_image": "",
             "large_text": "TeamSpeak 3",
             "large_image": "logo"
         }
         self.update = True
     elif status == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         self.updateServer(schid)
         self.updateChannel(schid)
         self.updateVoice(schid)
         self.updateClient(schid)
コード例 #15
0
 def __init__(self):
     if path.isfile(self.ini):
         self.cfg.read(self.ini)
     else:
         self.cfg['general'] = {
             "cfgversion": "1",
             "debug": "False",
             "enabled": "True",
             "pw": "False",
             "channel": "False",
             "channelpw": "False",
             "status": "switched servers"
         }
         with open(self.ini, 'w') as cfg:
             self.cfg.write(cfg)
         schid = ts3.getCurrentServerConnectionHandlerID()
         err, status = ts3.getConnectionStatus(schid)
         if status == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
             self.setStatus(schid)
     if self.debug:
         ts3.printMessageToCurrentTab(
             '{0}[color=orange]{1}[/color] Plugin for pyTSon by [url=https://github.com/{2}]{2}[/url] loaded.'
             .format(self.timestamp(), self.name, self.author))
コード例 #16
0
 def disconnect(self, schid=schid):
     (err, status) = ts3lib.getConnectionStatus(schid)
     if status != ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         return
     ts3lib.stopConnection(schid, "ts3lib.stopConnection({})".format(schid))
     ts3lib.destroyServerConnectionHandler(schid)
コード例 #17
0
ファイル: __init__.py プロジェクト: sancakbeyy/pyTSon_plugins
 def connectionStatus(self):
     (err, sta) = ts3lib.getConnectionStatus(self.schid)
     if err != ts3defines.ERROR_ok:
         raise ts3Error("Error getting connection status: (%s, %s)" %
                        (err, ts3lib.getErrorMessage(err)[1]))
     return sta