
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (71)
-
Installation en mode ferme
4 février 2011, parLe mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
C’est la méthode que nous utilisons sur cette même plateforme.
L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...) -
Récupération d’informations sur le site maître à l’installation d’une instance
26 novembre 2010, parUtilité
Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...) -
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 is the first MediaSPIP stable release.
Its official release date is June 21, 2013 and is announced here.
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)
Sur d’autres sites (4811)
-
I tried programming a discord bot for music, it joins the channel, it apparently "speaks" but i can't hear anything
2 avril 2020, par boraxI tried to code it alone, but I got the same problem, then I copied the code from https://gabrieltanner.org/blog/dicord-music-bot and it persists. I have downloaded FFmpeg, but I still think the problem lies there. Any suggestions ? (it's my first time here, I don't know how much of the code is relevant, also, i get this Error : FFmpeg/avconv not found !)



const Discord = require('discord.js');
const client = new Discord.Client();

const ytdl = require("ytdl-core");

const token = 'REDACTED';

const prefix = '$';

var version = '1.1.2';

var servers = {};

const queue = new Map();

client.on('ready', () => {
 console.log('BOT is online');
})
client.once("ready", () => {
 console.log("Ready!");
 });

 client.once("reconnecting", () => {
 console.log("Reconnecting!");
 });

 client.once("disconnect", () => {
 console.log("Disconnect!");
 });

 client.on("message", async message => {
 if (message.author.bot) return;
 if (!message.content.startsWith(prefix)) return;

 const serverQueue = queue.get(message.guild.id);

 if (message.content.startsWith(`${prefix}play`)) {
 execute(message, serverQueue);
 return;
 } else if (message.content.startsWith(`${prefix}skip`)) {
 skip(message, serverQueue);
 return;
 } else if (message.content.startsWith(`${prefix}stop`)) {
 stop(message, serverQueue);
 return;
 } else {
 message.channel.send("You need to enter a valid command!");
 }
 });

 async function execute(message, serverQueue) {
 const args = message.content.split(" ");

 const voiceChannel = message.member.voice.channel;
 if (!voiceChannel)
 return message.channel.send(
 "You need to be in a voice channel to play music!"
 );
 const permissions = voiceChannel.permissionsFor(message.client.user);
 if (!permissions.has("CONNECT") || !permissions.has("SPEAK")) {
 return message.channel.send(
 "I need the permissions to join and speak in your voice channel!"
 );
 }

 const songInfo = await ytdl.getInfo(args[1]);
 const song = {
 title: songInfo.title,
 url: songInfo.video_url
 };

 if (!serverQueue) {
 const queueContruct = {
 textChannel: message.channel,
 voiceChannel: voiceChannel,
 connection: null,
 songs: [],
 volume: 5,
 playing: true
 };

 queue.set(message.guild.id, queueContruct);

 queueContruct.songs.push(song);

 try {
 var connection = await voiceChannel.join();
 queueContruct.connection = connection;
 play(message.guild, queueContruct.songs[0]);
 } catch (err) {
 console.log(err);
 queue.delete(message.guild.id);
 return message.channel.send(err);
 }
 } else {
 serverQueue.songs.push(song);
 return message.channel.send(`${song.title} has been added to the queue!`);
 }
 }

 function skip(message, serverQueue) {
 if (!message.member.voice.channel)
 return message.channel.send(
 "You have to be in a voice channel to stop the music!"
 );
 if (!serverQueue)
 return message.channel.send("There is no song that I could skip!");
 serverQueue.connection.dispatcher.end();
 }

 function stop(message, serverQueue) {
 if (!message.member.voice.channel)
 return message.channel.send(
 "You have to be in a voice channel to stop the music!"
 );
 serverQueue.songs = [];
 serverQueue.connection.dispatcher.end();
 }

 function play(guild, song) {
 const serverQueue = queue.get(guild.id);
 if (!song) {
 serverQueue.voiceChannel.leave();
 queue.delete(guild.id);
 return;
 }

 const dispatcher = serverQueue.connection
 .play(ytdl(song.url))
 .on("finish", () => {
 serverQueue.songs.shift();
 play(guild, serverQueue.songs[0]);
 })
 .on("error", error => console.error(error));
 dispatcher.setVolumeLogarithmic(serverQueue.volume / 5);
 serverQueue.textChannel.send(`Start playing: **${song.title}**`);
 }

client.login(token);



-
issue with ffmpeg (not loading song ?) - ffmpeg stream : write EPIPE
15 novembre 2020, par superissue : with some songs that i play through the
StreamDispatcher
from the discord.js module (seems to be ones that have silences at the beginning), the dispatcher will almost immediately finish and throw an error. i use the ffmpeg-static module.

from what i've seen, these are the two errors that i'm receiving from calling the "debug" and "error" events of the dispatcher


Error: ffmpeg stream: write EPIPE


Error [ERR_STREAM_DESTROYED]: ffmpeg stream: Cannot call write after a stream was destroyed


reproducible code sample (requires ytdl-core) :


/**
* @param {Discord.VoiceConnection} connection 
* @param {String} url 
*/
async function run(connection, url) // assuming these two variables aren't null
{
 const video = ytdl(url, { highWaterMark: 5242880 });
 video.on("error", (err) => console.log(err));
 let dispatcher = connection.play(video);
 dispatcher.on("finish", () => console.log("finished"));
 break;
}
// recommended url: https://www.youtube.com/watch?v=Auk1oVI2Icw
// (this is one i've been using to test this issue)



original code from my project plus some comments from guiding :


async play() // this is my function for playing music on the bot
{
 if (this.queue.length === 0) return;
 if (!this.guild.me.voice || !this.guild.me.voice.channel) return;
 let connection = this.guild.me.voice.connection;
 if (!connection) return;
 if (connection.dispatcher) return;
 let track = this.queue[0];
 let channel = this.guild.channels.cache.get(track.channelID);
 switch (track.type)
 {
 //case "soundcloud" omitted
 case "youtube":
 {
 const video = ytdl(track.url, { highWaterMark: 5242880 });
 video.on("error", (err) => console.log(err));
 channel.send(`playing: **${track.name}** // requester: **${track.requester.tag}**`);
 let dispatcher = connection.play(video); // dispatcher will begin
 dispatcher.setVolume(this.volume);
 dispatcher.on("finish", () => this.finish()); // almost immediately the following will be called
 // fyi: there isn't anything special in the function called, just some code to shift the queue
 break;
 }
 }
}



details :


- 

- discord.js version : 12.4.1
- node.js version : v12.18.3
- operating system : windows 10








-
checkasm : Explicitly declare function prototypes
20 août 2015, par Henrik Gramnercheckasm : Explicitly declare function prototypes
Now we no longer have to rely on function pointers intentionally
declared without specified argument types.This makes it easier to support functions with floating point parameters
or return values as well as functions returning 64-bit values on 32-bit
architectures. It also avoids having to explicitly cast strides to
ptrdiff_t for example.Signed-off-by : Anton Khirnov <anton@khirnov.net>