Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP

Autres articles (78)

  • Le profil des utilisateurs

    12 avril 2011, par

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

  • Pas question de marché, de cloud etc...

    10 avril 2011

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

  • Liste des distributions compatibles

    26 avril 2011, par

    Le tableau ci-dessous correspond à la liste des distributions Linux compatible avec le script d’installation automatique de MediaSPIP. Nom de la distributionNom de la versionNuméro de version Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    Si vous souhaitez nous aider à améliorer cette liste, vous pouvez nous fournir un accès à une machine dont la distribution n’est pas citée ci-dessus ou nous envoyer le (...)

Sur d’autres sites (8423)

  • My discord music bot is not playing the entire music

    21 décembre 2024, par james12

    My discord music bot based on discord.py, yt_dlp and ffmpeg is not working.
I downloaded every module that is required and added environmental variables.
But, my discord bot is not working properly.
The bot plays the music properly at first, but the music ends before the song finishes.

    


    Full code below :

    


    import discord
from discord.ext import commands
import yt_dlp

app = commands.Bot(command_prefix='!', intents=discord.Intents.all())
ydl_opts = {
    'format': 'bestaudio/best',
    'extractaudio': True,
    'audioformat': 'mp3',
    'outtmpl': 'downloads/%(title)s.%(ext)s',
    'quiet': True,
}

@app.event
async def on_ready():
    print('Done')
    await app.change_presence(status=discord.Status.online, activity=None)

@app.command()
async def play(ctx, *, search: str):
    channel = ctx.author.voice.channel
    voice_client = discord.utils.get(app.voice_clients, guild=ctx.guild)

    if not voice_client:
        voice_client = await channel.connect()

    with yt_dlp.YoutubeDL(ydl_opts) as ydl:
        info = ydl.extract_info(f"ytsearch:{search}", download=False)['entries'][0]
        url = info['url']
        title = info['title']

    # 음악 재생
    voice_client.play(discord.FFmpegPCMAudio(url, executable="ffmpeg"), after=lambda e: print("재생 완료"))
    await ctx.send(f"{ctx.author.mention}님이 요청하신 {title} 노래 재생 중")

@app.command()
async def stop(ctx):
    voice_client = discord.utils.get(app.voice_clients, guild=ctx.guild)
    if voice_client and voice_client.is_playing():
        voice_client.stop()
        await voice_client.disconnect()
    
app.run('token')


    


    I tried to add options in FFmpeg like this : options="-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5"
but it doesn't work.
I also added extra yt-dlp options.
I hope the bot properly plays the full version of music from youtube in discord.

    


  • music bot stops after playing music for 30-50 secs

    19 mars 2023, par ra1nb0w
    const { QueryType } = require("discord-player")&#xA;const player = require("../../client/player")&#xA;const Discord = require(&#x27;discord.js&#x27;)&#xA;&#xA;module.exports = {&#xA;    name: &#x27;play&#x27;,&#xA;    cooldown: 5,&#xA;    aliases: [&#x27;p&#x27;],&#xA;    description: "Plays a song",&#xA;    usage: "?p <song></song>vid-URL>",&#xA;    category: "Music",&#xA;&#xA;    async execute(client, message, args) {&#xA;        const songTitle = args.join(" ")&#xA;        const queue = await player.createQueue(message.guild);&#xA;        const nosongEmbed = new Discord.MessageEmbed()&#xA;            .setColor(&#x27;#3d35cc&#x27;)&#xA;            .setDescription(`‼️ - Please provide a song URL or song name!`)&#xA;&#xA;        if (!songTitle) return message.reply({ embeds: [nosongEmbed] })&#xA;        &#xA;&#xA;        const novcEmbed = new Discord.MessageEmbed()&#xA;            .setColor(&#x27;#3d35cc&#x27;)&#xA;            .setDescription(`‼️ - You have to be in a Voice Channel to use this command!`)&#xA;&#xA;        if (!message.member.voice.channel) return message.reply({ embeds: [novcEmbed] })&#xA;        if (!queue.connection) await queue.connect(message.member.voice.channel)&#xA;&#xA;        let url = songTitle&#xA;            &#xA;            // Search for the song using the discord-player&#xA;            const result = await player.search(url, {&#xA;                requestedBy: message.author,&#xA;                searchEngine: QueryType.AUTO&#xA;            })&#xA;&#xA;            // finish if no tracks were found&#xA;            if (result.tracks.length === 0)&#xA;                return message.reply("No results")&#xA;&#xA;            // Add the track to the queue&#xA;            const song = result.tracks[0]&#xA;            await queue.addTrack(song)&#xA;            const embed = new Discord.MessageEmbed()&#xA;                .setColor("AQUA")&#xA;                .setDescription(`**[${song.title}](${song.url})** has been added to the Queue`)&#xA;                .setThumbnail(song.thumbnail)&#xA;                .setFooter({ text: `Duration: ${song.duration}`})&#xA;            message.reply({ embeds: [embed] })&#xA;            if (!queue.playing) await queue.play()&#xA;            &#xA;&#xA;            &#xA;&#xA;        }&#xA;        &#xA;    }&#xA;&#xA;

    &#xA;

    i used the command then the song just stops playing after 30-50 seconds, it is supposed to play till the music finishes and then keep staying in the voice channel until a few mins of no music

    &#xA;

    i have reinstalled ffmpeg

    &#xA;

    using :&#xA;discord.js : 13.14.0&#xA;discord-player : 5.2.2

    &#xA;

  • Python Discord music bot stops playing a couple of minutes into any song

    9 mars 2023, par knewby

    I am trying to put together a Python Discord music bot as a fun little project. Outside of the required discord library I'm currently using the YouTube API to search for videos and parse the URL (not shown in code), yt-dlp which is a fork of yt_download that is still maintained to get the info from the YT URL, and FFMPEG to play the song obtained from yt-dlp through the bot. My play command seems to work as the 1st YT video result will start to play, but roughly 30-90 seconds into the audio, it stops playing. I get this message in the console :

    &#xA;

    2023-02-23 14:54:44 IN discord.player ffmpeg process 4848 successfully terminated with return code of 0.

    &#xA;

    So there is no error for me to go off of. I've included the full output from the console below...

    &#xA;

    -----------------------------------&#xA;groovy-jr#6741 is up and running&#xA;-----------------------------------&#xA;2023-02-23 14:53:23 INFO     discord.voice_client Connecting to voice...&#xA;2023-02-23 14:53:23 INFO     discord.voice_client Starting voice handshake... (connection attempt 1)&#xA;2023-02-23 14:53:24 INFO     discord.voice_client Voice handshake complete. Endpoint found us-south1655.discord.media&#xA;2023-02-23 14:54:44 INFO     discord.player ffmpeg process 4848 successfully terminated with return code of 0.  &lt;= AUDIO STOPS&#xA;

    &#xA;

    I'm currently developing this project on a Windows 11 machine, but I've had the issue running it on my Ubuntu machine as well. I am just hosting the bot directly from the VSCode terminal for development.

    &#xA;

    I've been trying to do research on this problem, the problem is I can't find many recent information for the issue. There was another post that talked about a similar problem and had an answer suggesting the following FFMPEG options be used which I tried to no avail.

    &#xA;

    FFMPEG_OPTIONS = {&#xA;                    &#x27;before_options&#x27;: &#x27;-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5&#x27;,&#xA;                    &#x27;options&#x27;: &#x27;-vn&#x27;,&#xA;                 }&#xA;

    &#xA;

    I'll include the problem file below :

    &#xA;

    import discord&#xA;from discord.ext import commands&#xA;from discord import FFmpegPCMAudio&#xA;import responses&#xA;import youtubeSearch as YT&#xA;import yt_dlp&#xA;&#xA;async def send_message(message, user_message, is_private = False):&#xA;    try:&#xA;        response = responses.handle_response(user_message)&#xA;        await message.author.send(response) if is_private else await message.channel.send(response)&#xA;    except Exception as e:&#xA;        print(e)&#xA;&#xA;def run_discord_bot():&#xA;    intents = discord.Intents.default()&#xA;    intents.message_content = True&#xA;&#xA;    TOKEN = &#x27;xxxxxx&#x27;&#xA;    client = commands.Bot(command_prefix = &#x27;-&#x27;, intents=intents)&#xA;&#xA;    @client.event&#xA;    async def on_ready():&#xA;        print(&#x27;-----------------------------------&#x27;)&#xA;        print(f&#x27;{client.user} is up and running&#x27;)&#xA;        print(&#x27;-----------------------------------&#x27;)&#xA;&#xA;    @client.command(name=&#x27;play&#x27;, aliases=[&#x27;p&#x27;], pass_context = True)&#xA;    async def play(ctx, *, search_term:str = None):&#xA;        if ctx.author.voice:&#xA;            voice = None&#xA;            if search_term == None:&#xA;                await ctx.send(&#x27;No song specified.&#x27;)&#xA;                return&#xA;            if not ctx.voice_client:&#xA;                channel = ctx.message.author.voice.channel&#xA;                voice = await channel.connect()&#xA;            else:&#xA;                voice = ctx.guild.voice_client&#xA;            &#xA;            url = YT.singleSearch(search_term)&#xA;            &#xA;            YTDLP_OPTIONS = {&#xA;                &#x27;format&#x27;: &#x27;bestaudio/best&#x27;,&#xA;                &#x27;extractaudio&#x27;: True,&#xA;                &#x27;audioformat&#x27;: &#x27;mp3&#x27;,&#xA;                &#x27;outtmpl&#x27;: &#x27;%(extractor)s-%(id)s-%(title)s.%(ext)s&#x27;,&#xA;                &#x27;restrictfilenames&#x27;: True,&#xA;                &#x27;noplaylist&#x27;: True,&#xA;                &#x27;nocheckcertificate&#x27;: True,&#xA;                &#x27;ignoreerrors&#x27;: False,&#xA;                &#x27;logtostderr&#x27;: False,&#xA;                &#x27;quiet&#x27;: True,&#xA;                &#x27;no_warnings&#x27;: True,&#xA;                &#x27;default_search&#x27;: &#x27;ytsearch&#x27;,&#xA;                &#x27;source_address&#x27;: &#x27;0.0.0.0&#x27;,&#xA;            }&#xA;&#xA; =====>     FFMPEG_OPTIONS = {&#xA;                &#x27;before_options&#x27;: &#x27;-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5&#x27;,&#xA;                &#x27;options&#x27;: &#x27;-vn&#x27;,&#xA;            }&#xA;&#xA;            with yt_dlp.YoutubeDL(YTDLP_OPTIONS) as ydl:&#xA;                info = ydl.extract_info(url, download=False)&#xA;                playUrl = info[&#x27;url&#x27;]&#xA;&#xA;            source = FFmpegPCMAudio(playUrl, options=FFMPEG_OPTIONS)&#xA;            voice.play(source)&#xA;        else:&#xA;            await ctx.send(&#x27;You must be in a voice channel to play a song!&#x27;)&#xA;            return&#xA;&#xA;    @client.command(pass_context = True)&#xA;    async def leave(ctx):&#xA;        if ctx.voice_client:&#xA;            await ctx.guild.voice_client.disconnect()&#xA;        else:&#xA;            await ctx.send("I&#x27;m not in a voice channel!")&#xA;&#xA;    @client.command(pass_context = True)&#xA;    async def pause(ctx):&#xA;        voice = discord.utils.get(client.voice_clients, guild = ctx.guild)&#xA;        if voice.is_playing():&#xA;            voice.pause()&#xA;        else:&#xA;            await ctx.send(&#x27;No audio playing...&#x27;)&#xA;&#xA;    @client.command(pass_context = True)&#xA;    async def resume(ctx):&#xA;        voice = discord.utils.get(client.voice_clients, guild = ctx.guild)&#xA;        if voice.is_paused():&#xA;            voice.resume()&#xA;        else:&#xA;            await ctx.send(&#x27;No audio paused...&#x27;)&#xA;&#xA;    @client.command(pass_context = True)&#xA;    async def stop(ctx):&#xA;        voice = discord.utils.get(client.voice_clients, guild = ctx.guild)&#xA;        voice.stop()&#xA;&#xA;    client.run(TOKEN)&#xA;

    &#xA;

    I appreciate any guidance I can get !

    &#xA;