Recherche avancée

Médias (0)

Mot : - Tags -/tags

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

Autres articles (36)

  • MediaSPIP v0.2

    21 juin 2013, par

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

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, 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 (5470)

  • ytdl python "KeyError : formats"

    7 juillet 2022, par Mondumkreisung

    Im trying to make a discord music bot for personal use, since groovy and rythm got shut down.
It's working okay-ish I guess, but im having a problem with ytdl.
typing "-play" and an url is working just like intended, but i cant type "-play 'song name'".
Typing "-play example" gives me this :

    


    [download] Downloading playlist: example
[youtube:search] query "example": Downloading page 1
[youtube:search] playlist example: Downloading 1 videos
[download] Downloading video 1 of 1
[youtube] CLXt3yh2g0s: Downloading webpage
Ignoring exception in command play:
[download] Finished downloading playlist: example
Traceback (most recent call last):
  File "C:\Users\Dennis\PycharmProjects\groovy's true successor\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Dennis\PycharmProjects\groovy's true successor\voice.py", line 53, in play
    url2 = info['formats'][0]['url']
KeyError: 'formats'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Dennis\PycharmProjects\groovy's true successor\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Dennis\PycharmProjects\groovy's true successor\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Dennis\PycharmProjects\groovy's true successor\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 'formats'


    


    im fairly new to coding, so im sorry if somethings weird to understand.

    


    okay, so : typing -play with an url works fine, but typing -play with the song name doesnt. its only searching for the first word, downloads the first searchresult and then "crashes".

    


    so "-play Rick Astley - Never Gonna Give You Up" for example only searches for "Rick" and then it says something about KeyError : 'formats'
Here is my code :

    


    @client.command()
async def play(ctx, url):
    channel = ctx.author.voice.channel
    voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
    if voice and voice.is_connected():
        pass
    else:
        await channel.connect()

    ffmpeg_opts = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
    ydl_opts = {'format': "bestaudio/best", 'default_search': 'auto'}
    vc = ctx.voice_client

    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        info = ydl.extract_info(url, download=False)
        url2 = info['formats'][0]['url']
        source = await discord.FFmpegOpusAudio.from_probe(url2, **ffmpeg_opts)
        vc.play(source)


    


  • avformat/scd : add demuxer

    1er décembre 2021, par Zane van Iperen
    avformat/scd : add demuxer
    

    Adds demuxer for Square Enux SCD files.

    Based off [1] and personal investigation.

    This has only been tested against Drakengard 3 (PS3) *_SCD.XXX files
    (big-endian). As it is highly likely that FFXIV (PC) files are little-endian,
    this demuxer is marked as experimental until this can be confirmed.

    [1] : http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt

    Reviewed-by : Peter Ross <pross@xvid.org>
    Reviewed-by : Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
    Signed-off-by : Zane van Iperen <zane@zanevaniperen.com>

    • [DH] libavformat/Makefile
    • [DH] libavformat/allformats.c
    • [DH] libavformat/scd.c
  • How do I loop audio files in discord.py ?

    25 septembre 2021, par Jonah Alexander

    I cannot for the life of me find or figure out a solution that works anymore. here is both the bit of code that is actually important, and the whole file if you would like to see that too

    &#xA;

        async def play(self, ctx: commands.Context, url, lp):&#xA;        channel = ctx.author.voice.channel&#xA;&#xA;        if lp == &#x27;loop&#x27;:&#xA;            await channel.connect()&#xA;&#xA;            async with ctx.typing():&#xA;                player = await YTDLSource.from_url(url, loop=self.bot.loop)&#xA;                ctx.voice_client.play(player, after=lambda e: print(&#x27;Player error: %s&#x27; % e) if e else None)&#xA;            await ctx.send(&#x27;Now playing: {}&#x27;.format(player.title))&#xA;            while True:&#xA;                if not ctx.voice_client.is_playing():&#xA;                    async with ctx.typing():&#xA;                        ctx.voice_client.play(player, after=lambda e: print(&#x27;Player error: %s&#x27; % e) if e else None)&#xA;                time.sleep(0.5)&#xA;        else:&#xA;            async with ctx.typing():&#xA;                await channel.connect()&#xA;                player = await YTDLSource.from_url(url, loop=self.bot.loop)&#xA;                ctx.voice_client.play(player, after=lambda e: print(&#x27;Player error: %s&#x27; % e) if e else None)&#xA;            await ctx.send(&#x27;Now playing: {}&#x27;.format(player.title))&#xA;

    &#xA;

    from discord.ext import commands&#xA;import ffmpeg&#xA;import youtube_dl.YoutubeDL&#xA;import asyncio&#xA;import time&#xA;&#xA;&#xA;ytdl_format_options = {&#xA;    &#x27;format&#x27;: &#x27;bestaudio/best&#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;auto&#x27;,&#xA;    &#x27;source_address&#x27;: &#x27;0.0.0.0&#x27;  # bind to ipv4 since ipv6 addresses cause issues sometimes&#xA;}&#xA;&#xA;ffmpeg_options = {&#xA;    &#x27;options&#x27;: &#x27;-vn&#x27;&#xA;}&#xA;&#xA;&#xA;ytdl = youtube_dl.YoutubeDL(ytdl_format_options)&#xA;&#xA;&#xA;class YTDLSource(discord.PCMVolumeTransformer):&#xA;    def __init__(self, source, *, data, volume=0.5):&#xA;        super().__init__(source, volume)&#xA;&#xA;        self.data = data&#xA;&#xA;        self.title = data.get(&#x27;title&#x27;)&#xA;        self.url = data.get(&#x27;url&#x27;)&#xA;&#xA;    @classmethod&#xA;    async def from_url(cls, url, *, loop=None, stream=False):&#xA;        loop = loop or asyncio.get_event_loop()&#xA;        data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))&#xA;&#xA;        if &#x27;entries&#x27; in data:&#xA;            # take first item from a playlist&#xA;            data = data[&#x27;entries&#x27;][0]&#xA;&#xA;        filename = data[&#x27;url&#x27;] if stream else ytdl.prepare_filename(data)&#xA;        return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)&#xA;&#xA;&#xA;class MyBoi(commands.Cog):&#xA;    def __init__(self, bot: commands.Bot):&#xA;        self.bot = bot&#xA;        self.voice_states = {}&#xA;&#xA;    @commands.command(name=&#x27;leave&#x27;)&#xA;    async def leave(self, ctx: commands.Context):&#xA;        await ctx.voice_client.disconnect()&#xA;&#xA;    @commands.command(name=&#x27;play&#x27;)&#xA;    async def play(self, ctx: commands.Context, url, lp):&#xA;        channel = ctx.author.voice.channel&#xA;&#xA;        if lp == &#x27;loop&#x27;:&#xA;            await channel.connect()&#xA;&#xA;            async with ctx.typing():&#xA;                player = await YTDLSource.from_url(url, loop=self.bot.loop)&#xA;                ctx.voice_client.play(player, after=lambda e: print(&#x27;Player error: %s&#x27; % e) if e else None)&#xA;            await ctx.send(&#x27;Now playing: {}&#x27;.format(player.title))&#xA;            while True:&#xA;                if not ctx.voice_client.is_playing():&#xA;                    async with ctx.typing():&#xA;                        ctx.voice_client.play(player, after=lambda e: print(&#x27;Player error: %s&#x27; % e) if e else None)&#xA;                time.sleep(0.5)&#xA;        else:&#xA;            async with ctx.typing():&#xA;                await channel.connect()&#xA;                player = await YTDLSource.from_url(url, loop=self.bot.loop)&#xA;                ctx.voice_client.play(player, after=lambda e: print(&#x27;Player error: %s&#x27; % e) if e else None)&#xA;            await ctx.send(&#x27;Now playing: {}&#x27;.format(player.title))&#xA;&#xA;&#xA;intents = discord.Intents.all()&#xA;&#xA;clnt = commands.Bot(command_prefix=&#x27;#&#x27;, intents=intents)&#xA;clnt.add_cog(MyBoi(clnt))&#xA;&#xA;lop = {0: False}&#xA;plr = {}&#xA;&#xA;&#xA;@clnt.event&#xA;async def on_ready():&#xA;    print("ready")&#xA;&#xA;&#xA;clnt.run("the actual key normally")&#xA;

    &#xA;

    is the code poorly made and/or badly organized ? probably. but this is a personal project and did not expect to be sharing this with anyone. If you need clarification on anything lmk.

    &#xA;

    with the code here, the issue im getting is when I do the looped version, the bot disconnects for a frame and reconnects, then I get this error

    &#xA;

    &#xA;

    discord.ext.commands.errors.CommandInvokeError : Command raised an exception : ClientException : Not connected to voice.

    &#xA;

    &#xA;

    the bot does not disconnect immediately when not using the looped version, and trying to manually reconnect it at the start of the loop gives me an error saying it's already connected.

    &#xA;

    also sidenote I did not write the YTDLSource class or the ytdl_format_options.

    &#xA;