• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • Happy New Year everyone! A new version (1.0.0-beta.16) is out for Linux, fixing an issue that could lock the bot up when using it with TS3. Please visit the resources section or the main page (https://www.sinusbot.com) for the new package.

Advanced display playback information installieren/konfigurieren?

Status
Not open for further replies.
Huhu :)

Habe sowas noch nie gemacht, wie kann ich dieses Script so konfigurieren, dass der Name einer meiner beiden Musikbots so ist: Musik | (aktueller Titelname) ?

https://forum.sinusbot.com/resources/advanced-display-playback-information.47/

Also dass ich die .js Datei öffnen muss, weiß ich, ich kapiers aber nicht ^^.

Hier noch der Inhalt der Datei, damit ihr es euch nicht extra runterladen müsst:
Code:
registerPlugin({
    name: 'Advanced display playback information',
    version: '1.4',
    description: 'It can replace the channel name on the current radio/track and add the playback indicator ►/■, replace the bot nick on the artist + track, radiostation or ►/■ + the nickname of your choice. In the custom description bot can display all the information about the track plus the title of the currently playing playlist, the current position (in real time), the length of the track, as well as simulation of N-band graphic equalizer (N from 3 to 50). Attention! The maximum length of the nickname 30 characters, name of the channel 40, the excess will be cut off!',
    author: 'kapabac',
    vars: [
        {
            name: 'chc',
            title: 'Allow to change the channel name on the name of the current station/track (for this function, the bot need privileges b_channel_modify_name and perhaps i_channel_modify_power)',
            type: 'select',
            options: [
                'no',
                'yes'
            ]
        },
        {
            name: 'chcn',
            indent: 1,
            title: 'Channel bot whose name will be changed',
            type: 'channel',
            conditions: [
                { field: 'chc', value: 1 }
            ]
        },
        {
            name: 'sipc',
            indent: 1,
            title: 'Display the playback indicator ►/■',
            type: 'select',
            options: [
                'no',
                'yes'
            ]
            conditions: [
                { field: 'chc', value: 1 }
            ]
        },
        {
            name: 'chn',
            title: 'Allow to change the nick bot',
            type: 'select',
            options: [
                'no',
                'yes'
            ]
        },
        {
            name: 'chns',
            indent: 1,
            title: 'Options for replacing the nick bot',
            type: 'select',
            options: [
                'artist + track',
                'radiostation name',
                'the nickname of your choice'
            ]
            conditions: [
                { field: 'chn', value: 1 }
            ]
        },
        {
            name: 'nnick',
            indent: 2,
            title: 'Your chosen nickname of the bot',
            type: 'string',
            placeholder: 'for example: Radio Bot'
            conditions: [
                { field: 'chns', value: 2 }
            ]
        },
        {
            name: 'str',
            indent: 1,
            title: 'Allow to replace the URL to your phrase when using chat command "!stream"',
            type: 'select',
            options: [
                'no',
                'yes'
            ]
            conditions: [
                { field: 'chn', value: 1 }
            ]
        },
        {
            name: 'strs',
            indent: 2,
            title: 'The phrase which can be replaced with the URL when using chat command "!stream".  It must be unique for each bot on a server',
            type: 'string',
            placeholder: 'default: Streaming internet audio'
            conditions: [
                { field: 'str', value: 1 }
            ]
        },
        {
            name: 'sipn',
            indent: 1,
            title: 'Display the playback indicator ►/■',
            type: 'select',
            options: [
                'no',
                'yes'
            ]
            conditions: [
                { field: 'chn', value: 1 }
            ]
        },
        {
            name: 'chd',
            title: 'Show advanced bot description',
            type: 'select',
            options: [
                'no',
                'yes'
            ]
        },
        {
            name: 'sige',
            indent: 1,
            title: 'Display animated simulation of N-band graphic equalizer',
            type: 'select',
            options: [
                'no',
                'yes'
            ]
            conditions: [
                { field: 'chd', value: 1 }
            ]
        },
        {
            name: 'band',
            indent: 2,
            title: 'Specify the number of bands graphic equalizer N (from 3 to 50, default is 15)',
            type: 'number',
            placeholder: '15'
            conditions: [
                { field: 'sige', value: 1 }
            ]
        },
        {
            name: 'fps',
            indent: 2,
            title: 'Specify how frequently to update the graphic equalizer (FPS from 1 to 5, 1 by default).  Attention, increase FPS proportionally increases the load on the CPU, take care!!!',
            type: 'number',
            placeholder: '1'
            conditions: [
                { field: 'sige', value: 1 }
            ]
        },
        {
            name: 'spos',
            indent: 1,
            title: 'Display the current position (in real time)',
            type: 'select',
            options: [
                'no',
                'yes'
            ]
            conditions: [
                { field: 'chd', value: 1 }
            ]
        },
        {
            name: 'sipd',
            indent: 1,
            title: 'Display the playback indicator ►/■',
            type: 'select',
            options: [
                'no',
                'yes'
            ]
            conditions: [
                { field: 'chd', value: 1 }
            ]
        },
        {
            name: 'spls',
            indent: 1,
            title: 'Display playback status word or phrase, for example: "Now playing" or "Stopped"',
            type: 'select',
            options: [
                'no',
                'yes'
            ]
            conditions: [
                { field: 'chd', value: 1 }
            ]
        },
        {
            name: 'dplay',
            indent: 2,
            title: 'Word or phrase while playing',
            type: 'string',
            placeholder: 'default: Now playing'
            conditions: [
                { field: 'spls', value: 1 }
            ]
        },
        {
            name: 'dstop',
            indent: 2,
            title: 'A word or phrase when playback is stopped',
            type: 'string',
            placeholder: 'default: Stopped'
            conditions: [
                { field: 'spls', value: 1 }
            ]
        },
        {
            name: 'spl',
            indent: 1,
            title: 'Display name of the currently playing playlist if playing a playlist',
            type: 'select',
            options: [
                'no',
                'yes'
            ]
            conditions: [
                { field: 'chd', value: 1 }
            ]
        },
        {
            name: 'wpl',
            indent: 2,
            title: 'The word "playlist", will appear before the name of the currently playing playlist',
            type: 'string',
            placeholder: 'default: playlist'
            conditions: [
                { field: 'spl', value: 1 }
            ]
        },
        {
            name: 'sep',
            title: 'The character that will be separate by the radiostation name, artist, and track',
            type: 'string',
            placeholder: 'default: ~'
        },
        {
            name: 'undef',
            title: 'The symbol or the word to be replaced by a null value "undefined" radiostation, artist or track. It must be unique for each bot on a server',
            type: 'string',
            placeholder: 'default: ---'
        }
    ]
}, function(sinusbot, config) {
    var sip;
    var desc;
    var nick;
    var title;
    var odesc;
    var onick;
    var otitle;
    var cp = '';
    var cpd = '';
    var ap = ['▂', '▃', '▅', '▆', '▇'];

    if (!config.chcn && config.chc == 1) return;
    if (typeof config.str == 'undefined') config.str = 0;
    if (typeof config.chc == 'undefined') config.chc = 0;
    if (typeof config.chn == 'undefined') config.chn = 0;
    if (typeof config.chd == 'undefined') config.chd = 0;
    if (typeof config.spl == 'undefined') config.spl = 1;
    if (typeof config.sipc == 'undefined') config.sipc = 0;
    if (typeof config.sipn == 'undefined') config.sipn = 0;
    if (typeof config.sipd == 'undefined') config.sipd = 1;
    if (typeof config.chns == 'undefined') config.chns = 0;
    if (typeof config.spos == 'undefined') config.spos = 1;
    if (typeof config.spls == 'undefined') config.spls = 1;
    if (typeof config.sige == 'undefined') config.sige = 1;
    if (config.spls == 1) {
        if (typeof config.dplay == 'undefined' || config.dplay == '') config.dplay = 'Now playing';
        if (typeof config.dstop == 'undefined' || config.dstop == '') config.dstop = 'Stopped';
    } else {
        config.dplay = '';
        config.dstop = '';
    }
    if (config.chns == 2) {
        if (typeof config.nnick == 'undefined' || !config.nnick) return;
    }
    if (typeof config.sep == 'undefined' || !config.sep) {
        var sepn = '~';
        var sepd = ' ~ ';
    } else {
        var sepn = config.sep;
        var sepd = ' ' + config.sep + ' ';
    }
    if (typeof config.undef == 'undefined' || !config.undef) {
        var undef = '---';
    } else var undef = config.undef;
    if (typeof config.fps == 'undefined' || !config.fps || config.fps < 1 || config.fps > 5) {
        var fps = 1;
    } else var fps = config.fps;
    if (config.spl == 1) {
        if (typeof config.wpl == 'undefined' || config.wpl == '') {
            var wpl = 'playlist';
        } else var wpl = config.wpl;
    }
    if (config.sipc == 1 || config.sipn == 1 || config.sipd == 1) var sip = 1;
    if (!config.band || config.band < 3 || config.band > 50) config.band = 15;
    if (typeof config.strs == 'undefined' || !config.strs) config.strs = 'Streaming internet audio';

    setInterval(function() {
        var track = sinusbot.getCurrentTrack();
        if (!track) return;
        var apd = '';
        var pln = '';
        var typ = track.type;
        var tit = track.title;
        var talb = track.album;
        var tTit = track.tempTitle;
        var tArt = track.tempArtist;

        if (typeof tit == 'undefined' || tit == '') tit = undef;
        if (typeof talb == 'undefined' || talb == '') talb = undef;
        if (typeof tArt == 'undefined' || tArt == '') tArt = undef;
        if (typeof tTit == 'undefined' || tTit == '') tTit = undef;

        if (config.spl == 1) {
            var cPlI = sinusbot.getCurrentPlaylistId();
            if (cPlI != '') {
                if (wpl[0].match(/[a-zA-Z]/)) {
                    var l = 1;
                } else var l = 2;
                if (config.spls == 1) {
                    pln = ' ' + wpl[0].toLowerCase() + wpl.substring(l) + ' "' + sinusbot.playlistGet(cPlI).name + '"';
                } else pln = wpl[0].toUpperCase() + wpl.substring(l) + ' "' + sinusbot.playlistGet(cPlI).name + '"';
            }
        }

        if (sinusbot.playing()) {
            if (config.sige == 1) {
                for (i = 0; i < config.band; i++) {
                    apd += ap[Math.floor(Math.random() * 5)];
                }
                apd += '  ';
            }
            cpd = '' + config.dplay;
            if (sip == 1) cp = '► ';
        } else {
            if (config.sige == 1) {
                for (i = 0; i < config.band; i++) {
                    apd += '▂';
                }
                apd += '  ';
            }
            cpd = '' + config.dstop;
            if (sip == 1) cp = '■ ';
        }

        var dh = Math.floor(track.duration / 3600000);
        var dm = Math.floor(track.duration / 60000) - dh * 60;
        if (dm < 10) dm = '0' + dm;
        var ds = Math.floor(track.duration / 1000) - dm * 60 - dh * 3600;
        if (ds < 10) ds = '0' + ds;
        if (dh == 0) {
            dh = '';
        } else dh = dh + ':';
        var dt = sepd + dh + dm + ':' + ds;
        if (config.spos == 1) {
            var ph = Math.floor(getPos() / 3600000);
            var pm = Math.floor(getPos() / 60000) - ph * 60;
            if (pm < 10) pm = '0' + pm;
            var ps = Math.floor(getPos() / 1000) - pm * 60 - ph * 3600;
            if (ps < 10) ps = '0' + ps;
            var pt = ph + ':' + pm + ':' + ps + ' ';
        } else var pt = '';

        if (config.sipd != 1) {
            var dcp = '';
        } else var dcp = cp;
        if (apd == '' && pt == '' && cp == '' && cpd =='' && pln == '') {
            var sepo = '';
        } else var sepo = sepd;
        if (typ == 'url') {
            if ((tit.substring(0,7) == 'http://' || tit.substring(0,8) == 'https://') && config.str == 1) tit = config.strs;
            desc = apd + pt + dcp + cpd + pln + sepo + tit + sepd + tArt + sepd + tTit;
        } else {
            tArt = track.artist;
            if (typeof tArt == 'undefined' || tArt == '') tArt = undef;
            if (typ == 'ytdl') {
                desc = apd + pt + dcp + cpd + pln + sepo + talb + sepd + tit;
            } else desc = apd + pt + dcp + cpd + pln + sepo + tArt + sepd + tit + sepd + talb + dt;
        }
        var sdesc = '';
        for (i = 0; i < 200; i++) {
            sdesc += desc.charAt(i);
        }
        if (sdesc != odesc) {
            sinusbot.setDescription(sdesc);
            odesc = sdesc;
        }

        if (config.sipn != 1) {
            var ncp = '';
        } else var ncp = cp;
        if (config.chn == 1) {
            if (typ == 'url') {
                nick = tArt + sepn + tTit;
            } else {
                if (typ == 'ytdl') {
                    nick = talb + sepn + tit;
                } else nick = tArt + sepn + tit;
            }
            if (config.chns == 1) {
                nick = ncp + tit;
            } else {
                if (config.chns == 2) {
                    nick = ncp + config.nnick;
                } else nick = ncp + nick;
            }
            var snick = '';
            for (i = 0; i < 30; i++) {
                snick += nick.charAt(i);
            }
            if (snick != onick) {
                sinusbot.setNick(snick);
                onick = snick;
            }
        }

        if (config.sipc != 1) {
            var ccp = '';
        } else var ccp = cp;
        if (config.chc == 1) {
            if (typ != 'url') {
                if (typ == 'ytdl') {
                    tit = talb;
                } else tit = tArt;
            }
            title = ccp + tit;
            var stitle = '';
            for (i = 0; i < 40; i++) {
                stitle += title.charAt(i);
            }
            if (stitle != otitle) {
                sinusbot.channelUpdate(config.chcn, { name: stitle });
                otitle = stitle;
            }
        }
    }, 1000 / fps);

Danke schonmal ;)
LG
 

kapabac

Active Member
Contributor
Insider
I don't quite understand what you want, but the script is configured via a web-interface! ;)
 

Diesmon

Tuetchen Dominator
is awesome!
Contributor
Insider
I don't quite understand what you want, but the script is configured via a web-interface! ;)
He wants that the Musicbot puts the songname behind his normal name. Like: "Funkybot (Castle of GLass -Linkin Park)"

Also I want to request a feature. A rename to the default botname when no song is played.
 

kapabac

Active Member
Contributor
Insider
Clearly, thanks! I shall think about your wishes, but I can nothing promise :).
 

SinusStudios

New Member
DE:
Als Workaround: Wenn du noch keine Server Gruppe für den Bot hast, erstell eine und benenn sie wie der Bot heißen soll. Dann gib der Gruppe die Eigenschaft "Show name in tree: Show before name" und der Bot wird als "[ServerGruppenName] EigenerNickNameOderSongInfo" angezeigt. So mache ich das bis es ein Feature im Script wird und man "Nick | SongInfo" machen kann =)

EN:
A workaround: If you don't have a dedicated Bot Server Group, make one and name it however you like (the name you wanna prefix / bots name).
Then enable "Show name in tree: Show before name" which will have the bot appear as "[ServerGroupName] BotNickNameOrSongNameWhatever"
This is how i do it until something nicer like "Nick | SongInfo" is available through the script =)
 

SinusStudios

New Member
Sorry, I'm not quite sure what you want and what it's all about?
i thought my post was clear: i provided a workaround for the missing function of adding a prefix to the bots teamspeak name when using the script that renicks the bot with the music title
 
Status
Not open for further replies.
Top