Recherche avancée

Médias (0)

Mot : - Tags -/albums

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

Autres articles (79)

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

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

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

  • My code accidently deleted my 'song.mp3' file in Discord.py music bot

    2 avril 2021, par Alkaria

    I was coding my discord bot and i was trying to make the bot not try to connect twice. Like, if it's already connected any user sends another ' !play' command, i don't want it to error. But that's not my problem. I or my code accidently deleted my 'song.mp3' file. How do i get it back. I closed the pycharm so i can't do 'CRTL + Z'.

    


    @client.command()

    


    async def play(ctx, url : str) :

    


    song_there = os.path.isfile("song.mp3")
try:
    if song_there:
        os.remove("song.mp3")
except PermissionError:
    await ctx.send("Şimdi Çalan şarkının bitmesini bekleyin. Yada '!stop' komutunu kullanın.")
    return
# connects the voice channel
connected = ctx.author.voice
audio = discord.FFmpegPCMAudio("song.mp3")

voiceChannel = discord.utils.get(ctx.guild.voice_channels, name='music')
if not discord.client.VoiceClient == None:  # None being the default value if the bot isnt in a channel (which is why the is_connected() is returning errors)
    await voiceChannel.connect()
    await ctx.send(f"Joined **{voiceChannel}**")
    discord.client.VoiceClient.play()
else:
    await ctx.send("I'm already connected!")



audio = discord.FFmpegPCMAudio("song.mp3")

# Dowloads the video from the link given

ydl_opts = {
    'format': 'bestaudio/best',
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192',
    }],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download([url])
for file in os.listdir("./"):
    if file.endswith(".mp3"):
        os.rename(file, "song.mp3")


    


  • My music doesn't play correctly and other problems - Discord.py

    24 mars 2021, par Diacono

    So, I'm triying to let my bot play songs directly from the url (without downloading them like the song.mp3 method) but I'm having a hard time. The bot plays only 1 song and when I try to play another song it doesn't play it.
I'm also getting 2 errors : video_link is not defined and self is not defined.
Also when I try to play live music like "lofi hip hop radio - beats to relax/study to" nothing happens.
Can you help me please ???

    


    This is my code

    


    import asyncio
import discord
from discord.ext import commands, tasks
import requests
import json
from random import choice
from discord.utils import get
from discord import FFmpegPCMAudio
import youtube_dl
bot = commands.Bot(command_prefix="!")



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=False):
        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:
            data = data['entries'][0]

        filename = data['url'] if stream else ytdl.prepare_filename(data)
        return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)


@bot.command()
async def play(ctx, url):
    voice = await ctx.author.voice.channel.connect()
    player = await YTDLSource.from_url(url, loop=client.loop)
    ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
    ydl_opts = {'format': 'bestaudio'}
    FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
         info = ydl.extract_info(video_link, download=False)
         URL = info['formats'][0]['url']
    voice = get(self.bot.voice_clients, guild=ctx.guild)
    voice.play(discord.FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))


    


  • How do I add a cool down to a command for a discord music bot [closed]

    22 mars 2021, par sherbit fish

    I'm making a music bot in discord and I need to add a cool down into this command so that people don't spam it and crash the bot. What should I do to fix this problem ?

    


    const ytdl = require("ytdl-core");

client.on('message', async message => {
  if (message.member.voice.channel) {
    const connection = await message.member.voice.channel.join();
    console.log(`sound was just played`);
connection.play(ytdl('https://www.youtube.com/watch?v=jRxSRyrTANY',{ highWaterMark: 50 },{ quality: 'highestaudio' },{ type: 'opus' }));
setTimeout(() => {
  connection.disconnect();
}, 12000); 
  }
});