
Recherche avancée
Médias (1)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
Autres articles (32)
-
Submit enhancements and plugins
13 avril 2011If you have developed a new extension to add one or more useful features to MediaSPIP, let us know and its integration into the core MedisSPIP functionality will be considered.
You can use the development discussion list to request for help with creating a plugin. As MediaSPIP is based on SPIP - or you can use the SPIP discussion list SPIP-Zone. -
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" (...) -
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 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 (...)
Sur d’autres sites (4243)
-
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")



-
Find the files that have been modified in last 24 Hours only once(skip if its modified more than once) [duplicate]
4 janvier 2020, par Vijay ChandraThis question already has an answer here :
Im using this command to get all modified files in the last 24 hours in ubuntu,
find -type f -name "*.mp4" -mtime -1 -printf "%f\n"
How can i modify this to detect same file only once which means if same file is modified more than 1 time in the last 24 hours,It shouldnt consider this file,It should skip the file,Is there anyway to do this ?
I need this to create a watermarking script which will find the latest files within 24hours and save the list to a txt file and with the help of this text file,I use ffmpeg to watermark the videos and move them to original location.If i do this,the find command is considering the new updated video as modified file and adding watermark again and again,The process isnt getting stopped,Someone please help to fix this.My code is attached below :
#!/bin/bash find -type f -name "*.mp4" -mtime -1 -printf "%f\n" >> /home/domain.com/public_html/admin_panel/public_html/uploads/mp4/temp/file.txt filename='/home/domain.com/public_html/admin_panel/public_html/uploads/mp4/temp/file.txt' all_lines=`cat $filename` for item in $all_lines; do cp $item /home/domain.com/public_html/admin_panel/public_html/uploads/mp4/temp ffmpeg -i $item -i watermark.png -filter_complex "[1][0]scale2ref=w='iw*30/100':h='ow/mdar'[wm][vid];[vid][wm]overlay=(main_w-overlay_w):(main_h-overlay_h)"
-y /home/domain.com/public_html/admin_panel/public_html/uploads/mp4/temp/$item
done -
Anyway to get current playtime of a song ?
2 décembre 2019, par Blue LightningSo this is the basic voice that I’m currently using to play music through my bot. I’m streaming the audio (using the stream async function) opposed to downloading it local. Anyway I can get the current playtime of the song that is being played ?
So whenever someone plays a song, they can, whenever they want, see how much of the song they played through already.
import asyncio
import discord
import youtube_dl
from discord.ext import commands
# Suppress noise about console usage from errors
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'
}
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)
class Music(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def join(self, ctx, *, channel: discord.VoiceChannel):
"""Joins a voice channel"""
if ctx.voice_client is not None:
return await ctx.voice_client.move_to(channel)
await channel.connect()
@commands.command()
async def stream(self, ctx, *, url):
"""Streams from a url (same as yt, but doesn't predownload)"""
async with ctx.typing():
player = await YTDLSource.from_url(url, loop=self.bot.loop, stream=True)
ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
await ctx.send('Now playing: {}'.format(player.title))
@commands.command()
async def volume(self, ctx, volume: int):
"""Changes the player's volume"""
if ctx.voice_client is None:
return await ctx.send("Not connected to a voice channel.")
ctx.voice_client.source.volume = volume / 100
await ctx.send("Changed volume to {}%".format(volume))
@commands.command()
async def stop(self, ctx):
"""Stops and disconnects the bot from voice"""
await ctx.voice_client.disconnect()
@play.before_invoke
@yt.before_invoke
@stream.before_invoke
async def ensure_voice(self, ctx):
if ctx.voice_client is None:
if ctx.author.voice:
await ctx.author.voice.channel.connect()
else:
await ctx.send("You are not connected to a voice channel.")
raise commands.CommandError("Author not connected to a voice channel.")
elif ctx.voice_client.is_playing():
ctx.voice_client.stop()
bot = commands.Bot(command_prefix=commands.when_mentioned_or("!"),
description='Relatively simple music bot example')
@bot.event
async def on_ready():
print('Logged in as {0} ({0.id})'.format(bot.user))
print('------')
bot.add_cog(Music(bot))
bot.run('token')