
Recherche avancée
Médias (1)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
Autres articles (71)
-
Modifier la date de publication
21 juin 2013, parComment changer la date de publication d’un média ?
Il faut au préalable rajouter un champ "Date de publication" dans le masque de formulaire adéquat :
Administrer > Configuration des masques de formulaires > Sélectionner "Un média"
Dans la rubrique "Champs à ajouter, cocher "Date de publication "
Cliquer en bas de la page sur Enregistrer -
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
Sur d’autres sites (5851)
-
Jupyter Notebook JSONDecodeError to open file
25 février 2021, par potterykidExpected behavior :
open a mp3 with no error


Actual behavior :
I used the script below,


from pydub
import AudioSegment


song = AudioSegment.from_mp3("audio.mp3")


and there is a JSONDecodeError


JSONDecodeError : Expecting value : line 1 column 1 (char 0)


JSONDecodeError Traceback (most recent call last)
 in <module>
 6 dst = "research.wav"
 7 
----> 8 sound = AudioSegment.from_mp3(src)
 9 sound.export(dst, format = "wav")

~/opt/anaconda3/lib/python3.8/site-packages/pydub/audio_segment.py in from_mp3(cls, file, parameters)
 736 @classmethod
 737 def from_mp3(cls, file, parameters=None):
--> 738 return cls.from_file(file, 'mp3', parameters=parameters)
 739 
 740 @classmethod

~/opt/anaconda3/lib/python3.8/site-packages/pydub/audio_segment.py in from_file(cls, file, format, codec, parameters, **kwargs)
 683 info = None
 684 else:
--> 685 info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
 686 if info:
 687 audio_streams = [x for x in info['streams']

~/opt/anaconda3/lib/python3.8/site-packages/pydub/utils.py in mediainfo_json(filepath, read_ahead_limit)
 277 stderr = stderr.decode("utf-8", 'ignore')
 278 
--> 279 info = json.loads(output)
 280 
 281 if not info:

~/opt/anaconda3/lib/python3.8/json/__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
 355 parse_int is None and parse_float is None and
 356 parse_constant is None and object_pairs_hook is None and not kw):
--> 357 return _default_decoder.decode(s)
 358 if cls is None:
 359 cls = JSONDecoder

~/opt/anaconda3/lib/python3.8/json/decoder.py in decode(self, s, _w)
 335 
 336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
 338 end = _w(s, end).end()
 339 if end != len(s):

~/opt/anaconda3/lib/python3.8/json/decoder.py in raw_decode(self, s, idx)
 353 obj, end = self.scan_once(s, idx)
 354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
 356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)```
</module>


-
Small discord bot with a set of working music commands, about 6 days ago the play function completely stopped functioning (more below)
24 février 2021, par TheColoradoKidIt is a small discord python bot for my server with various features, which had included music commands until they stopped out of the blue without showing any error for the problem.
It uses FFMpeg, and youtubeDl along with pytube to gather the song and store it locally to play it, I have pip updated all of these and they are definitely on the current versions as I have made sure of this online.
Any help or insight anyone could provide would be greatly appreciated. I'm sorry if the code is convoluted in the way it's written I'm still pretty new to coding and this is one of my first proper larger projects.


If you need any information I'm happy to give what I can to help.


Here is the code for the play command :


@client.command()
async def play(ctx, *args):
 global queu
 #global autom
 if not args:
 voice = get(client.voice_clients, guild=ctx.guild)
 if not voice.is_playing():
 server = ctx.message.guild
 voice_channel = server.voice_client
 if queu:
 async with ctx.typing():
 player = await YTDLSource.from_url(queu[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(queu[0])
 # while autom == True:
 # try:
 # a = client.get_command('auto')
 # await ctx.invoke(a)
 # except:
 # print('')
 elif not queu:
 await ctx.send("You can't play if there isn't anything in the queue\nIf auto mode was on it has now been disabled, to use it gain please add to the queue and run ``;auto on``")
 autom = False
 if args:
 global gueu
 search_keywords = ""
 print(args)
 for word in args:
 search_keywords += word
 search_keywords += '+'
 link = "https://www.youtube.com/results?search_query="
 link += search_keywords
 #print(link)
 html = urllib.request.urlopen(link)
 video_ids = re.findall(r"watch\?v=(\S{11})", html.read().decode())
 url = ("https://www.youtube.com/watch?v=" + video_ids[0])
 #print(url)
 queu.append(url)
 #print(queu)
 await ctx.send("``{}`` added to queue!\n If the song doesn't start please either let the current song end and run ``;play``/``;next`` again or run ``;next`` to play now".format(url))
 try:
 p = client.get_command('play')
 await ctx.invoke(p)
 except:
 print('failed')



-
How to get best audio quality on music bot using discord.py ?
9 mai 2021, par user28606I've built a discord music bot in discord.py but for some reason, it doesn't play music in as high quality as Fredboat or Rythm(so I don't think voice chat's bitrate is the problem). I've tried a couple of things online.


The only thing that improved quality a little bit was downloading the song before playing it. But the quality was still far from anything like Fredboat's. It's also very impractical since downloading a 1h song takes a while and is space consuming.


I'm interested in how to fix this and the explanation for why this is happening.


This is the code we're currently using for the music bot :


from discord import FFmpegPCMAudio
import discord
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from apscheduler.triggers.cron import CronTrigger
from discord.ext import commands, tasks
from youtubesearchpython import VideosSearch

class cmd_music(commands.Cog, name="music_commands"):

 def __init__(self, bot):
 self.bot = bot
 self.music_queue = []
 self.scheduler = AsyncIOScheduler()
 self.scheduler.add_job(self.check_queue, CronTrigger(second="0,5,10,15,20,25,30,35,40,45,50,55"))
 self.scheduler.start()
 
 async def play_raw(self, voice_client):
 if not self.music_queue:
 return

 YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist':'True'}
 FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
 if not voice_client.is_playing():
 with YoutubeDL(YDL_OPTIONS) as ydl:
 info = ydl.extract_info(self.music_queue.pop(0), download=False)
 URL = info['formats'][0]['url']
 voice_client.play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
 voice_client.is_playing()

 async def check_queue(self):
 if not self.bot.voice_clients: return
 
 client = self.bot.voice_clients[0]
 if not client.is_playing():
 if self.music_queue:
 await self.play_raw(client)
 
 
 @commands.command(brief="join")
 async def join(self, ctx):
 await ctx.author.voice.channel.connect()

 @commands.command(brief="leave")
 async def leave(self, ctx):
 await ctx.voice_client.disconnect()
 self.music_queue = []

 @commands.command(brief="play")
 async def play(self, ctx, *name):
 url = VideosSearch(" ".join(name[:]), 1).result().get("result")[0].get("link")
 self.music_queue.append(url)
 await ctx.send("Now playing: " + url)

 @commands.command(brief="skip")
 async def skip(self, ctx):
 await ctx.send("Skipped current song")
 ctx.voice_client.stop()
 if self.music_queue:
 await self.play_raw(ctx.voice_client)```