
Recherche avancée
Médias (1)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
Autres articles (78)
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Pas question de marché, de cloud etc...
10 avril 2011Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
sur le web 2.0 et dans les entreprises qui en vivent.
Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...) -
Liste des distributions compatibles
26 avril 2011, parLe tableau ci-dessous correspond à la liste des distributions Linux compatible avec le script d’installation automatique de MediaSPIP. Nom de la distributionNom de la versionNuméro de version Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
Si vous souhaitez nous aider à améliorer cette liste, vous pouvez nous fournir un accès à une machine dont la distribution n’est pas citée ci-dessus ou nous envoyer le (...)
Sur d’autres sites (8423)
-
My discord music bot is not playing the entire music
21 décembre 2024, par james12My discord music bot based on discord.py, yt_dlp and ffmpeg is not working.
I downloaded every module that is required and added environmental variables.
But, my discord bot is not working properly.
The bot plays the music properly at first, but the music ends before the song finishes.


Full code below :


import discord
from discord.ext import commands
import yt_dlp

app = commands.Bot(command_prefix='!', intents=discord.Intents.all())
ydl_opts = {
 'format': 'bestaudio/best',
 'extractaudio': True,
 'audioformat': 'mp3',
 'outtmpl': 'downloads/%(title)s.%(ext)s',
 'quiet': True,
}

@app.event
async def on_ready():
 print('Done')
 await app.change_presence(status=discord.Status.online, activity=None)

@app.command()
async def play(ctx, *, search: str):
 channel = ctx.author.voice.channel
 voice_client = discord.utils.get(app.voice_clients, guild=ctx.guild)

 if not voice_client:
 voice_client = await channel.connect()

 with yt_dlp.YoutubeDL(ydl_opts) as ydl:
 info = ydl.extract_info(f"ytsearch:{search}", download=False)['entries'][0]
 url = info['url']
 title = info['title']

 # 음악 재생
 voice_client.play(discord.FFmpegPCMAudio(url, executable="ffmpeg"), after=lambda e: print("재생 완료"))
 await ctx.send(f"{ctx.author.mention}님이 요청하신 {title} 노래 재생 중")

@app.command()
async def stop(ctx):
 voice_client = discord.utils.get(app.voice_clients, guild=ctx.guild)
 if voice_client and voice_client.is_playing():
 voice_client.stop()
 await voice_client.disconnect()
 
app.run('token')



I tried to add options in FFmpeg like this :
options="-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5"

but it doesn't work.
I also added extra yt-dlp options.
I hope the bot properly plays the full version of music from youtube in discord.

-
music bot stops after playing music for 30-50 secs
19 mars 2023, par ra1nb0wconst { QueryType } = require("discord-player")
const player = require("../../client/player")
const Discord = require('discord.js')

module.exports = {
 name: 'play',
 cooldown: 5,
 aliases: ['p'],
 description: "Plays a song",
 usage: "?p <song></song>vid-URL>",
 category: "Music",

 async execute(client, message, args) {
 const songTitle = args.join(" ")
 const queue = await player.createQueue(message.guild);
 const nosongEmbed = new Discord.MessageEmbed()
 .setColor('#3d35cc')
 .setDescription(`‼️ - Please provide a song URL or song name!`)

 if (!songTitle) return message.reply({ embeds: [nosongEmbed] })
 

 const novcEmbed = new Discord.MessageEmbed()
 .setColor('#3d35cc')
 .setDescription(`‼️ - You have to be in a Voice Channel to use this command!`)

 if (!message.member.voice.channel) return message.reply({ embeds: [novcEmbed] })
 if (!queue.connection) await queue.connect(message.member.voice.channel)

 let url = songTitle
 
 // Search for the song using the discord-player
 const result = await player.search(url, {
 requestedBy: message.author,
 searchEngine: QueryType.AUTO
 })

 // finish if no tracks were found
 if (result.tracks.length === 0)
 return message.reply("No results")

 // Add the track to the queue
 const song = result.tracks[0]
 await queue.addTrack(song)
 const embed = new Discord.MessageEmbed()
 .setColor("AQUA")
 .setDescription(`**[${song.title}](${song.url})** has been added to the Queue`)
 .setThumbnail(song.thumbnail)
 .setFooter({ text: `Duration: ${song.duration}`})
 message.reply({ embeds: [embed] })
 if (!queue.playing) await queue.play()
 

 

 }
 
 }




i used the command then the song just stops playing after 30-50 seconds, it is supposed to play till the music finishes and then keep staying in the voice channel until a few mins of no music


i have reinstalled ffmpeg


using :
discord.js : 13.14.0
discord-player : 5.2.2


-
Python Discord music bot stops playing a couple of minutes into any song
9 mars 2023, par knewbyI am trying to put together a Python Discord music bot as a fun little project. Outside of the required discord library I'm currently using the YouTube API to search for videos and parse the URL (not shown in code), yt-dlp which is a fork of yt_download that is still maintained to get the info from the YT URL, and FFMPEG to play the song obtained from yt-dlp through the bot. My play command seems to work as the 1st YT video result will start to play, but roughly 30-90 seconds into the audio, it stops playing. I get this message in the console :


2023-02-23 14:54:44 IN discord.player ffmpeg process 4848 successfully terminated with return code of 0.


So there is no error for me to go off of. I've included the full output from the console below...


-----------------------------------
groovy-jr#6741 is up and running
-----------------------------------
2023-02-23 14:53:23 INFO discord.voice_client Connecting to voice...
2023-02-23 14:53:23 INFO discord.voice_client Starting voice handshake... (connection attempt 1)
2023-02-23 14:53:24 INFO discord.voice_client Voice handshake complete. Endpoint found us-south1655.discord.media
2023-02-23 14:54:44 INFO discord.player ffmpeg process 4848 successfully terminated with return code of 0. <= AUDIO STOPS



I'm currently developing this project on a Windows 11 machine, but I've had the issue running it on my Ubuntu machine as well. I am just hosting the bot directly from the VSCode terminal for development.


I've been trying to do research on this problem, the problem is I can't find many recent information for the issue. There was another post that talked about a similar problem and had an answer suggesting the following FFMPEG options be used which I tried to no avail.


FFMPEG_OPTIONS = {
 'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
 'options': '-vn',
 }



I'll include the problem file below :


import discord
from discord.ext import commands
from discord import FFmpegPCMAudio
import responses
import youtubeSearch as YT
import yt_dlp

async def send_message(message, user_message, is_private = False):
 try:
 response = responses.handle_response(user_message)
 await message.author.send(response) if is_private else await message.channel.send(response)
 except Exception as e:
 print(e)

def run_discord_bot():
 intents = discord.Intents.default()
 intents.message_content = True

 TOKEN = 'xxxxxx'
 client = commands.Bot(command_prefix = '-', intents=intents)

 @client.event
 async def on_ready():
 print('-----------------------------------')
 print(f'{client.user} is up and running')
 print('-----------------------------------')

 @client.command(name='play', aliases=['p'], pass_context = True)
 async def play(ctx, *, search_term:str = None):
 if ctx.author.voice:
 voice = None
 if search_term == None:
 await ctx.send('No song specified.')
 return
 if not ctx.voice_client:
 channel = ctx.message.author.voice.channel
 voice = await channel.connect()
 else:
 voice = ctx.guild.voice_client
 
 url = YT.singleSearch(search_term)
 
 YTDLP_OPTIONS = {
 'format': 'bestaudio/best',
 'extractaudio': True,
 'audioformat': 'mp3',
 'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
 'restrictfilenames': True,
 'noplaylist': True,
 'nocheckcertificate': True,
 'ignoreerrors': False,
 'logtostderr': False,
 'quiet': True,
 'no_warnings': True,
 'default_search': 'ytsearch',
 'source_address': '0.0.0.0',
 }

 =====> FFMPEG_OPTIONS = {
 'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
 'options': '-vn',
 }

 with yt_dlp.YoutubeDL(YTDLP_OPTIONS) as ydl:
 info = ydl.extract_info(url, download=False)
 playUrl = info['url']

 source = FFmpegPCMAudio(playUrl, options=FFMPEG_OPTIONS)
 voice.play(source)
 else:
 await ctx.send('You must be in a voice channel to play a song!')
 return

 @client.command(pass_context = True)
 async def leave(ctx):
 if ctx.voice_client:
 await ctx.guild.voice_client.disconnect()
 else:
 await ctx.send("I'm not in a voice channel!")

 @client.command(pass_context = True)
 async def pause(ctx):
 voice = discord.utils.get(client.voice_clients, guild = ctx.guild)
 if voice.is_playing():
 voice.pause()
 else:
 await ctx.send('No audio playing...')

 @client.command(pass_context = True)
 async def resume(ctx):
 voice = discord.utils.get(client.voice_clients, guild = ctx.guild)
 if voice.is_paused():
 voice.resume()
 else:
 await ctx.send('No audio paused...')

 @client.command(pass_context = True)
 async def stop(ctx):
 voice = discord.utils.get(client.voice_clients, guild = ctx.guild)
 voice.stop()

 client.run(TOKEN)



I appreciate any guidance I can get !