Recherche avancée

Médias (2)

Mot : - Tags -/documentation

Autres articles (23)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une 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 (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

Sur d’autres sites (2280)

  • 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))


    


  • 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)``` 


    


  • 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.