Recherche avancée

Médias (0)

Mot : - Tags -/masques

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (61)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (4763)

  • Hosting music bot on heroku

    2 mars 2021, par itsmaxplayz

    I have made a discord bot on discord.py rewrite which plays music in a voice channel. The code is as follows :

    


    def search(query):

    with ytdl:
        try:
            requests.get(query)
        except:
            info = ytdl.extract_info(f"ytsearch:{query}", download=False)['entries'][0]
        else:
            info = ytdl.extract_info(query, download=False)
    return info, info['formats'][0]['url']

ydl_opts = {
    'format': 'bestaudio/best',
    'quiet': True,
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192',
    }],

}

ytdl = youtube_dl.YoutubeDL(ydl_opts)

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

@client.command(aliases=['p'])
async def play(ctx, *, url):
    channel = ctx.message.author.voice.channel
    voice = get(client.voice_clients, guild=ctx.guild)
    if voice and voice.is_connected():
        pass
    else:
        voice = await channel.connect()
        await ctx.send(f'Successfully joined `{channel}`')

    if voice.is_playing():
        await ctx.send('Already playing a song. Try using -q or -queue to queue a song 
    :thumbsup:')
    else:
        await ctx.send(f'Searching for: `{url}` :mag_right:')
        video, source = search(url)
        voice.play(FFmpegPCMAudio(source, **FFMPEG_OPTS))
        voice.is_playing()
        await ctx.send(f'Playing: :notes: `{video["title"]}` - Now!')


    


    It works locally but when I upload the code to heroku (I use github to push the code to heroku), the bot does not come online.
These are the libraries that I imported in the code :

    


    import discord
import json
import random
import youtube_dl
import requests
import os
from discord.ext import commands
from discord.utils import get
from discord import FFmpegPCMAudio
import ctypes
import ctypes.util


    


    I have installed the ffmpeg buildpacks as I saw in another post on this website but the bot doesn't come online.

    


    Contents of my requirement file :

    


    discord.py,
discord.py[voice],
ffmpeg,
PyNaCl,
youtube_dl,
requests,
discord.py[FFmpegPCMAudio],
colorlog.

    


  • How to get best audio quality on music bot using discord.py ?

    9 mai 2021, par user28606

    I've built a discord music bot in discord.py but for some reason, it doesn't play music in as high quality as Fredboat or Rythm(so I don't think voice chat's bitrate is the problem). I've tried a couple of things online.

    


    The only thing that improved quality a little bit was downloading the song before playing it. But the quality was still far from anything like Fredboat's. It's also very impractical since downloading a 1h song takes a while and is space consuming.

    


    I'm interested in how to fix this and the explanation for why this is happening.

    


    This is the code we're currently using for the music bot :

    


    from discord import FFmpegPCMAudio
import discord
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from apscheduler.triggers.cron import CronTrigger
from discord.ext import commands, tasks
from youtubesearchpython import VideosSearch

class cmd_music(commands.Cog, name="music_commands"):

    def __init__(self, bot):
        self.bot = bot
        self.music_queue = []
        self.scheduler = AsyncIOScheduler()
        self.scheduler.add_job(self.check_queue, CronTrigger(second="0,5,10,15,20,25,30,35,40,45,50,55"))
        self.scheduler.start()
    
    async def play_raw(self, voice_client):
        if not self.music_queue:
            return

        YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist':'True'}
        FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
        if not voice_client.is_playing():
            with YoutubeDL(YDL_OPTIONS) as ydl:
                info = ydl.extract_info(self.music_queue.pop(0), download=False)
            URL = info['formats'][0]['url']
            voice_client.play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
            voice_client.is_playing()

    async def check_queue(self):
        if not self.bot.voice_clients: return
        
        client = self.bot.voice_clients[0]
        if not client.is_playing():
            if self.music_queue:
                await self.play_raw(client)
           
        
    @commands.command(brief="join")
    async def join(self, ctx):
        await ctx.author.voice.channel.connect()

    @commands.command(brief="leave")
    async def leave(self, ctx):
        await ctx.voice_client.disconnect()
        self.music_queue = []

    @commands.command(brief="play")
    async def play(self, ctx, *name):
        url = VideosSearch(" ".join(name[:]), 1).result().get("result")[0].get("link")
        self.music_queue.append(url)
        await ctx.send("Now playing: " + url)

    @commands.command(brief="skip")
    async def skip(self, ctx):
        await ctx.send("Skipped current song")
        ctx.voice_client.stop()
        if self.music_queue:
            await self.play_raw(ctx.voice_client)``` 


    


  • ctx.voice_client.play not playing music — Discord.py

    15 février 2021, par SYCK playz

    Here I am trying to make a music bot. Currently my bot connects to the voice channel but doesn't play anything. ctx.voice_client.play does nothing, nor does it produce any errors.

    


    These have been my attempted trials, yet none work. What is the problem ?

    


    ctx.voice_client.play(source=discord.FFmpegPCMAudio('song0.mp3'))


    


    ctx.voice_client.play(source=discord.FFmpegPCMAudio('song0.mp3', executable='path/to/ffmpeg.exe'))


    


    ctx.voice_client.play(source=discord.FFmpegPCMAudio('song0.mp3', executable='path/to/ffmpeg.exe', before_options = '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', options = '-vn'))


    


    ffmpeg_options = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
ctx.voice_client.play(source=discord.FFmpegPCMAudio('song0.mp3', executable='path/to/ffmpeg.exe', **ffmpeg_options))