Recherche avancée

Médias (2)

Mot : - Tags -/media

Autres articles (1)

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

  • 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

    


        async def play(self, ctx: commands.Context, url, lp):
        channel = ctx.author.voice.channel

        if lp == 'loop':
            await channel.connect()

            async with ctx.typing():
                player = await YTDLSource.from_url(url, loop=self.bot.loop)
                ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
            await ctx.send('Now playing: {}'.format(player.title))
            while True:
                if not ctx.voice_client.is_playing():
                    async with ctx.typing():
                        ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
                time.sleep(0.5)
        else:
            async with ctx.typing():
                await channel.connect()
                player = await YTDLSource.from_url(url, loop=self.bot.loop)
                ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
            await ctx.send('Now playing: {}'.format(player.title))


    


    from discord.ext import commands
import ffmpeg
import youtube_dl.YoutubeDL
import asyncio
import time


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:
            # take first item from a playlist
            data = data['entries'][0]

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


class MyBoi(commands.Cog):
    def __init__(self, bot: commands.Bot):
        self.bot = bot
        self.voice_states = {}

    @commands.command(name='leave')
    async def leave(self, ctx: commands.Context):
        await ctx.voice_client.disconnect()

    @commands.command(name='play')
    async def play(self, ctx: commands.Context, url, lp):
        channel = ctx.author.voice.channel

        if lp == 'loop':
            await channel.connect()

            async with ctx.typing():
                player = await YTDLSource.from_url(url, loop=self.bot.loop)
                ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
            await ctx.send('Now playing: {}'.format(player.title))
            while True:
                if not ctx.voice_client.is_playing():
                    async with ctx.typing():
                        ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
                time.sleep(0.5)
        else:
            async with ctx.typing():
                await channel.connect()
                player = await YTDLSource.from_url(url, loop=self.bot.loop)
                ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
            await ctx.send('Now playing: {}'.format(player.title))


intents = discord.Intents.all()

clnt = commands.Bot(command_prefix='#', intents=intents)
clnt.add_cog(MyBoi(clnt))

lop = {0: False}
plr = {}


@clnt.event
async def on_ready():
    print("ready")


clnt.run("the actual key normally")


    


    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.

    


    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

    


    


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

    


    


    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.

    


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

    


  • Our release signature has changed

    8 mars 2022, par justin — Security

    We have been cryptographically signing Matomo releases since 2014, so you can verify the signature of the release you downloaded. Up until Matomo 4.8.0 releases were signed with Matthieu Aubry’s personal signature. In Matomo 4.8.0 we made some improvements to our release systems including automating the release builds. As part of these improvements it makes sense to now use a Matomo signature, which means a few changes are required for verifying releases. There is no security issue around the previous key, which can still be used to verify older release builds.

    There is a new signature here : builds.matomo.org/signature.asc. You can use this signature according to our updated instructions to verify releases for Matomo version 4.8.0 and newer. You will need to import this signature to verify new releases.

    If you want to verify the signature of a release prior to Matomo 4.8.0 you can now find Matthieu’s signature here : builds.matomo.org/signature-pre-4.8.0.asc, and the same instructions apply. If you already imported Matthieu’s signature, you won’t need to do this again.

  • ffmpeg Padding & Delay to Audio File Accurately

    14 avril 2022, par Ry-

    Recently I've been doing a personal project which does entail a little bit of
audio handling but I have noticed that the commands that I am using to modify
don't have a 1:1 correlation in the resulting file leading to it being fairly
offbeat (Note that this program is error sensitive).

    


    All I need to do is accurately add Padding to the start of an audio file, or
jumpforward to some point in the song using an Offset/Delay value. The values
are strictly accurate such as 0.13149s however accuracy passed the third radix
is pretty redundant since 'nobody' should be able to notice it.

    


    Here is an example of one issue:

    [Input File Info] // This is a test case/correct values
    Supposed to start at : 0.875
    Originally started at: 1.190
    Offset Value         : -0.315
    Difference           : 1.190 - 0.875 = 0.315


    


        // Audio file offset attempt (FAIL)
    FFMPEG Command:  
        ffmpeg -y -i "..." -ss 0.315 -c copy -map 0 "..."
        
    [Output File Info]
    Start Time Beat         : 0.766 
    Start Time Beat Audacity: 0.766
    Resulting Error         : 0.106


    


    What I want to know is if someone knows a better way to get 1:1 accuracy from
the command or atleast as close to it as possible. I don't often use ffmpeg so
I probably am missing vital information (I did my best googling ok :) but to
this I also wouldn't abstain from using a dedicated audio library for the
language I'm writing the program in (Java).

    


    I probably should mention that I have been using:
    ffmpeg -y -i "..." -af "adelay=DELAY" "..."

to add the padding but I haven't really gotten around to testing audio files
that require this yet so I don't know if its broken/inaccurate.