Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (100)

  • MediaSPIP en mode privé (Intranet)

    17 septembre 2013, par

    À partir de la version 0.3, un canal de MediaSPIP peut devenir privé, bloqué à toute personne non identifiée grâce au plugin "Intranet/extranet".
    Le plugin Intranet/extranet, lorsqu’il est activé, permet de bloquer l’accès au canal à tout visiteur non identifié, l’empêchant d’accéder au contenu en le redirigeant systématiquement vers le formulaire d’identification.
    Ce système peut être particulièrement utile pour certaines utilisations comme : Atelier de travail avec des enfants dont le contenu ne doit pas (...)

  • Formulaire personnalisable

    21 juin 2013, par

    Cette page présente les champs disponibles dans le formulaire de publication d’un média et il indique les différents champs qu’on peut ajouter. Formulaire de création d’un Media
    Dans le cas d’un document de type média, les champs proposés par défaut sont : Texte Activer/Désactiver le forum ( on peut désactiver l’invite au commentaire pour chaque article ) Licence Ajout/suppression d’auteurs Tags
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire. (...)

  • Soumettre bugs et patchs

    10 avril 2011

    Un logiciel n’est malheureusement jamais parfait...
    Si vous pensez avoir mis la main sur un bug, reportez le dans notre système de tickets en prenant bien soin de nous remonter certaines informations pertinentes : le type de navigateur et sa version exacte avec lequel vous avez l’anomalie ; une explication la plus précise possible du problème rencontré ; si possibles les étapes pour reproduire le problème ; un lien vers le site / la page en question ;
    Si vous pensez avoir résolu vous même le bug (...)

Sur d’autres sites (12228)

  • Discord.py - IndexError : list index out of range

    23 novembre 2020, par itsnexn

    Hello i start to learn python and i make bot for practie but i got this error

    


    Ignoring exception in command play:
Traceback (most recent call last):
  File "C:\Users\sinad\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "d:\Projects\discord\musicbot.py", line 147, in play
    player = await YTDLSource.from_url(queue[0], loop=client.loop)
IndexError: list index out of range


    


    and i use ffmpeg to convert audio
and i write this bot in youtube and discord.py documentation
itswork well without music commend but if i use that i got error and isnt working idk why ...
this is my first python project so this is happening and its normal
and this is my code :

    


    import discord
from discord.ext import commands, tasks
from discord.voice_client import VoiceClient

import youtube_dl

from random import choice

from youtube_dl.utils import lowercase_escape

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)


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

status = ['']
queue = []

#print on terminal when is bot ready
@client.event
async def on_ready():
    change_status.start()
    print('Bot is online!')

#Welcome message
@client.event
async def on_member_join(member):
    channel = discord.utils.get(member.guild.channels, name='general')
    await channel.send(f'Welcome {member.mention}!  Ready to jam out? See `.help` command for details!')

#ping
@client.command(name='ping', help='This command returns the latency')
async def ping(ctx):
    await ctx.send(f'**Ping!** Latency: {round(client.latency * 1000)}ms')

@client.event
async def on_message(message):

    if message.content in ['hello', 'Hello']:
        await message.channel.send("**wasaaaaaap**")

    await client.process_commands(message)


#join
@client.command(name='join', help='This command makes the bot join the voice channel')
async def join(ctx):
    if not ctx.message.author.voice:
        await ctx.send("You are not connected to a voice channel")
        return

    else:
        channel = ctx.message.author.voice.channel

    await channel.connect()

#queue
@client.command(name='queue', help='This command adds a song to the queue')
async def queue_(ctx, url):
    global queue

    queue.append(url)
    await ctx.send(f'`{url}` added to queue!')

#remove
@client.command(name='remove', help='This command removes an item from the list')
async def remove(ctx, number):
    global queue

    try:
        del(queue[int(number)])
        await ctx.send(f'Your queue is now `{queue}!`')

    except:
        await ctx.send('Your queue is either **empty** or the index is **out of range**')

#play
@client.command(name='play', help='This command plays songs')
async def play(ctx):
    global queue

    server = ctx.message.guild
    voice_channel = server.voice_client

    async with ctx.typing():
        player = await YTDLSource.from_url(queue[0], loop=client.loop)
        voice_channel.play(player, after=lambda e: print('Player error: %s' % e) if e else None)

    await ctx.send('**Now playing:** {}'.format(player.title))
    del(queue[0])

#pause
@client.command(name='pause', help='This command pauses the song')
async def pause(ctx):
    server = ctx.message.guild
    voice_channel = server.voice_client

    voice_channel.pause()

#resune
@client.command(name='resume', help='This command resumes the song!')
async def resume(ctx):
    server = ctx.message.guild
    voice_channel = server.voice_client

    voice_channel.resume()

#viow
@client.command(name='view', help='This command shows the queue')
async def view(ctx):
    await ctx.send(f'Your queue is now `{queue}!`')

#leave
@client.command(name='leave', help='This command stops makes the bot leave the voice channel')
async def leave(ctx):
    voice_client = ctx.message.guild.voice_client
    await voice_client.disconnect()

#stop
@client.command(name='stop', help='This command stops the song!')
async def stop(ctx):
    server = ctx.message.guild
    voice_channel = server.voice_client

    voice_channel.stop()

@tasks.loop(seconds=20)
async def change_status():
    await client.change_presence(activity=discord.Game(choice(status)))

client.run("my_secret")


    


  • Python code to concat images and ts files using ffmpeg

    10 décembre 2019, par srt243

    I have a folder with multiple ts files in it and I want to join the files by inserting an image for n number of duration between videos. Below is the list with the duration for which an image needs to be inserted for.

    ['00:00:06:17', '00:00:00:16', '00:00:01:05', '00:00:00:31', '00:00:01:01']
    For example, if the folder has 5 ts files (this number might change so the folder needs to be iterable) then,

    video1 + image for 00:00:06:17 + video2 + image for 00:00:00:16 + video 3, etc...

    Any pointers will be much appreciated.

    UPDATE :

    for i in new_ts3:
       for m in filename[:-1]:
           p1 = subprocess.Popen (['ffmpeg', '-loop', '1', '-i', sys.argv[2], '-c:v', 'libx264', '-profile:v', 'high', '-t', i, '-pix_fmt', 'yuvj420p', '-vf', 'scale=1280:720', '-f', 'mpegts', '{}{}_.ts'.format((os.path.splitext(sys.argv[1]) [0]), m)], stdout=subprocess.PIPE)
           out1 = p1.communicate()
       break

    where new_ts3 is ['00:00:06:17', '00:00:00:16', '00:00:01:05', '00:00:00:31', '00:00:01:01'] and

    filename is ['file1', 'file2', 'file3', 'file4', 'file5', 'file6']

    With the above, I am getting 5 files with different filenames but each file is of duration 00:00:06:17

  • Last subprocess call not working in concatenation code with FFMPEG. How should I go about fixing this ?

    28 novembre 2019, par S1mple
    clips = []

    #generates a list of mp4 files in a folder
    def clipFinder(CurrentDir, fileType):
       clips.clear()
       for r,d,f in os.walk(CurrentDir):
           for file in f:
               if fileType in file:
                   clips.append(r+file)
       random.shuffle(clips)

    #removes all files that have the string 'vod' in them as they cause problems during concatenation
    def removeVods(r):
       for f in clips:
           if 'vod' in clips:
               os.remove(r+f)

    #generates a string using the clips list to insert into the ffmpeg command
    def clipString():
       string = 'intermediate'
       clipList = []
       clipNum = 1
       for f in clips:
           clipList.append(string+str(clipNum)+'.ts'+'|')
           clipNum+=1
       string1 = ''.join(clipList)
       string2 = string1[0:len(string1)-1]
       return string2

    #concatenates the mp4 files in the clipString
    def concatFiles():
       clipFinder('***', '.mp4')
       removeVods('***')
       i = 0
       intermediates = []
       for f in clips:
           subprocess.call(['***', '-i', clips[i], '-c', 'copy', '-bsf:v', 'h264_mp4toannexb', '-f', 'mpegts', 'intermediate'+ str(i+1) +'.ts'])
           i += 1
       clipsLength = len(clips)
       subprocess.call['***', '-i', '"concat:' + clipString() + '"', '-c', 'copy', '-bsf:a
       aac_adtstoasc', 'output.mp4']

    I am trying to make a clip concatenator, but the last subprocess call won’t run and gives me no error. When I run the script the first FFmpeg call works fine and gives me my intermediate mp4 files, however, the second command, which works when I run it in terminal, does not work when I run it from python using subprocess.call.

    Problematic code :

    subprocess.call(['***', '-i', '"concat:' + clipString() + '"', '-c', 'copy', '-bsf:a aac_adtstoasc', 'output.mp4'])

    all places with * were paths such as : /davidscomputer/bin/ffmpeg/