Skip to content

Instantly share code, notes, and snippets.

@Bosek
Last active November 16, 2016 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bosek/8d7760e5804244cf86f44801cc02fee5 to your computer and use it in GitHub Desktop.
Save Bosek/8d7760e5804244cf86f44801cc02fee5 to your computer and use it in GitHub Desktop.
TS3 mass codec(quality) changer
#https://github.com/nikdoof/python-ts3
import ts3
############################
server_ip = '127.0.0.1'
server_port = 10011
server_admin = 'serveradmin'
server_password = 'password'
server_id = 1
requested_codec = 5
requested_quality = 10
#Do you want to ignore channels with 'spacer' in name?
ignore_spacer = True
############################
server = ts3.TS3Server(server_ip, server_port)
server.login(server_admin, server_password)
server.use(server_id)
channel_list = server.send_command('channellist', opts=['voice']).data
for channel in channel_list:
if 'spacer' in channel['channel_name'] and ignore_spacer:
continue
codec_changes = int(channel['channel_codec']) != requested_codec
quality_changes = int(channel['channel_codec_quality']) != requested_quality
if codec_changes or quality_changes:
print channel['channel_name']
if codec_changes:
print channel['channel_codec'], '->', requested_codec
if quality_changes:
print channel['channel_codec_quality'], '->', requested_quality
server.send_command('channeledit', keys=
{
'cid': channel['cid'],
'channel_codec': requested_codec,
'channel_codec_quality': requested_quality
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment