
Recherche avancée
Autres articles (39)
-
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
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 (...) -
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)
Sur d’autres sites (2211)
-
Discord bot python : discord.errors.ClientException : ffmpeg was not found
14 septembre 2021, par S. KloreI'm trying to make a discord bot that plays music in a voice channel. It connects to the voice channel, but doesn't play anything. It also gives an error in the console.



I'm on Windows and I'm using the discord.py rewrite.



My code :



import discord, random, datetime, asyncio, nacl, ffmpeg

TOKEN = 'What token'

client = discord.Client()

@client.event
async def on_message(message):
if message.content.lower() == '$play':
 if message.content.lower() == '$play':
 channel = client.get_channel(547155964328149007)
 vc = await channel.connect()
 vc.play(discord.FFmpegPCMAudio('mp3.mp3'), after=lambda e: print('done', e))
 vc.is_playing()
 vc.pause()
 vc.resume()
 vc.stop()

@client.event
async def on_ready():
 print('Logged in as {0.user}'.format(client))

client.run(TOKEN)




The error :



Traceback (most recent call last):
 File "D:\Python35\lib\site-packages\discord\client.py", line 218, in _run_event
 await coro(*args, **kwargs)
 File "discord_bot.py", line 90, in on_message
 vc.play(discord.FFmpegPCMAudio('mp3.mp3'), after=lambda e: print('done', e))
 File "D:\Python35\lib\site-packages\discord\player.py", line 165, in __init__
 raise ClientException(executable + ' was not found.') from None
discord.errors.ClientException: ffmpeg was not found.




People seem to have a similar-ish issue with
ffmpeg/avconv was not found in your PATH environment variable
but the fix for them is to download ffmpeg from a website and put it in their PATH, but that doesn't work for me.


Further more I can only find fixes for my problem in JavaScript, while I'm coding the bot in Python 3.



Here are some links from my research :



You need to add FFmpeg to your path



A discord.js (JavaScript) fix for the same error



A fix for discord.py, NOT for discord.py REWRITE


-
A Soundboard for Discord with Discord.py with already downloaded .mp3 files
8 août 2019, par Kerberos KevI’m setting up a discord bot with discord.py, and want to implement an soundboard.The soundboard should take already downloaded .mp3 files and play them in the discord. The bot already automatically joins and disconnects from a voice channel but does not play any of my sound files.
I tried converting the mp3 file into an opus one and just play it without ffmpeg but this didn’t work either.
import discord
from discord.ext import commands
from discord.utils import get
from mutagen.mp3 import MP3
import time
import os
client = commands.Bot(command_prefix='<')
a = './'+'kurz-kacken.mp3'
class Soundboard(commands.Cog):
def __init__(self, client):
self.client = self
@commands.command(pass_context=True)
async def soundboard(self, ctx, songname: str):
channel = ctx.message.author.voice.channel
voice = get(client.voice_clients, guild=ctx.guild)
if voice and voice.is_connected():
await voice.move_to(channel)
else:
voice = await channel.connect()
print(f"The bot has connected to {channel}\n")
# audio = MP3('./'+'kurz-kacken.mp3')
# a = audio.info.length
voice.play(discord.FFmpegPCMAudio('./'+'kurz-kacken.mp3'),
after=lambda e: print("Song done!"))
voice.source = discord.PCMVolumeTransformer(voice.source)
voice.source.volume = 0.07
# time.sleep(a)
await ctx.send(f'ended')
if voice and voice.is_connected():
await voice.disconnect()
def setup(client):
client.add_cog(Soundboard(client)) -
voice_client.play doesn't continue loop (Discord) (Solved)
19 mars 2023, par RazurioSOLVED see end


songs = asyncio.Queue(maxsize=0)
currently_playing = False


@client.command()
async def play(ctx, url):
 global songs
 global currently_playing
 if currently_playing:
 with yt_dlp.YoutubeDL({"format": "bestaudio", "outtmpl": "Queue_Download/%(title)s.%(ext)s"}) as ydl:
 info = ydl.extract_info(url, download=True)
 filename = ydl.prepare_filename(info)
 await songs.put({"file": filename, "info": video_info(url)})
 # print("test 1")
 else:
 with yt_dlp.YoutubeDL({"format": "bestaudio", "outtmpl": "Queue_Download/%(title)s.%(ext)s"}) as ydl:
 info = ydl.extract_info(url, download=True)
 filename = ydl.prepare_filename(info)
 await songs.put({"file": filename, "info": video_info(url)})
 # print("test 2")
 asyncio.create_task(queue(ctx))



async def queue(ctx):
 global songs
 global currently_playing
 currently_playing = True
 while True:
 if songs.empty():
 currently_playing = False
 await ctx.reply("Queue is now empty")
 await ctx.voice_client.disconnect() # disconnect from voice channel when queue is empty
 break
 else: 
 song = await songs.get()
 filename = song["file"]
 voice_channel = ctx.author.voice.channel
 if not ctx.voice_client: # check if bot is not already connected to a voice channel
 await voice_channel.connect()

 await ctx.reply('playing')
 await ctx.voice_client.play(discord.FFmpegPCMAudio(filename))

@client.command()
async def stop(ctx):
 global songs
 await ctx.voice_client.disconnect()
 await empty_queue(songs)
 await ctx.reply('Stopped')

async def empty_queue(songs):
 while not songs.empty():
 songs.get_nowait()



I have problems with the "await ctx.voice_client.play(discord.FFmpegPCMAudio(filename))" which doesn't continue after finishing.


I know you can use a after= parameter in voice_client.play() but I didn't manage to get it to work to recursivly call queue()


async def play_next(ctx):
global songs
global currently_playing
if songs.empty():
 currently_playing = False
 await ctx.reply("Queue is now empty")
 await ctx.voice_client.disconnect() # disconnect from voice channel when queue is empty
else: 
 song = await songs.get()
 filename = song["file"]
 voice_channel = ctx.author.voice.channel
 if not ctx.voice_client: # check if bot is not already connected to a voice channel
 await voice_channel.connect()

 def after(error):
 if error:
 print(f'Error in after callback: {error}')
 asyncio.create_task(play_next(ctx))

 await ctx.reply('playing')
 ctx.voice_client.play(discord.FFmpegPCMAudio(filename), after=after)



I tried using the after parameter like like but I just get an error in line 116, in after asyncio.create_task(play_next(ctx)) "no running event loop" ... "Calling the after function failed"


EDIT


async def play_next(ctx):
global loop
global songs
global currently_playing
global tasks
loop = asyncio.get_event_loop()
if songs.empty():
 currently_playing = False
 await ctx.reply("Queue is now empty")
 await ctx.voice_client.disconnect() # disconnect from voice channel when queue is empty
else:
 
 song = await songs.get()
 filename = song["file"]
 voice_channel = ctx.author.voice.channel
 if not ctx.voice_client: # check if bot is not already connected to a voice channel
 await voice_channel.connect()
 def after(error):
 if error:
 print("er")
 loop.create_task(queue(ctx))

 await ctx.reply('playing')
 ctx.voice_client.play(discord.FFmpegPCMAudio(filename), after=after)



using loop = asyncio.get_event_loop() and loop.create_task(queue(ctx)) made it finally work
took inspiration from this post