Recherche avancée

Médias (0)

Mot : - Tags -/diogene

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

Autres articles (39)

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

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

Sur d’autres sites (2211)

  • Discord music bot doesn't play songs

    9 octobre 2023, par Gam3rsCZ

    I have made myself a discord bot that also plays music(it's only for my server so strings with messages are in Czech, but code is in English).
Bot worked a while ago but now it stopped, and I don't know where the problem is

    


    I'm getting these errors : HTTP error 403 Forbidden Server returned 403 Forbidden (access denied) and
C :\Users\Me\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\player.py:711 : RuntimeWarning : coroutine 'music_cog.play_next' was never awaited
self.after(error)
RuntimeWarning : Enable tracemalloc to get the object allocation traceback
[2023-10-09 16:23:47] [INFO ] discord.player : ffmpeg process 17496 successfully terminated with return code of 1.
INFO : ffmpeg process 17496 successfully terminated with return code of 1.

    


    My code is :

    


    import discord
from discord.ext import commands
from yt_dlp import YoutubeDL

class music_cog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

        self.is_playing = False
        self.is_paused = False
        self.current = ""

        self.music_queue = []
        self.YDL_OPTIONS = {"format": "m4a/bestaudio/best", "noplaylist": "True"}
        self.FFMPEG_OPTIONS = {"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5", "options": "-vn"}

        self.vc = None

    def search_yt(self, item):
        with YoutubeDL(self.YDL_OPTIONS) as ydl:
            try:
                info = ydl.extract_info("ytsearch:%s" % item, download=False)["entries"][0]
            except Exception:
                return False
        info = ydl.sanitize_info(info)
        url = info['url']
        title = info['title']
        return {'title': title, 'source': url}

    async def play_next(self):
        if len(self.music_queue) > 0:
            self.is_playing = True
            self.current = self.music_queue[0][0]["title"]
            m_url = self.music_queue[0][0]["source"]

            self.music_queue.pop(0)

            await self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e:  self.play_next())
        else:
            self.is_playing = False

    async def play_music(self, ctx):
        try:
            if len(self.music_queue) > 0:
                self.is_playing = True
                m_url = self.music_queue[0][0]["source"]

                if self.vc == None or not self.vc.is_connected():
                    self.vc =  await self.music_queue[0][1].connect()

                    if self.vc == None:
                        await ctx.send("Nepodařilo se připojit do hlasového kanálu.")
                        return
                else:
                    await self.vc.move_to(self.music_queue[0][1])

                self.current = self.music_queue[0][0]["title"]
                self.music_queue.pop(0)

                self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())
            else:
                self.is_playing = False

        except:
            print("Something went wrong")
            await ctx.send(content="Něco se pokazilo")

    @commands.command(name="play", help="Plays selected song from YouTube")
    async def play(self, ctx, *args):
        query = " ".join(args)

        voice_channel = ctx.author.voice.channel
        if voice_channel is None:
            await ctx.send("Připojte se do hlasového kanálu!")
        elif self.is_paused:
            self.vc.resume()
        else:
            song = self.search_yt(query)
            if type(song) == type(True):
                await ctx.send("Písničku se nepodařilo stáhnout. Špatný formát, možná jste se pokusili zadat playlist nebo livestream.")
            else:
                await ctx.send("Písnička přidána do řady.")
                self.music_queue.append([song, voice_channel])

                if self.is_playing == False:
                    await self.play_music(ctx)
                    self.is_playing = True

    @commands.command(name="pause", aliases=["p"], help="Pauses the BOT")
    async def pause(self, ctx, *args):
        if self.is_playing:
            self.is_playing = False
            self.is_paused = True
            self.vc.pause()
            await ctx.send(content="Písnička byla pozastavena.")
            
        elif self.is_paused:
            self.is_playing = True
            self.is_paused = False
            self.vc.resume()
            await ctx.send(content="Písnička byla obnovena.")

    @commands.command(name="resume", aliases=["r"], help="Resumes playing")
    async def resume(self, ctx, *args):
        if self.is_paused:
            self.is_paused = False
            self.is_playing = True
            self.vc.resume()
            await ctx.send(content="Písnička byla obnovena.")

    @commands.command(name="skip", aliases=["s"], help="Skips current song")
    async def skip(self, ctx, *args):
        if self.vc != None and self.vc:
            self.vc.stop()
        await self.play_next()
        await ctx.send(content="Písnička byla přeskočena.")

    @commands.command(name="queue", aliases=["q"], help="Displays song queue")
    async def queue(self, ctx, songs=5):
        retval = ""

        for i in range(0, len(self.music_queue)):
            if i > songs: break
            retval += "    " + self.music_queue[i][0]["title"] + "\n"

        if retval != "":
            retval += "```"
            await ctx.send(content=("```Aktuální fronta:\n" + retval))
        else:
            await ctx.send("Řada je prázdná.")

    @commands.command(name="clear", help="Clears the queue")
    async def clear(self, ctx):
        if self.vc != None and self.is_playing:
            self.vc.stop()
        self.music_queue = []
        await ctx.send("Řada byla vymazána.")

    @commands.command(name="leave", aliases=["dc", "disconnect"], help="Disconnects the BOT")
    async def leave(self, ctx):
        self.is_playing = False
        self.is_paused = False

        if self.vc != None:
            return await self.vc.disconnect(), await ctx.send(content="BOT byl odpojen.")

        else:
            return await ctx.send("BOT není nikde připojen.")
   
    @commands.command(name="current", help="Displays the current song")
    async def current(self, ctx):
        current = self.current
        retval = f"```Právě hraje:\n    {current}```"
        if current != "":
            await ctx.send(retval)
        else:
            await ctx.send("Aktuálně nic nehraje.")


    


    I already tried everything I can think of(which isn't a lot because I suck at programming), and also tried searching for some solution on the internet, but nothing worked.

    


  • How do I make my discord.py bot play a sound effect ?

    15 mai 2024, par Kronik71

    My bot is supposed to be some sort of jeopardy quiz show type of bot. /joinvc makes the bot connect to the call, however, I cant seem to make the bot make noise when its in a vc. Here's some of the code :

    


    @interactions.slash_command(
    name="press",
    description="Press the button"
)

async def press(ctx: interactions.ComponentContext):
    await ctx.send(f"{ctx.author.mention} has pressed the button")
    vc = ctx.author.voice.channel
    player = vc.create_ffmpeg_player('audiopath', after=lambda: print('done'))
    player.start()


    


    But whenever I use the /press command, I get this error AttributeError: 'GuildVoice' object has no attribute 'create_ffmpeg_player'

    


    Is it something I did wrong with ffmpeg ?

    


    I tried using a different way to write the code, basically grabbing the ffmpeg.exe path and the audio path, didn't work either. I just want the bot to play a small noise whenever someone uses /press command.

    


  • How can I fix choppy ffmpeg RTP streaming over wifi ?

    19 décembre 2015, par awidgery

    I have a Raspberry Pi, with a USB mic and a WiFi dongle dongle connected.

    I’m trying to stream audio only from the Pi, with the intention of receiving the stream over wifi to a custom iOS mobile app using VLCKit. I’m using ffmpeg on the Pi as I need a reasonably low (<2s) latency for this project, and using Icecast/Darkice gave around 15s latency.

    The code executed on the Pi is :

    ffmpeg -f alsa -i plughw:1,0 -acodec libmp3lame -ab 128k -ac 1 -ar 44100  -f rtp rtp://234.5.5.5:1234

    On the Pi end I have a device playing (Christmas !) music constantly into the USB mic for testing purposes. The Pi is only connected by WiFi - not ethernet.

    For testing receiving the stream, I’m using VLC (on a Macbook/iPhone).

    When the Mac is connected through Ethernet, the stream works fine, as you can see here :

    https://goo.gl/photos/HZgNh7z4HgaqHBaP7

    However, when the Mac is connected via WiFi, the stream is choppy, as you can see here :

    https://goo.gl/photos/qjAVH6djqS9Jbvmh6

    You can also see a ping trace from the Mac to the Pi, and the VLC stats. As you can see there doesn’t seem to be a correlation between either of these and the choppiness.

    I’ve tried the VLC iOS app and the choppiness is the same as the Mac on WiFi.

    How can I decrease/remove this chop, even if doing so increases latency a bit ?