
Recherche avancée
Autres articles (30)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (5412)
-
Anomalie #2447 (Fermé) : Surlignage dans les page recherche
9 décembre 2011, par cedric -voir aussi #2025 et #1696 Honnêtement, ce script de surlignage par referer est un peu buggué et n’a jamais été parfaitement fini (on surligne pas sur la page de recherche, mais sur la suivante qui a pour referer la page de recherche). Il est désactivé par défaut en SPIP3 qui se fonde uniquement sur le (...)
-
Anomalie #1876 : Non prise en compte des guillemets dans le surlignage
14 juin 2011, par cedric -voir aussi #2025
-
Discord.py - IndexError : list index out of range
23 novembre 2020, par itsnexnHello 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")