Forum

Results 1 to 15 of 49

Hybrid View

  1. #1
    Join Date
    September 2005
    Location
    Germany / Dortmund
    Posts
    1,375

    [RELEASE] pyTSon - A python plugin

    pyTSon

    **CAUTION** This is currently alpha software, so it can (and I guess, it will!) crash your client. Callbacks and ts3lib functions need to be tested. So please don't bomb TeamSpeak Systems with crashdumps if you are using this plugin.

    pyTSon is a Python plugin for your TeamSpeak 3 client. It offers a python3 (current used version is Python 3.5.7) interface for the plugin sdk. This plugin makes your client scriptable, react on events or write your subroutines callable by hotkeys or from the client's menu.


    Batteries included
    Did I miss the lua plugin? No, I didn't. The advantage of pyTSon is, that all ts3lib functions the pluginsdk offers are wrapped and all callbacks are accessible (see "What is missing?" down below for some exceptions).
    The creation process of a script is much easier, just create a new file with your plugin-class in scripts/ and you are done.

    The python standard library is included, either built in the plugin or bundled in include/Lib (which is in sys.path by default). pyTSon has PythonQt included, so that scripts can have UIs written in python, see pyTSon's own configdialog or the scripting console for examples (includes/pytsonui.py). So Qt classes are wrapped into the PythonQt.* modules and there is no external dependency, the TeamSpeak 3 client's Qt libraries are used (so don't create a new QApplication object, the client ones is used!). See http://pythonqt.sourceforge.net/Developer.html for more info on using PythonQt in your scripts.
    But be carefull! If you mess up with some internals (like QApplication or Qt's eventloop), you might crash your client. Safest way to be sure, that objects are cleared, is to set the WA_DeleteOnClose attribute on your dialogs or widgets or such.


    How do I write a plugin?
    Here is a small example plugin:
    Code:
    from ts3plugin import ts3plugin
    
    import ts3lib, ts3defines
    
    class testplugin(ts3plugin):
        name = "test"
        requestAutoload = False
        version = "1.0"
        apiVersion = 21
        author = "Thomas \"PLuS\" Pathmann"
        description = "This is a testplugin"
        offersConfigure = True
        commandKeyword = ""
        infoTitle = ""
        menuItems = []#[(ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT, 0, "text", "icon.png")]
        hotkeys = []#[("keyword", "description")]
    
        def __init__(self):
            ts3lib.printMessageToCurrentTab("Yay, we are running!")
    
        def stop(self):
            ts3lib.printMessageToCurrentTab("Oh no, we were stopped :(")
    
        def onNewChannelEvent(self, schid, channelID, channelParentID):
            err, name = ts3lib.getChannelVariableAsString(schid, channelID, ts3defines.ChannelProperties.CHANNEL_NAME)
            if err == ts3defines.ERROR_ok:
                ts3lib.printMessageToCurrentTab("new channel %s" % name)
            else:
                ts3lib.printMessageToCurrentTab("got error %s" % err)
    Just create a subclass of ts3plugin and create any callback you wanna react to as method of your class. The 11 class attributes (name, requestAutoload, ..., hotkeys) are needed, otherwise pyTSon refuses to load your script. Your plugin is loaded as a python plugin, so create a subdirectory in the scripts folder.
    If you are familiar with the C pluginsdk, you'll get the idea. Otherwise look at docs/pyTSon.pdf or https://pytson.4qt.de for a full list of functions and callbacks (docs are mostly not filled with content, but all functions and callbacks are at least listed with their parameters, I'm working on that).


    Includes
    Already got a python module you wanna use in your TeamSpeak client? No problem: place it in your plugin subdirectory and use relative imports.
    Plugins installed from a repository can also give dependencies from the python package index which are installed to the include directory (which is in sys.path by default).


    What is missing?
    • Callbacks like ts3plugin_name, ts3plugin_author and such are not wrapped as functions, instead they must be added as class attributes of your python plugin.
    • Some callbacks like ts3plugin_setFunctionPointers or ts3plugin_freeMemory, because you don't need them. All memory management is done by the plugin itsself.
    • The callbacks onEditPlaybackVoiceDataEvent, onEditPostProcessVoiceDataEvent, onEditMixedPlaybackVoiceDataEvent, onEditCapturedVoiceDataEvent, onCustom3dRolloffCalculationClientEvent, onCustom3dRolloffCalculationWaveEvent, onFileTransferStatusEvent and onUserLoggingMessageEvent are not wrapped. They are called from a different thread than the other callbacks and that would require some thread safety measures.
    • Threading. You can't use any python threading methods. Write a c plugin instead.



    Downloads
    You can get builds from here: https://github.com/pathmann/pyTSon/releases

    For additional information, visit the github page: https://github.com/pathmann/pyTSon

    pyTSon is released under the GPL.
    If you find any bugs, please open a new issue on the github page. If you don't know, in which callback the client crashes, add a print(name) in PluginHost.callMethod and start your client from the commandline (linux) or start your client with -console (windows).
    Last edited by Thomas; January 27th, 2017 at 03:44 PM. Reason: There is a mac build now; added windows note; updated used python version; updated infos to v1.1.0 release

  2. #2
    Join Date
    September 2005
    Location
    Germany / Dortmund
    Posts
    1,375
    Some demo plugins are available here: https://github.com/pathmann/pyTSon_plugins

  3. #3
    Join Date
    October 2003
    Location
    Germany
    Posts
    2,487
    Quote Originally Posted by Thomas View Post
    Some demo plugins are available here: https://github.com/pathmann/pyTSon_plugins
    Awesome stuff! I like the tweakui example.


  4. #4
    Join Date
    September 2005
    Location
    Germany / Dortmund
    Posts
    1,375
    Added version 1.0.1.

    Changelog:
    • python is now linked shared
    • using python 3.5.2
    • infoData will now work as intended
    • the settingsbutton will now be enabled/disabled accordingly
    • after reloading, all previously running plugins are started again
    • plugins are sorted by name in configdialog
    • menus and hotkeys are working now
    • fixed a crash, when configdialog and/or shell are opened while reloading pyTSon
    • and some other minor fixes


    You need to delete the directory <TeamSpeak 3 client install dir>/plugins/pyTSon/include/Lib of a previous installation.

    If 1.0.0 does not work for you (on windows), please recheck with this version (linking libraries on Windows is really strange ).

    See the Releases on github for Downloads.

  5. #5
    Join Date
    June 2008
    Location
    -
    Posts
    252
    Delicious :P

  6. #6
    Join Date
    September 2005
    Location
    Germany / Dortmund
    Posts
    1,375
    Added version 1.0.2

    Changelog:
    • Added a mac build
    • Updated to api version 21 (Client Version 3.1 beta)
    • Updated to Qt 5.6.1 (but only Core, Gui, Widgets, Network, Sql and UITools modules are wrapped, more to come later)
    • On Linux and Mac, the python lib is loaded from the plugin directory (on Windows, you still have to move the lib to the client install root)
    • include/Lib has now a architecture suffix on Linux and Windows (this is necessary, if you have both client architectures installed)
    • Fixed pos1/home key button in scripting console
    • Fixed a false indentation on tabcomplete in scripting console
    • Added function ts3.getPluginID (there are no real use-cases for this, because the plugin id is not needed to call api functions from python)


    You should delete old files from a previous installation of pyTSon (backup your scripts first).

    See the release on github for Downloads.

  7. #7
    Join Date
    August 2013
    Location
    Germany
    Posts
    541
    Quote Originally Posted by ScP View Post
    Awesome stuff! I like the tweakui example.

    https://www.myteamspeak.com/addons/5...c-cfe3ce4dc127

  8. #8
    Join Date
    June 2019
    Posts
    4

    PyTSon causes problems

    Hey guys.
    I wanted to add the PyTSon plugin and done so just after I found it in the addons-browser. After installing PyTSon my Teamspeak≥-Client keeps crashing.

    To avoid it from crashing, I already deleted all the PyTSon related files, but it keeps installing itself whenever I start my Teamspeak≥-Client again.
    Turning my internet off helped to not get any crashes again, but as soon as I'm turning it on again, my client crashes, cause PyTSon gets installed.

    I dont wanna uninstall the whole client and lose important chats etc or have even more work, just cause it keeps installing himself.

    Anyone here able to help me out? It would be enough to get rid of PyTSon. I dont need it to be running

    Thanks already!

  9. #9
    Join Date
    June 2019
    Posts
    4
    It's a pretty urgent problem.
    What file in Teamspeak allows automatic updates of plugins? It keeps downloading and installing itself after my manuel removement. A reinstallation with keeping the config after removing all the PyTSon files still gets me the same result.

    Help pls!

  10. #10
    Join Date
    September 2005
    Location
    Germany / Dortmund
    Posts
    1,375
    Instead of deleting it manually, just uninstall it from the addons section.

    EDIT: If you even can't get to the plugins settings, start the client with all plugins disabled. If I remember correctly, there is a start parameter for the TS3 client to achieve that.

  11. #11
    Join Date
    June 2019
    Posts
    4
    How can I start it with all plugins disabled?

    And yes, I cant get into the addons section. If I remove it manually my Teamspeak≥ starts, but PyTSon isnt listed until it installes itself. But once this happens, my TS crashes and isnt startable anymore

    Thanks for ur help already!

  12. #12
    Join Date
    September 2005
    Location
    Germany / Dortmund
    Posts
    1,375
    Append "-safemode" as parameter.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [RELEASE]Now Playing Plugin
    By Screech in forum Client Plugins / Lua Scripts
    Replies: 236
    Last Post: February 3rd, 2018, 02:59 AM
  2. [Release] VLC Mute Plugin
    By SilentStorm in forum Client Plugins / Lua Scripts
    Replies: 18
    Last Post: April 30th, 2017, 09:20 PM
  3. [Release]LoLRandomizer Plugin
    By mJrA83 in forum Client Plugins / Lua Scripts
    Replies: 17
    Last Post: January 13th, 2015, 05:06 PM
  4. [Release] AutoAway plugin
    By plamen in forum Client Plugins / Lua Scripts
    Replies: 30
    Last Post: March 14th, 2014, 09:05 PM
  5. [RELEASE] Another TS3 Overlay Plugin
    By MarkR in forum Client Plugins / Lua Scripts
    Replies: 120
    Last Post: January 14th, 2011, 08:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •