
Recherche avancée
Médias (1)
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
Autres articles (76)
-
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 (...) -
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 (...) -
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, 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 (...)
Sur d’autres sites (6024)
-
How do I add a queue to my music bot using Discrod.py FFmpeg and youtube_dl ?
28 septembre 2022, par Виктор ЛисичкинI'm writing my bot for discord, I can't figure out how to track the end of a song to lose the next one. I sort of figured out the piece of music, but I don't fully understand what to do next. Here is my code for main.py


from discord.ext import commands, tasks
from config import settings
from music_cog import music_cog
bot = commands.Bot(command_prefix='!',intents = discord.Intents.all())

@bot.event
async def on_ready():
 print(f'We have logged in as {bot.user}')
 await bot.add_cog(music_cog(bot))

bot.run(settings['token'])



and And this is for cog with music


from discord.ext import commands
from youtube_dl import YoutubeDL
YDL_OPTIONS = {'format': 'worstaudio/best', 'noplaylist': 'False', 'simulate': 'True',
 'preferredquality': '192', 'preferredcodec': 'mp3', 'key': 'FFmpegExtractAudio'}
FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
queue = []
class music_cog(commands.Cog):
 def __init__(self, bot):
 self.bot = bot
 @commands.command(pass_context=True)
 async def play(self,ctx, *, arg):
 global queue
 queue.append(arg)
 def playing():
 for song in queue:
 with YoutubeDL(YDL_OPTIONS) as ydl:
 if 'https://' in song:
 info = ydl.extract_info(song, download=False)
 else:
 info = ydl.extract_info(f"ytsearch:{song}", download=False)['entries'][0]

 url = info['formats'][0]['url']
 queue.pop(0)
 vc.play(discord.FFmpegPCMAudio(executable="ffmpeg", source=url, **FFMPEG_OPTIONS))
 voice_client = discord.utils.get(self.bot.voice_clients, guild=ctx.guild)
 if not ctx.message.author.voice:
 await ctx.send("You are not connected to voice chanel")
 elif voice_client:
 queue.append(arg)
 else:
 vc = await ctx.message.author.voice.channel.connect()
 playing()
 @commands.command(pass_context = True)
 async def disconect(self, ctx):
 server = ctx.message.guild.voice_client
 if ctx.message.guild.voice_client:
 await server.disconnect()
 else:
 await ctx.send("I am not connected")

 @commands.command(pass_context=True)
 async def stop(self, ctx):
 server = ctx.message.guild
 voice_channel = server.voice_client
 voice_channel.pause()

 @commands.command(pass_context=True)
 async def resumue(self, ctx):
 server = ctx.message.guild
 voice_channel = server.voice_client
 voice_channel.resume()



-
heroku-22 stack discord.py bot doesn't play music
30 août 2022, par bon hoI'm making music bot with discord.py and using heroku. bot is playing music my localhost but heroku host is not playing music.


I found what cause a bug.
It working nicely in heroku-20, but not working in heroku-22 stack.


How can I use heroku-22 stack without error ?
What can I do ?


I'm sorry my english is bad.


my code :


import youtube_dl
import discord
from discord import app_commands,Interaction
import asyncio
import os

class MyClient(discord.Client):
 async def on_ready(self):
 await self.wait_until_ready()
 await tree.sync()
 print(f"login at {self.user}")
 
intents= discord.Intents.all()
client = MyClient(intents=intents)
tree = app_commands.CommandTree(client)

youtube_dl.utils.bug_reports_message = lambda: ''
ytdl_format_options = {
 'format': 'bestaudio/best',
 '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': 'auto',
 'source_address': '0.0.0.0', # bind to ipv4 since ipv6 addresses cause issues sometimes
}

ffmpeg_options = {
 'options': '-vn',
}
ytdl = youtube_dl.YoutubeDL(ytdl_format_options)
class YTDLSource(discord.PCMVolumeTransformer):
 def __init__(self, source, *, data, volume=0.5):
 super().__init__(source, volume)

 self.data = data

 self.title = data.get('title')
 self.url = data.get('url')

 @classmethod
 async def from_url(cls, url, *, loop=None, stream=True):
 loop = loop or asyncio.get_event_loop()
 data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))
 if 'entries' in data:
 # take first item from a playlist
 data=data['entries'][0]
 filename = data['url'] if stream else ytdl.prepare_filename(data)
 return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)
queue={}
@tree.command(name="play", description="play music")
async def playmusic(interaction:Interaction,url_title:str,playfirst:bool=False):
 await interaction.response.send_message("I'm looking for music!!")
 guild=str(interaction.guild.id)
 try:
 queue[guild]
 except KeyError:
 queue[guild]=[]
 if interaction.user.voice is None:
 await interaction.edit_original_response(content="you must join any voice channel")
 else:
 voice_client: discord.VoiceClient = discord.utils.get(client.voice_clients, guild=interaction.guild)
 if voice_client == None:
 await interaction.user.voice.channel.connect()
 voice_client: discord.VoiceClient = discord.utils.get(client.voice_clients, guild=interaction.guild)
 player = await YTDLSource.from_url(url_title, loop=None)
 if playfirst and len(queue[guild])>1:
 queue[guild].insert(1,player)
 else:
 queue[guild].append(player)
 if not voice_client.is_playing():
 voice_client.play(player,after=None)
 await interaction.edit_original_response(content=f"{player.title} playing!!")
 else:
 await interaction.edit_original_response(content=f"{player.title} enqueued!")
 await asyncio.sleep(7)
 await interaction.delete_original_response()

client.run(token)



-
heroku discord.py bot doesn't play music
30 août 2022, par bon hoI'm making music bot with discord.py and using heroku. bot is playing music my localhost but heroku host is not playing music.


I found what cause a bug.
It working nicely in heroku-20, but not working in heroku-22 stack.


How can I use heroku-22 stack without error ?
What can I do ?


I'm sorry my english is bad.


my code :


import youtube_dl
import discord
from discord import app_commands,Interaction
import asyncio
import os

class MyClient(discord.Client):
 async def on_ready(self):
 await self.wait_until_ready()
 await tree.sync()
 print(f"login at {self.user}")
 
intents= discord.Intents.all()
client = MyClient(intents=intents)
tree = app_commands.CommandTree(client)

youtube_dl.utils.bug_reports_message = lambda: ''
ytdl_format_options = {
 'format': 'bestaudio/best',
 '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': 'auto',
 'source_address': '0.0.0.0', # bind to ipv4 since ipv6 addresses cause issues sometimes
}

ffmpeg_options = {
 'options': '-vn',
}
ytdl = youtube_dl.YoutubeDL(ytdl_format_options)
class YTDLSource(discord.PCMVolumeTransformer):
 def __init__(self, source, *, data, volume=0.5):
 super().__init__(source, volume)

 self.data = data

 self.title = data.get('title')
 self.url = data.get('url')

 @classmethod
 async def from_url(cls, url, *, loop=None, stream=True):
 loop = loop or asyncio.get_event_loop()
 data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))
 if 'entries' in data:
 # take first item from a playlist
 data=data['entries'][0]
 filename = data['url'] if stream else ytdl.prepare_filename(data)
 return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)
queue={}
@tree.command(name="play", description="play music")
async def playmusic(interaction:Interaction,url_title:str,playfirst:bool=False):
 await interaction.response.send_message("I'm looking for music!!")
 guild=str(interaction.guild.id)
 try:
 queue[guild]
 except KeyError:
 queue[guild]=[]
 if interaction.user.voice is None:
 await interaction.edit_original_response(content="you must join any voice channel")
 else:
 voice_client: discord.VoiceClient = discord.utils.get(client.voice_clients, guild=interaction.guild)
 if voice_client == None:
 await interaction.user.voice.channel.connect()
 voice_client: discord.VoiceClient = discord.utils.get(client.voice_clients, guild=interaction.guild)
 player = await YTDLSource.from_url(url_title, loop=None)
 if playfirst and len(queue[guild])>1:
 queue[guild].insert(1,player)
 else:
 queue[guild].append(player)
 if not voice_client.is_playing():
 voice_client.play(player,after=None)
 await interaction.edit_original_response(content=f"{player.title} playing!!")
 else:
 await interaction.edit_original_response(content=f"{player.title} enqueued!")
 await asyncio.sleep(7)
 await interaction.delete_original_response()

client.run(token)