
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (63)
-
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
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 (11256)
-
How To Make A Music Command Discord.py
14 juin 2021, par Coder999I'm trying to make a music bot, but it just doesn't seem to work. Here's what I have so far.


import asyncio
import functools
import itertools
import math
import random
from keep_alive import keep_alive
import discord
import nacl
import youtube_dl
from async_timeout import timeout
from discord.ext import commands
import os

bot = commands.Bot(command_prefix='+')

@bot.event
async def on_ready():
 print('Logged in as:\n{0.user.name}\n{0.user.id}'.format(bot))

youtube_dl.utils.bug_reports_message = lambda: ''

ytdl_format_options = {
 'format': 'bestaudio/best',
 '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 = ""

 @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['title'] if stream else ytdl.prepare_filename(data)
 return filename

@bot.command(name='join', help='Tells the bot to join the voice channel')
async def join(ctx):
 if not ctx.message.author.voice:
 await ctx.send("{} is not connected to a voice channel".format(ctx.message.author.name))
 return
 else:
 channel = ctx.message.author.voice.channel
 await channel.connect()
 await ctx.send(f'Joined channel `{channel}`')

@bot.command(name='leave', help='To make the bot leave the voice channel')
async def leave(ctx):
 voice_client = ctx.message.guild.voice_client
 if voice_client.is_connected():
 channel = ctx.message.author.voice.channel
 await voice_client.disconnect()
 await ctx.send(f'Left channel `{channel}`')
 else:
 await ctx.send("The bot is not connected to a voice channel.")

@bot.command(name='play', help='To play song')
async def play(ctx,url):
 try :
 server = ctx.message.guild
 voice_channel = server.voice_client

 async with ctx.typing():
 filename = await YTDLSource.from_url(url, loop=bot.loop)
 voice_channel.play(discord.FFmpegPCMAudio(executable="ffmpeg.exe", source=filename))
 await ctx.send('**Now playing:** {}'.format(filename))
 except:
 await ctx.send("The bot is not connected to a voice channel.")



I have installed PyNaCl and all that stuff and my leave and join commands are working but my play command isnt. It says that it's not connected to a channel but it clearly is.




-
My code accidently deleted my 'song.mp3' file in Discord.py music bot
2 avril 2021, par AlkariaI was coding my discord bot and i was trying to make the bot not try to connect twice. Like, if it's already connected any user sends another ' !play' command, i don't want it to error. But that's not my problem. I or my code accidently deleted my 'song.mp3' file. How do i get it back. I closed the pycharm so i can't do 'CRTL + Z'.


@client.command()


async def play(ctx, url : str) :


song_there = os.path.isfile("song.mp3")
try:
 if song_there:
 os.remove("song.mp3")
except PermissionError:
 await ctx.send("Şimdi Çalan şarkının bitmesini bekleyin. Yada '!stop' komutunu kullanın.")
 return
# connects the voice channel
connected = ctx.author.voice
audio = discord.FFmpegPCMAudio("song.mp3")

voiceChannel = discord.utils.get(ctx.guild.voice_channels, name='music')
if not discord.client.VoiceClient == None: # None being the default value if the bot isnt in a channel (which is why the is_connected() is returning errors)
 await voiceChannel.connect()
 await ctx.send(f"Joined **{voiceChannel}**")
 discord.client.VoiceClient.play()
else:
 await ctx.send("I'm already connected!")



audio = discord.FFmpegPCMAudio("song.mp3")

# Dowloads the video from the link given

ydl_opts = {
 'format': 'bestaudio/best',
 'postprocessors': [{
 'key': 'FFmpegExtractAudio',
 'preferredcodec': 'mp3',
 'preferredquality': '192',
 }],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
 ydl.download([url])
for file in os.listdir("./"):
 if file.endswith(".mp3"):
 os.rename(file, "song.mp3")



-
My music doesn't play correctly and other problems - Discord.py
24 mars 2021, par DiaconoSo, I'm triying to let my bot play songs directly from the url (without downloading them like the song.mp3 method) but I'm having a hard time. The bot plays only 1 song and when I try to play another song it doesn't play it.
I'm also getting 2 errors :
video_link
is not defined andself
is not defined.
Also when I try to play live music like "lofi hip hop radio - beats to relax/study to" nothing happens.
Can you help me please ???

This is my code


import asyncio
import discord
from discord.ext import commands, tasks
import requests
import json
from random import choice
from discord.utils import get
from discord import FFmpegPCMAudio
import youtube_dl
bot = commands.Bot(command_prefix="!")



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:
 data = data['entries'][0]

 filename = data['url'] if stream else ytdl.prepare_filename(data)
 return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)


@bot.command()
async def play(ctx, url):
 voice = await ctx.author.voice.channel.connect()
 player = await YTDLSource.from_url(url, loop=client.loop)
 ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
 ydl_opts = {'format': 'bestaudio'}
 FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
 with youtube_dl.YoutubeDL(ydl_opts) as ydl:
 info = ydl.extract_info(video_link, download=False)
 URL = info['formats'][0]['url']
 voice = get(self.bot.voice_clients, guild=ctx.guild)
 voice.play(discord.FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))