Recherche avancée

Médias (1)

Mot : - Tags -/censure

Autres articles (60)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Création définitive du canal

    12 mars 2010, par

    Lorsque votre demande est validée, vous pouvez alors procéder à la création proprement dite du canal. Chaque canal est un site à part entière placé sous votre responsabilité. Les administrateurs de la plateforme n’y ont aucun accès.
    A la validation, vous recevez un email vous invitant donc à créer votre canal.
    Pour ce faire il vous suffit de vous rendre à son adresse, dans notre exemple "http://votre_sous_domaine.mediaspip.net".
    A ce moment là un mot de passe vous est demandé, il vous suffit d’y (...)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

Sur d’autres sites (5316)

  • Compile ffmpeg for WinRT with libvpx ?

    7 janvier 2018, par Sean O'Neil

    Following this guide :
    https://trac.ffmpeg.org/wiki/CompilationGuide/WinRT

    Can anyone tell me if it’s possible to build and include libvpx into this ?

  • How to gain volumes of specific bands of audio files using ffmpeg ?

    10 mai 2019, par Ko Ohhashi

    I want increase or decrease volume of specific frequency bands with ffmpeg.

    I think bandreject and bandpass filter can do similar thing.
    But is there any way to reject 80% of energy of specific bands ?

    Thanks in advance ?

  • Music queue, discord.py music bot

    29 mars 2021, par Luca M. Schmidt

    II'm trying to add a queue system to my music cog. When possible it should be able to add songs and play the next song after the one before ended. An explanation on how it should work is sufficient, there's no need to provide any code at all. If any additional information is needed feel free to ask.

    


    My Code (Stripped down a bit) :

    


    # IMPORT


import discord
from discord.ext import commands
import json
import asyncio
import youtube_dl



# LOKALE_VARIABLEN


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'
}

ffmpeg_options = {
    'options': '-vn'
}

ytdl = youtube_dl.YoutubeDL(ytdl_format_options)

songs = asyncio.Queue()
play_next_song = asyncio.Event()


# ----

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')
        self.thumbnail = data.get('thumbnail')


    @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)


# COG_SETUP(START)


class Music(commands.Cog):

    def __init__(self, client):
        self.client = client


    @commands.command()
    async def join(self, ctx, *, channel: discord.VoiceChannel):

        if ctx.voice_client is not None:
            return await ctx.voice_client.move_to(channel)

        await channel.connect()

    @commands.command()
    @commands.cooldown(1, 10, commands.BucketType.user)
    async def play(self, ctx, *, url):

        try:

            async with ctx.typing():
                player = await YTDLSource.from_url(url, loop=self.client.loop, stream=True)
            ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)

        except:
            embed = discord.Embed(
                title='Fehler!',
                colour=discord.Colour.red(),
                description='Dies ist eine nicht Unterstützte URL!'
            )

            return await ctx.send(embed=embed)

        embed = discord.Embed(
            title='',
            colour=discord.Colour.blue(),
            description=f'[{format(player.title)}]({player.url})'
        )
        embed.set_author(name='Spielt gerade:')
        embed.set_image(url=player.thumbnail)
        embed.set_footer(text=f'Hinzugefügt von: {ctx.author.name}', icon_url=ctx.author.avatar_url)


        await ctx.send(embed=embed)




    @commands.command()
    async def volume(self, ctx, volume: int):

        if ctx.voice_client is None:

            embed = discord.Embed(
                title='Fehler!',
                colour=discord.Colour.red(),
                description='Ich bin mit keinem Sprachkanal verbunden!'
            )

            return await ctx.send(embed=embed)

        elif ctx.voice_client is not None:

            if volume in range(0, 201):
                try:
                    ctx.voice_client.source.volume = volume / 100

                    embed = discord.Embed(
                        title='Lautstärke',
                        colour=discord.Colour.blue(),
                        description=f'Lautstärke auf **{format(volume)}**% gestellt.'
                    )
                    embed.set_footer(text=f"Angepasst von: {ctx.author.name}", icon_url=ctx.author.avatar_url)

                    return await ctx.send(embed=embed)
                except:
                    pass

            else:

                embed = discord.Embed(
                    title='Fehler!',
                    colour=discord.Colour.red(),
                    description='Das ist Lauter, als die Musik geht!'
                )

                return await ctx.send(embed=embed)

    @commands.command()
    async def stop(self, ctx):
        try:

            await ctx.voice_client.disconnect()
            await ctx.message.delete()

        except:
            pass

    @commands.command()
    async def pause(self, ctx):

        if ctx.voice_client.is_playing():

            ctx.voice_client.pause()
            await ctx.message.delete()
            return

        else:

            embed = discord.Embed(
                title='Fehler!',
                colour=discord.Colour.red(),
                description='Es spielt keine Musik!'
            )

            return await ctx.send(embed=embed)

    @commands.command()
    async def resume(self, ctx):

        if ctx.voice_client.is_paused():

            ctx.voice_client.resume()
            await ctx.message.delete()
            return

        else:

            embed = discord.Embed(
                title='Fehler!',
                colour=discord.Colour.red(),
                description='Es wurde keine Musik pausiert, darum kann ich auch nichts fortsetzen!'
            )

            return await ctx.send(embed=embed)

    @resume.before_invoke
    @play.before_invoke
    async def ensure_voice(self, ctx):
        if ctx.voice_client is None:
            if ctx.author.voice:
                try:

                    await ctx.author.voice.channel.connect()

                except commands.CommandError:
                    embed = discord.Embed(
                        title='Fehler!',
                        colour=discord.Colour.red(),
                        description='Du bist nicht mit einem Sprachkanal verbunden!'
                    )

                    await ctx.send(embed=embed)

        elif ctx.voice_client.is_playing():
            ctx.voice_client.stop()


# COG_SETUP(END)


def setup(client):
    client.add_cog(Music(client))