
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (21)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community. -
Contribute to translation
13 avril 2011You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
MediaSPIP is currently available in French and English (...)
Sur d’autres sites (4831)
-
Discord Music Bot joins voice channel, light up green but didnt has any audio. Worked well for 2 weeks before. No errors in console
8 juin 2021, par FeXI coded a bot with node.js. I used the example by Crawl for his music bot. I did everything similar to him. After I finished my build everything worked. Every other command and the
play
command. But now after 2 weeks the bot joins the voice channel, light up green but has no sound. I updatedffmpeg
,@discordjs/opus
,ffmpeg-static
and downloaded the completed version from ffmpeg but the bot still has no audio. Thequeue
,volume
,nowplaying
,skip
,shuffle
,loop
everything works. But after I got the video or playlist with the play command the bot only joins light up green but has no audio. So the bot definitly get the url, get the video, get everything he needs to play. But after joining he doesnt use the informations to play. Also he doesnt leave the voicechannel after the song should end.


function play(guild, song) {

 try {

 const ServerMusicQueue = queue.get(guild.id);

 if (!song) {

 ServerMusicQueue.textchannel.send(`ퟎ
-
Discord music bot won't join Voice channel
16 mars 2024, par SkelyI followed a tutorial for creating a music bot in discord, but it will not join my vc no matter what. Every command works and it gives the correct responses and songs is in the queue. The bot have every permission know to man, but it still won't join. Any way to fix this issue ?
Thanks in advance !!


This is my code and files


main.py


import discord
from discord.ext import commands
import os
import asyncio

from help_cog import help_cog
from music_cog import music_cog

bot = commands.Bot(
 command_prefix="?", 
 intents=discord.Intents.all(),
 help_command=None
)

async def main():
 async with bot:
 await bot.add_cog(help_cog(bot))
 await bot.add_cog(music_cog(bot))
 await bot.start(os.getenv("TOKEN"))

asyncio.run(main())



music_cog.py


import discord
from discord.ext import commands

from yt_dlp import YoutubeDL

import yt_dlp as youtube_dl

class music_cog(commands.Cog):
 def __init__(self, bot):
 self.bot = bot

 self.is_playing = False
 self.is_paused = False

 self.music_queue = []
 self.YDL_OPTIONS = {"format": "bestaudio", "postprocessors": [{"key": "FFmpegExtractAudio", "preferredcodec": "mp3", "preferredquality": "192",}]}
 self.FFMPEG_OPTIONS = {"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5", "options": "-vn"}

 self.vc = None
 print("Success")

 def search_yt(self, item):
 with YoutubeDL(self.YDL_OPTIONS) as ydl:
 try:
 info = ydl.extract_info(f"ytsearch:{item}", download=False)["entries"][0]
 except Exception:
 return False
 return {"source": info["url"], "title": info["title"]}

 def play_next(self):
 if len(self.music_queue) > 0:
 self.is_playing = True

 m_url = self.music_queue[0][0]["source"]

 self.music_queue.pop(0)

 self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())
 else:
 self.is_playing = False

 async def play_music(self, ctx):
 if len(self.music_queue) > 0:
 self.is_playing = True
 m_url = self.music_queue[0][0]["source"]

 if self.vc == None or not self.vc.is_connected():
 self.vc = await self.music_queue[0][1].connect()

 if self.vc == None:
 await ctx.send("Could not connect to the voice channel")
 return
 else:
 await self.vc.move_to(self.music_queue[0][1])
 
 self.music_queue.pop(0)

 self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())

 else:
 self.is_playing = False

 @commands.command(name="play", aliases=["p", "playing"], help="Play the selected song from YouTube")
 async def play(self, ctx, *args):
 query = " ".join(args)

 voice_channel = ctx.author.voice.channel
 if voice_channel is None:
 await ctx.send("Connect to a voice channel!")
 elif self.is_paused:
 self.vc.resume()
 else:
 song = self.search_yt(query)
 if type(song) == type(True):
 await ctx.send("Could not download the song. Incorrect format, try a different keyword")
 else:
 await ctx.send("Song added to queue")
 self.music_queue.append([song, voice_channel])

 if self.is_playing == False:
 await self.play_music(ctx)
 
 @commands.command(name="pause", help="Pauses the current song being played")
 async def pause(self, ctx, *args):
 if self.is_playing:
 self.is_playing = False
 self.is_paused = True
 self.vc.pause()
 elif self.is_paused:
 self.is_playing = True
 self.is_paused = False
 self.vc.resume()

 @commands.command(name="resume", aliases=["r"], help="Resumes playing the current song")
 async def resume(self, ctx, *args):
 if self.is_paused:
 self.is_playing = True
 self.is_paused = False
 self.vc.resume()
 
 @commands.command(name="skip", aliases=["s"], help="Skips the currently played song")
 async def skip(self, ctx, *args):
 if self.vc != None and self.vc:
 self.vc.stop()
 await self.play_music(ctx)

 @commands.command(name="queue", aliases=["q"], help="Displays all the songs currently in queue")
 async def queue(self, ctx):
 retval = ""

 for i in range(0, len(self.music_queue)):
 if i > 4: break
 retval += self.music_queue[i][0]["title"] + "\n"

 if retval != "":
 await ctx.send(retval)
 else:
 await ctx.send("No music in the current queue")
 
 @commands.command(name="clear", aliases=["c", "bin"], help="Stops the current song and clears the queue")
 async def clear(self, ctx, *args):
 if self.vc != None and self.is_playing:
 self.vc.stop()
 self.music_queue = []
 await ctx.send("Music queue cleared")

 @commands.command(name="leave", aliases=["disconnect", "l", "d"], help="Kick the bot from the voice channel")
 async def leave(self, ctx):
 self.is_playing = False
 self.is_paused = False
 await self.vc.disconnect()



help_cog.py


import discord
from discord.ext import commands

class help_cog(commands.Cog):
 def __init__(self, bot):
 self.bot = bot

 self.help_message = """
 Help message
"""

 self.text_channel_text = []
 
 @commands.Cog.listener()
 async def on_ready(self):
 for guild in self.bot.guilds:
 for channel in guild.text_channels:
 self.text_channel_text.append(channel)

 await self.send_to_all(self.help_message)

 async def send_to_all(self, msg):
 for text_channel in self.text_channel_text:
 await text_channel.send(msg)
 
 @commands.command(name="help", help="Displays all the available commands")
 async def help(self, ctx):
 await ctx.send(self.help_message)



-
Play playlist of audio on website using node to create a jukebox / radio app
1er juillet 2022, par neffSo I have some time on my hands and thought I would make myself a little jukebox / radio type app.



It would be fairly simple, just a collection of MP3's on the server, one is chosen at random, it plays, on completion, the next one is chosen and plays. The front of this would just be a super simple page that has a player and displays the metadata.



I don't really have any experience with server programming but I'm going to look in to Node, seems like it would be good for this. I've already written a little script in Python that chooses a song from a selection and plays it (using VLC at the moment) so it should be simple to port it to Node / js.



Just wondering if someone could point me in the right direction for how to link the "player" with the "playlist".



Looking in to it, I can only find solutions involving a client and server using shoutCast or ICEcast or similar - so the playlist streams audio to a shoutcast server, and the website is just a player looking at the shoutCast URL - that seems unnecessary for me, as the streaming and the site would be the same thing.



New to a lot of this :) but I have time at the moment so happy to get stuck in !



Thanks in advance