Beispiel #1
0
 def subscribeAll(self, schid):
     try:
         error = ts3lib.requestChannelSubscribeAll(schid)
         if not error == ts3defines.ERROR_ok:
             raise Exception("Error in requestChannelSubscribeAll")
     except:
         try:
             (error, clist) = ts3lib.getChannelList(schid)
             ts3lib.requestChannelSubscribe(schid, clist)
         except:
             try:
                 from traceback import format_exc
                 ts3lib.logMessage(format_exc(),
                                   ts3defines.LogLevel.LogLevel_ERROR,
                                   "PyTSon", 0)
                 pass
             except:
                 try:
                     from traceback import format_exc
                     ts3lib.printMessageToCurrentTab(format_exc())
                 except:
                     try:
                         from traceback import format_exc
                         print(format_exc())
                     except:
                         print("Unknown Error")
Beispiel #2
0
 def subscribeAll(self, schid=0):
     if not schid: schid = self.schid
     try:
         error = ts3lib.requestChannelSubscribeAll(schid)
         if not error == ts3defines.ERROR_ok: raise Exception("Error in requestChannelSubscribeAll")
     except:
         (error, clist) = ts3lib.getChannelList(schid)
         ts3lib.requestChannelSubscribe(schid, clist)
Beispiel #3
0
 def subChannels(self, schid=0):
     if not schid: schid = self.schid
     if len(self.toSub) < 1: return
     if PluginHost.cfg.getboolean("general", "verbose"): ts3lib.printMessageToCurrentTab("Trying to subscribe {}".format(self.toSub))
     try:
         error = ts3lib.requestChannelSubscribe(schid, self.toSub)
         if not error == ts3defines.ERROR_ok: raise Exception("Error in requestChannelSubscribe")
     except:
         for cid in self.toSub: ts3lib.requestChannelSubscribe(schid, [cid])
     self.toSub = []
Beispiel #4
0
 def subscribe(self, schid, cid):
     subscribed = isSubscribed(schid, cid)
     if PluginHost.cfg.getboolean("general", "verbose"):
         ts3lib.printMessageToCurrentTab("==== #{0} ====".format(cid))
         ts3lib.printMessageToCurrentTab(
             "Subscribed: {0}".format(subscribed))
         ts3lib.printMessageToCurrentTab("Passworded: {0}".format(
             isPassworded(schid, cid)))
         ts3lib.printMessageToCurrentTab("PWInName: {0}".format(
             isPWInName(schid, cid)))
         ts3lib.printMessageToCurrentTab("Blacklisted: {0}".format(
             isBlacklisted(schid, cid)))
         ts3lib.printMessageToCurrentTab("MusicChannel: {0}".format(
             isMusicChannel(schid, cid)))
         ts3lib.printMessageToCurrentTab("==== #{0} ====".format(cid))
     if not subscribed:
         if (isPassworded(schid, cid) and isPWInName(
                 schid, cid)) or (not isPassworded(schid, cid)
                                  and not isBlacklisted(schid, cid)
                                  and not isMusicChannel(schid, cid)):
             return ts3lib.requestChannelSubscribe(schid, [cid])
     elif subscribed:
         if (isPassworded(schid, cid)
                 and not isPWInName(schid, cid)) or isBlacklisted(
                     schid, cid) or isMusicChannel(schid, cid):
             return ts3lib.requestChannelUnsubscribe(schid, [cid])
Beispiel #5
0
 def subscribe(self, schid, channelID):
     (error, name) = ts3lib.getChannelVariableAsString(
         schid, channelID, ts3defines.ChannelProperties.CHANNEL_NAME)
     (error, pw) = ts3lib.getChannelVariableAsInt(
         schid, channelID,
         ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD)
     (error, subscribed) = ts3lib.getChannelVariableAsInt(
         schid, channelID,
         ts3defines.ChannelPropertiesRare.CHANNEL_FLAG_ARE_SUBSCRIBED)
     (error, codec) = ts3lib.getChannelVariableAsInt(
         schid, channelID, ts3defines.ChannelProperties.CHANNEL_CODEC)
     #if self.debug: ts3lib.printMessageToCurrentTab("not pw: {0}".format(not pw))
     #if self.debug: ts3lib.printMessageToCurrentTab("any(x in name.lower() for x in self.passwords): {0}".format(any(x in name.lower() for x in self.passwords)))
     #if self.debug: ts3lib.printMessageToCurrentTab("not any(x in name.lower() for x in self.blacklist): {0}".format(not any(x in name.lower() for x in self.blacklist)))
     #if self.debug: ts3lib.printMessageToCurrentTab("not codec == ts3defines.CodecType.CODEC_OPUS_MUSIC: {0}".format(not codec == ts3defines.CodecType.CODEC_OPUS_MUSIC))
     if pw and any(x in name.lower() for x in self.passwords):
         if not subscribed:
             ts3lib.requestChannelSubscribe(schid, [channelID])
             if self.debug:
                 ts3lib.printMessageToCurrentTab(
                     "Has PW in name: {0}".format(
                         pw and any(x in name.lower()
                                    for x in self.passwords)))
     elif not pw and not any(
             x in name.lower() for x in self.blacklist
     ) and not codec == ts3defines.CodecType.CODEC_OPUS_MUSIC:
         if not subscribed:
             ts3lib.requestChannelSubscribe(schid, [channelID])
             if self.debug:
                 ts3lib.printMessageToCurrentTab(
                     "no pw, no bl, no music: {0}".format(
                         not pw and not any(x in name.lower()
                                            for x in self.blacklist)
                         and not codec
                         == ts3defines.CodecType.CODEC_OPUS_MUSIC))
     elif (pw
           and not any(x in name.lower() for x in self.passwords)) or any(
               x in name.lower() for x in self.blacklist
           ) or codec == ts3defines.CodecType.CODEC_OPUS_MUSIC:
         if subscribed:
             ts3lib.requestChannelUnsubscribe(schid, [channelID])
             if self.debug:
                 ts3lib.printMessageToCurrentTab("unsubbed: {0}".format(
                     (pw and not any(x in name.lower()
                                     for x in self.passwords))
                     or any(x in name.lower() for x in self.blacklist)
                     or codec == ts3defines.CodecType.CODEC_OPUS_MUSIC))
Beispiel #6
0
 def subscribeOpen(self, schid):
     try:
         (error, clist) = ts3lib.getChannelList(schid)
         for c in clist:
             (error, name) = ts3lib.getChannelVariableAsString(
                 schid, c, ts3defines.ChannelProperties.CHANNEL_NAME)
             (error, pw) = ts3lib.getChannelVariableAsInt(
                 schid, c,
                 ts3defines.ChannelProperties.CHANNEL_FLAG_PASSWORD)
             (error, permanent) = ts3lib.getChannelVariableAsInt(
                 schid, c,
                 ts3defines.ChannelProperties.CHANNEL_FLAG_PERMANENT)
             (error, semiperm) = ts3lib.getChannelVariableAsInt(
                 schid, c,
                 ts3defines.ChannelProperties.CHANNEL_FLAG_SEMI_PERMANENT)
             (error, codec) = ts3lib.getChannelVariableAsInt(
                 schid, c, ts3defines.ChannelProperties.CHANNEL_CODEC)
             if not pw and not permanent and not semiperm and not codec == ts3defines.CodecType.CODEC_OPUS_MUSIC and not any(
                     x in name.lower() for x in self.blacklist):
                 ts3lib.requestChannelSubscribe(schid,
                                                [c])  #clist.remove(c)
         self.onlyOpen = True
         # ts3lib.requestChannelSubscribe(schid, clist)
     except:
         try:
             from traceback import format_exc
             ts3lib.logMessage(format_exc(),
                               ts3defines.LogLevel.LogLevel_ERROR, "PyTSon",
                               0)
             pass
         except:
             try:
                 from traceback import format_exc
                 ts3lib.printMessageToCurrentTab(format_exc())
             except:
                 try:
                     from traceback import format_exc
                     print(format_exc())
                 except:
                     print("Unknown Error")
Beispiel #7
0
 def subscribe(self, schid, cid):
     (error, subscribed) = ts3lib.getChannelVariableAsInt(schid, cid, ts3defines.ChannelPropertiesRare.CHANNEL_FLAG_ARE_SUBSCRIBED)
     if self.debug:
         ts3lib.printMessageToCurrentTab("==== #{0} ====".format(cid))
         ts3lib.printMessageToCurrentTab("Passworded: {0}".format(isPassworded(schid, cid)))
         ts3lib.printMessageToCurrentTab("PWInName: {0}".format(isPWInName(schid, cid)))
         ts3lib.printMessageToCurrentTab("Blacklisted: {0}".format(isBlacklisted(schid, cid)))
         ts3lib.printMessageToCurrentTab("MusicChannel: {0}".format(isMusicChannel(schid, cid)))
         ts3lib.printMessageToCurrentTab("==== #{0} ====".format(cid))
     if not subscribed:
         if (isPassworded(schid, cid) and isPWInName(schid, cid)) or (not isPassworded(schid, cid) and not isBlacklisted(schid, cid) and not isMusicChannel(schid, cid)):
             return ts3lib.requestChannelSubscribe(schid, [cid])
     elif subscribed:
         if (isPassworded(schid, cid) and not isPWInName(schid, cid)) or isBlacklisted(schid, cid) or isMusicChannel(schid, cid):
             return ts3lib.requestChannelUnsubscribe(schid, [cid])
Beispiel #8
0
 def subscribe(self, schid, cid):
     subscribed = isSubscribed(schid, cid)
     # if PluginHost.cfg.getboolean("general", "verbose"):
     passworded = isPassworded(schid, cid)
     pwinname = isPWInName(schid, cid)
     blacklisted = isBlacklisted(schid, cid)
     music = isMusicChannel(schid, cid)
     if not subscribed:
         if (passworded and pwinname) or (not passworded and not blacklisted and not music):
             return ts3lib.requestChannelSubscribe(schid, [cid])
     elif subscribed:
         if (passworded and not pwinname) or blacklisted or music:
             ts3lib.printMessageToCurrentTab("==== #{0} ====".format(cid))
             ts3lib.printMessageToCurrentTab("Subscribed: {0}".format(subscribed))
             ts3lib.printMessageToCurrentTab("Passworded: {0}".format(passworded))
             ts3lib.printMessageToCurrentTab("PWInName: {0}".format(pwinname))
             ts3lib.printMessageToCurrentTab("Blacklisted: {0}".format(blacklisted))
             ts3lib.printMessageToCurrentTab("MusicChannel: {0}".format(music))
             ts3lib.printMessageToCurrentTab("==== #{0} ====".format(cid))
             return ts3lib.requestChannelUnsubscribe(schid, [cid])
Beispiel #9
0
 def subChannels(self):
     for cid in self.toSub:
         ts3lib.requestChannelSubscribe(self.schid, [cid])
     del self.toSub