
Recherche avancée
Médias (91)
-
Géodiversité
9 septembre 2011, par ,
Mis à jour : Août 2018
Langue : français
Type : Texte
-
USGS Real-time Earthquakes
8 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
-
SWFUpload Process
6 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
-
La conservation du net art au musée. Les stratégies à l’œuvre
26 mai 2011
Mis à jour : Juillet 2013
Langue : français
Type : Texte
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
-
Creativecommons informational flyer
16 mai 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (107)
-
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...) -
Participer à sa documentation
10 avril 2011La documentation est un des travaux les plus importants et les plus contraignants lors de la réalisation d’un outil technique.
Tout apport extérieur à ce sujet est primordial : la critique de l’existant ; la participation à la rédaction d’articles orientés : utilisateur (administrateur de MediaSPIP ou simplement producteur de contenu) ; développeur ; la création de screencasts d’explication ; la traduction de la documentation dans une nouvelle langue ;
Pour ce faire, vous pouvez vous inscrire sur (...) -
MediaSPIP Player : problèmes potentiels
22 février 2011, parLe lecteur ne fonctionne pas sur Internet Explorer
Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)
Sur d’autres sites (34227)
-
Discord Music Bot No Playback Issue
6 août 2021, par KusunokiI'm trying to configure a discord music bot and my code is working (Other people have tried my code and it works perfectly on their side) but the problem is whenever the bot joins the voice channel, it doesn't play any music then it will queue the video but not play it then the bot will leave the channel.


The code also works on repl.it and I've tried it several times and it seems to be working fine. I'm running Windows 10 LTSC on my PC.


I've tried reinstalling the packages, trying the node.js v14 and 15, reinstalling ffmpeg and nothing seems to be working.


Code :


module.exports = {
 name: 'play',
 category: 'music',
 description: 'Play music from discord!',
 async execute(message, args, ytdl, ytSearch) {
 const voiceChannel = message.member.voice.channel;

 if (!voiceChannel) return message.channel.send("Connect to a music channel.");
 const userPermissions = voiceChannel.permissionsFor(message.client.user);
 if (!userPermissions.has('CONNECT')) return message.channel.send("You\'re not allowed to play music.");
 if (!userPermissions.has('SPEAK')) return message.channel.send("You\'re not allowed to play music.");

 const connection = await voiceChannel.join();
 const videoFinder = async (query) => {
 const videoResult = await ytSearch(query);
 return (videoResult.videos.length > 1) ? videoResult.videos[1] : null;
 }
 const video = await videoFinder(args.join(' '));
 if (video){
 const stream = ytdl(video.url, {filter: 'audioonly'});
 connection.play(stream, {seek: 0, volume: 1})
 .on('finish', () =>{
 voiceChannel.leave();
 console.error
 });

 await message.channel.send(`Now Playing: **${video.title}**.`);
 } else {
 message.channel.send('No results found.');
 }
 }
}



-
Music queue, discord.py music bot
29 mars 2021, par Luca M. SchmidtII'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))




-
Hello ! I have a little problem with my discord.py music bot
5 mars 2021, par Luca M. Schmidti'm rather new/unexpierience with youtube-dl and python. The thing i'm triying to do is to add a queue system to my music cog. When possible it should be able to add songs and start the next song after the first one ended as well. You dont need to provide the complete code for it, tryingt to explain how it should work and giving some tipps should be enought. If more information is needed, feel free to ask. Thx for helping.


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