Recherche avancée

Médias (1)

Mot : - Tags -/lev manovitch

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)

  • trying to play audio from youtube with ffmpeg on discord.py rewrite

    13 septembre 2021, par Bobby Cook

    im trying to use a discord bot that plays music, but im getting errors when i run this code and python crashes, and i cant quite figure out whats wrong, except for that its around the @client.command(pass_context=True) async def play(self, ctx, *, url): print(url) server = ctx.message.guild voice_channel = server.voice_client
block. the i apologize for wasting all your time, im really bad at this, and i didnt even write most of this.

    


    import random
import youtube_dl
from discord.ext import commands
from discord.ext import tasks

client = commands.Bot(command_prefix = 'f!')

@client.command()
async def join(ctx):
    channel = ctx.message.author.voice.channel
    await channel.connect()

@client.command()
async def leave(ctx):
    await ctx.voice_client.disconnect()

youtube_dl.utils.bug_reports_message = lambda: ''


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)

        async with ctx.typing():
            player = await YTDLSource.from_url(url, loop=self.bot.loop)
            ctx.voice_channel.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
        await ctx.send('Now playing: {}'.format(player.title))

@client.command(pass_context=True)
   async def play(self, ctx, *, url):
       print(url)
       server = ctx.message.guild
       voice_channel = server.voice_client


    


  • How do I make my discord bot play music by using youtubedl's search function instead of url ? (Python)

    28 septembre 2021, par PypypieYum

    I want it to search for the video and play it, how can i change the following code to achieve that ? Every time I use the ytsearch function in ytdl, I notice that it only searches for the first word of the title and download it, however, it causes error later on and do nothing.

    


    @commands.command()
    async def play(self, ctx, url):
        if ctx.author.voice is None:
            await ctx.send("You are not in a voice channel!")
        voice_channel = ctx.author.voice.channel
        if ctx.voice_client is None:
            await voice_channel.connect()
        else:
            await ctx.voice_client.move_to(voice_channel)

        ctx.voice_client.stop()
        FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
        YDL_OPTIONS = {'format':"bestaudio", 'default_search':"ytsearch"}
        vc = ctx.voice_client

        with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:
            info = ydl.extract_info(url, download=False)
            if 'entries' in info:
              url2 = info["entries"][0]["formats"][0]
            elif 'formats' in info:
              url2 = info["formats"][0]['url']
            source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)
            vc.play(source)


    


    And this is the error message :

    


    Ignoring exception in command play:
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/HandmadeLivelyLines/music.py", line 44, in play
    source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 387, in from_probe
    return cls(source, bitrate=bitrate, codec=codec, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 324, in __init__
    super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 138, in __init__
    self._process = self._spawn_process(args, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 144, in _spawn_process
    process = subprocess.Popen(args, creationflags=CREATE_NO_WINDOW, **subprocess_kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1639, in _execute_child
    self.pid = _posixsubprocess.fork_exec(
TypeError: expected str, bytes or os.PathLike object, not dict

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

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/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: TypeError: expected str, bytes or os.PathLike object, not dict


    


    Thanks.

    


  • Discord.py music bot doesn't play next song in queue

    10 mai 2019, par Lewis H

    This is my code for the bot I’m trying to create, it plays the music fine.

    ytdl_options = {
       'format': 'bestaudio/best',
       'restrictfilenames': True,
       'noplaylist': True,
       'nocheckcertificate': True,
       'quiet':True,
       'ignoreerrors': False,
       'logtostderr': False,
       'no_warnings': True,
       'default_search': 'auto',
       'source_address': '0.0.0.0' # using ipv4 since ipv6 addresses causes issues sometimes
       }


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



    @bot.command()
    async def play(ctx, url:str = None):
       queue = {}

       channel = ctx.author.voice.channel    
       if ctx.voice_client is not None:  
           await ctx.voice_client.move_to(channel)
       elif ctx.author.voice and ctx.author.voice.channel:      
           await channel.connect()

       if not url:
           await ctx.send("Try adding a URL. e.g. !play https://youtube.com/watch?v=XXXXXXXXX")

       if ctx.voice_client is not None:
           vc = ctx.voice_client #vc = voice client, retrieving it
           ytdl = youtube_dl.YoutubeDL(ytdl_options)


           loop = asyncio.get_event_loop()
           data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url))

           if 'entries' in data:
               data = data['entries'][0]
           svr_id = ctx.guild.id
           if svr_id in queue:
               queue[svr_id].append(data)

           else:
               queue[svr_id] = [data]
           await ctx.send(data.get('title') + " added to queue")

           source = ytdl.prepare_filename(queue[svr_id][0])
           def pop_queue():
               if queue[svr_id] != []:
                   queue[svr_id].pop(0)
                   data = queue[svr_id][0]
               else:
                   vc.stop()

           if not vc.is_playing():
               vc.play(discord.FFmpegPCMAudio(source, **ffmpeg_options), after=lambda: pop_queue())

    The next song downloads and queues it fine, but once the first song finishes, it doesn’t play the next one. I can’t figure out how to make it play after the first song has commenced. I have the after= set to remove the top item of the queue, but how do I get it to play again ? Thanks