
Recherche avancée
Médias (2)
-
SPIP - plugins - embed code - Exemple
2 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (84)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
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 (...) -
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
Sur d’autres sites (8907)
-
Pycord Music Bot : AttributeError : 'FFmpegAudio' object has no attribute '_process'
5 juin 2022, par Steven MaoI've made a discord Cog that should be able to queue up and play music, but I'm getting an error from FFmpeg when I actually try to play the URL. I have found an identical question on StackOverflow, but this user's problem was a random typo. The inputs should all be correct, so I am not sure if the problem is my code or my package.


What have I done wrong ?


class MusicClass(commands.Cog):
 #universal attributes
 YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist': 'True'}
 FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}

 def __init__(self, bot):
 self.bot = bot
 self.is_playing = False
 self.music_queue = [[],''] #[[music1, music2, music3...], channel_obj]
 self.vc = ''

 @commands.command()
 async def join(self, ctx):
 if not ctx.message.author.voice:
 await ctx.send("{} is not connected to a voice channel".format(ctx.message.author.name))
 return
 else:
 channel = ctx.message.author.voice.channel
 await channel.connect()

 @commands.command()
 async def leave(self, ctx):
 voice_client = ctx.message.guild.voice_client
 if voice_client.is_connected():
 await voice_client.disconnect()
 else:
 await ctx.send("The bot is not connected to a voice channel.")
 
 #rtype: list[dict{str:}]
 #params: search string/web URL, top number of results to show
 #returns list of top 5 queries and their information
 def search_yt(self, search_query, num_results = 3):
 with YoutubeDL(self.YDL_OPTIONS) as ydl:
 try:
 top_results = ydl.extract_info(f"ytsearch{num_results}:{search_query}", download=False)['entries'][0:{num_results}]
 for i in range(len(top_results)):
 top_results[i] = {
 'title': top_results[i]['title'],
 'source': top_results[i]['formats'][0]['url'],
 'channel': top_results[i]['channel'],
 'duration': top_results[i]['duration'],
 'url': top_results[i]['webpage_url']
 }
 except:
 print(f'SEARCH_YT ERROR\t search="{search_query}"')
 return False
 return top_results
 
 #rtype: None
 #looks at queue, decides whether to play the next song in queue or stop
 def play_next(self):
 print('called play_next')
 if len(self.music_queue) > 0:
 self.is_playing = True
 #assigns url AND removes from queue
 music_url = self.music_queue[0][0]['source']
 self.music_queue[0].pop(0)
 self.vc.play(discord.FFmpegAudio(music_url, **self.FFMPEG_OPTIONS), after = lambda e: self.play_next())
 else:
 self.is_playing = False

 #rtype: None
 #similar to play_next but optimized for first-time playing
 #checks if a song in queue + checks if bot's connected, then begins to play
 async def play_now(self):
 print('called play_now, queue:', self.music_queue[0])
 if len(self.music_queue) > 0:
 self.is_playing = True
 music_url = self.music_queue[0][0]['source']
 if self.vc == '' or not self.vc.is_connected():
 self.vc = await self.music_queue[1].connect()
 else:
 print('moving to new channel')
 self.vc = await self.bot.move_to(self.music_queue[1])
 self.music_queue[0].pop(0)

 #######################################################################################################
 print('ERROR HAPPENS RIGHT HERE')
 self.vc.play(discord.FFmpegAudio(music_url, **self.FFMPEG_OPTIONS), after = lambda e: self.play_next())
 #######################################################################################################
 
 else:
 self.is_playing = False

 @commands.command()
 #dynamically checks for URL link or search query, then attempts to play
 async def p(self, ctx, *args):
 voice_channel = ctx.author.voice.channel

 if voice_channel == None: #not in a VC
 await ctx.send('You have to be in a voice channel first')
 return
 else: #set channel, search and play music
 if self.music_queue[1] != voice_channel:
 self.music_queue[1] = voice_channel
 if args[0].startswith('https://www.youtube.com/watch'): #search URL
 #search web_url directly and send object to music queue
 with YoutubeDL(self.YDL_OPTIONS) as ydl:
 try:
 print('attempting to extract URL:', args[0])
 music_obj = ydl.extract_info(args[0], download=False)
 music_obj = {
 'title': music_obj['title'],
 'source': music_obj['formats'][0]['url'],
 'channel': music_obj['channel'],
 'duration': music_obj['duration'],
 'url': music_obj['webpage_url']
 }
 print('music object:', music_obj)
 print('appending URL song queue')
 self.music_queue[0].append(music_obj)
 except:
 print('URL search failed. URL =', args[0])
 else: #search query, display search results, ask for which one, then add to queue
 num_results = args[len(args)-1] if args[len(args)-1].isdigit() else 3
 song_list = self.search_yt(' '.join(args), num_results)
 
 if not self.is_playing:
 await self.play_now()



Now my error message...


Exception ignored in: <function at="at" 0x7ff4b0a5b5e0="0x7ff4b0a5b5e0">
Traceback (most recent call last):
 File "/home/stevenmao/.local/lib/python3.8/site-packages/discord/player.py", line 127, in __del__
 self.cleanup()
 File "/home/stevenmao/.local/lib/python3.8/site-packages/discord/player.py", line 247, in cleanup
 self._kill_process()
 File "/home/stevenmao/.local/lib/python3.8/site-packages/discord/player.py", line 198, in _kill_process
 proc = self._process
AttributeError: 'FFmpegAudio' object has no attribute '_process'
</function>


-
discord.py and ffmpeg : Play a sound effect while playing music
26 juin 2022, par JPhusionI would like to play a sound effect while playing music in a vc using discord.py and ffmpeg. I know you cannot play more than one audio source at a time, so instead I am trying to pause the music, play the sound effect and continue the music.


This is what I've come up with so far, but because I am playing the sound effect, the resume() method no longer works after the pause().


@commands.command()
 async def sfx(self, ctx):
 try:
 voice = await ctx.author.voice.channel.connect()
 except:
 voice = ctx.guild.voice_client
 try:
 voice.pause()
 # voice.play(discord.FFmpegPCMAudio('./media/sfx/notification.mp3'))
 except:
 voice.pause()
 # voice.play(discord.FFmpegPCMAudio(executable=r"C:\Users\josh\Programming\Discord\ffmpeg\bin\ffmpeg.exe", source='./media/sfx/notification.mp3'))
 guild = self.client.get_guild(752756902525403156)
 member = guild.get_member(876292773639233596)
 print(member.activities[0].name)
 await asyncio.sleep(1)
 voice.resume()
 if member.activities[0].name == "Not playing music":
 await voice.disconnect()



-
My bot that I uploaded to heroku doesn't work the music command
25 août 2022, par Lucas SilvaI'm creating a bot for discord it works great locally, but after I uploaded it on heroku the music command stopped working I'm using these buildpacksenter image description here


The command code is this


@commands.command(name="musga", help="coloque um url da musica que deseja reproduzir!")
async def play(self, ctx, arg):
 global vc
 
 try:
 voice_channel = ctx.author.voice.channel
 vc = await voice_channel.connect()
 except:
 print('[ERROR]') #debug

 if vc.is_playing():
 await ctx.send(f'{ctx.author.mention}, Já estou cantando.')

 else:
 with YoutubeDL(self.YDL_OPTIONS) as ydl:
 info = ydl.extract_info(arg, download=False)
 
 URL = info['formats'][0]['url']

 vc.play(discord.FFmpegPCMAudio(executable="ffmpeg", source = URL, **self.FFMPEG_OPTIONS))
 
 while vc.is_playing():
 await sleep(1)



in my requirements.txt file I have :
discord.py[voice]
PyNaCL
youtube_dl
ffmpeg


When I use the command it enters the call but it doesn't play the music and it doesn't return any error.


i hope someone can help me. Thanks in advance