• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

Streaming to Icecast 2 server

Status
Not open for further replies.

Fudge

Member
Hello, I would like to stream to an Icecast 2 server. I've found a script on the forum before, which is this:
Code:
registerPlugin({
    name: 'stream2icecast',
    version: '1.0',
    description: '',
    author: 'Michael Friese <[email protected]>',
    whose: {
        streamServer: {
            title: 'http://sv.something.com:8000/autodj',
            type: 'string'
        },
        streamPassword: {
            title: 'blahblahblah',
            type: 'string'
        }
    }
}, function(sinusbot, config) {
    if (config.streamServer && config.streamPassword) sinusbot.streamToServer(config.streamServer, 'source', config.streamPassword);
});

However, this doesn't work, it only gives me this in the instance log:
Code:
2017-12-18T13:11:37+00:00 Initialization complete
2017-12-18T13:11:37+00:00 Loading script streamtoicecast
 

flyth

is reticulating splines
Staff member
Developer
Contributor
That script looks pretty old needs to be updated to the new scripting engine, but mainly the whose: { should be changed to vars: { and then you'd need to set the values in the script settings. It _might_ still work.
 

Fudge

Member
That version was the version translated with the web page, I've since changed it to:
Code:
registerPlugin({
    name: 'stream2icecast',
    version: '1.0',
    description: '',
    author: 'Michael Friese <[email protected]>',
    vars: {
        streamServer: {
            title: 'http://sv.meme.com:8000/autodj',
            type: 'string'
        },
        streamPassword: {
            title: 'meme',
            type: 'string'
        }
    }
}, function(sinusbot, config) {
    if (config.streamServer && config.streamPassword) sinusbot.streamToServer(config.streamServer, 'source', config.streamPassword);
});
However, now no scripts appear in the script section in the settings:
39cc85c3b9e7.png


So I have no idea whats happening anymore
 

flyth

is reticulating splines
Staff member
Developer
Contributor
Check the startup messages of the bot, it will tell you what's wrong with that script.
 

Fudge

Member
This is the start up status:
Code:
Dec 20 14:47:21 itscheesecake.co.uk sinusbot[26642]: 2017/12/20 14:47:21 [GENERAL/FFMPEG ] INFO   FFmpeg/avcodec v3741798; license: LGPL version 2.1 or later; 81 codecs
Dec 20 14:47:21 itscheesecake.co.uk sinusbot[26642]: 2017/12/20 14:47:21 [GENERAL/FFMPEG ] INFO   FFmpeg/avformat v3742052; license: LGPL version 2.1 or later; 143 formats
Dec 20 14:47:21 itscheesecake.co.uk sinusbot[26642]: 2017/12/20 14:47:21 [GENERAL/!!!!!!!] NOTICE You may now configure and launch the bots from the webinterface. http://0.0.0.0:8087
Dec 20 14:47:21 itscheesecake.co.uk systemd[1]: sinusbot.service: Main process exited, code=exited, status=255/n/a
Dec 20 14:47:21 itscheesecake.co.uk systemd[1]: sinusbot.service: Unit entered failed state.
Dec 20 14:47:21 itscheesecake.co.uk systemd[1]: sinusbot.service: Failed with result 'exit-code'.
 

Fudge

Member
Here's the full thing:
Code:
root@itscheesecake:~# systemctl status sinusbot
* sinusbot.service - Sinusbot, the Teamspeak 3 and Discord music bot.
   Loaded: loaded (/etc/systemd/system/sinusbot.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2017-12-20 14:47:21 GMT; 17s ago
  Process: 26655 ExecStopPost=/bin/rm -f /tmp/.sinusbot.lock (code=exited, status=0/SUCCESS)
  Process: 26642 ExecStart=/opt/sinusbot/sinusbot (code=exited, status=255)
  Process: 26638 ExecStartPre=/bin/rm -f /tmp/.sinusbot.lock (code=exited, status=0/SUCCESS)
 Main PID: 26642 (code=exited, status=255)

Dec 20 14:47:21 itscheesecake.co.uk sinusbot[26642]: 2017/12/20 14:47:21 22cc03b5          INFO   Loading instance://8599596e-44bf-4c21-b64b-f22767bce673
Dec 20 14:47:21 itscheesecake.co.uk sinusbot[26642]: 2017/12/20 14:47:21 22cc03b5 8599596e INFO   Initialization complete
Dec 20 14:47:21 itscheesecake.co.uk sinusbot[26642]: 2017/12/20 14:47:21 22cc03b5 8599596e INFO   Auto-Starting 22cc03b5-c666-4712-bb4d-f53b6b58a30f/8599596e-44bf-4c21-b64b-f22767bce673 in 1000 ms...
Dec 20 14:47:21 itscheesecake.co.uk sinusbot[26642]: 2017/12/20 14:47:21 22cc03b5 8599596e INFO   Last track was 8a835079-0089-474e-8222-f6a7f671ff97, will auto-play soon
Dec 20 14:47:21 itscheesecake.co.uk sinusbot[26642]: 2017/12/20 14:47:21 [GENERAL/FFMPEG ] INFO   FFmpeg/avcodec v3741798; license: LGPL version 2.1 or later; 81 codecs
Dec 20 14:47:21 itscheesecake.co.uk sinusbot[26642]: 2017/12/20 14:47:21 [GENERAL/FFMPEG ] INFO   FFmpeg/avformat v3742052; license: LGPL version 2.1 or later; 143 formats
Dec 20 14:47:21 itscheesecake.co.uk sinusbot[26642]: 2017/12/20 14:47:21 [GENERAL/!!!!!!!] NOTICE You may now configure and launch the bots from the webinterface. http://0.0.0.0:8087
Dec 20 14:47:21 itscheesecake.co.uk systemd[1]: sinusbot.service: Main process exited, code=exited, status=255/n/a
Dec 20 14:47:21 itscheesecake.co.uk systemd[1]: sinusbot.service: Unit entered failed state.
Dec 20 14:47:21 itscheesecake.co.uk systemd[1]: sinusbot.service: Failed with result 'exit-code'.
 

flyth

is reticulating splines
Staff member
Developer
Contributor
No, that's still not everything. Maybe your startscript/initsystem eats it. You could also define a logfile in the config.ini.
 

Fudge

Member
In my config, the loglevel is 10. That was the log from the command "systemctl status sinusbot", should I be looking in a log file?
 

Fudge

Member
I read your last message wrong, I set a log file, here is it:
Code:
2017/12/20 15:55:13 [GENERAL/SCRIPTS] INFO   Loading ScriptPlugin advertising.js
2017/12/20 15:55:13 [GENERAL/SCRIPTS] INFO   Loading ScriptPlugin alonemode.js
2017/12/20 15:55:13 [GENERAL/SCRIPTS] INFO   Loading ScriptPlugin bookmark.js
2017/12/20 15:55:13 [GENERAL/SCRIPTS] INFO   Loading ScriptPlugin followme.js
2017/12/20 15:55:13 [GENERAL/SCRIPTS] INFO   Loading ScriptPlugin norecording.js
2017/12/20 15:55:13 [GENERAL/SCRIPTS] INFO   Loading ScriptPlugin rememberChannel.js
2017/12/20 15:55:13 [GENERAL/SCRIPTS] INFO   Loading ScriptPlugin streamtoicecast.js
2017/12/20 15:55:13 [GENERAL/SCRIPTS] INFO   Loading ScriptPlugin welcome.js
2017/12/20 15:55:13 22cc03b5          INFO   Loading instances
2017/12/20 15:55:13 22cc03b5          INFO   Loading instance://8599596e-44bf-4c21-b64b-f22767bce673
2017/12/20 15:55:13 22cc03b5 8599596e INFO   Initialization complete
2017/12/20 15:55:13 22cc03b5 8599596e INFO   Auto-Starting 22cc03b5-c666-4712-bb4d-f53b6b58a30f/8599596e-44bf-4c21-b64b-f22767bce673 in 500 ms...
2017/12/20 15:55:13 22cc03b5 8599596e INFO   Last track was 8a835079-0089-474e-8222-f6a7f671ff97, will auto-play soon
2017/12/20 15:55:13 22cc03b5          INFO   Loading instance://b2d90027-6aa7-4ddc-bbb8-7ceecb9e1da9
2017/12/20 15:55:13 22cc03b5 b2d90027 INFO   Loading script streamtoicecast
2017/12/20 15:55:13 22cc03b5 b2d90027 INFO   Initialization complete
2017/12/20 15:55:13 [GENERAL/FFMPEG ] INFO   FFmpeg/avcodec v3741798; license: LGPL version 2.1 or later; 81 codecs
2017/12/20 15:55:13 [GENERAL/FFMPEG ] INFO   FFmpeg/avformat v3742052; license: LGPL version 2.1 or later; 143 formats
2017/12/20 15:55:13 [GENERAL/!!!!!!!] NOTICE You may now configure and launch the bots from the webinterface. http://0.0.0.0:8087
 

EchtkPvL

Active Member
Try this (not tested)
JavaScript:
registerPlugin({
    name: 'stream2icecast',
    version: '1.0.1',
    description: 'Streams the bots audio to an icecast server.',
    author: 'SinusBot Team',
    backends: ['ts3', 'discord'],
    vars: [
        // **DO NOT EDIT THIS HERE**
        // Restart the sinusbot, then enable and configure it in the webinterface.
        {
            name: 'streamServer',
            title: 'StreamServer URL',
            type: 'string',
            placeholder: 'http://something.example.com:8000/example'
        },
        {
            name: 'streamUser',
            title: 'User',
            type: 'string'
        },
        {
            name: 'streamPassword',
            title: 'Password',
            type: 'password'
        }
    ]
  }, (_, config, meta) => {
    const engine = require('engine');
    const audio = require('audio');
    engine.log(`Loaded ${meta.name} v${meta.version} by ${meta.author}.`);
  
    if (!config.streamUser) {
        config.streamUser = 'source';
    }
  
    if (config.streamServer && config.streamPassword) {
        audio.streamToServer(config.streamServer, config.streamUser, config.streamPassword);
    } else {
        engine.log('URL or Password missing!');
    }
});
Code:
2018/02/09 16:52:20 INFO   Loading script stream2icecast
2018/02/09 16:52:20 INFO   Connecting to icecast: sv.meme.com:8000
2018/02/09 16:52:20 INFO   End Streaming
2018/02/09 16:52:20 INFO   Streaming

Note: Edited by @irgendwr. The script is available on GitHub: https://github.com/irgendwr/sinusbot-scripts/blob/master/stream2icecast.js
 
Last edited by a moderator:
Status
Not open for further replies.
Top