Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (71)

  • Modifier la date de publication

    21 juin 2013, par

    Comment 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, par

    Comme 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, par

    This page lists some websites based on MediaSPIP.

Sur d’autres sites (5851)

  • Jupyter Notebook JSONDecodeError to open file

    25 février 2021, par potterykid

    Expected 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)&#xA; in <module>&#xA;   6 dst = "research.wav"&#xA;   7 &#xA;----> 8 sound = AudioSegment.from_mp3(src)&#xA;   9 sound.export(dst, format = "wav")&#xA;&#xA;~/opt/anaconda3/lib/python3.8/site-packages/pydub/audio_segment.py in from_mp3(cls, file, parameters)&#xA; 736     @classmethod&#xA; 737     def from_mp3(cls, file, parameters=None):&#xA;--> 738         return cls.from_file(file, &#x27;mp3&#x27;, parameters=parameters)&#xA; 739 &#xA; 740     @classmethod&#xA;&#xA;~/opt/anaconda3/lib/python3.8/site-packages/pydub/audio_segment.py in from_file(cls, file, format, codec, parameters, **kwargs)&#xA; 683             info = None&#xA; 684         else:&#xA;--> 685             info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)&#xA; 686         if info:&#xA; 687             audio_streams = [x for x in info[&#x27;streams&#x27;]&#xA;&#xA;~/opt/anaconda3/lib/python3.8/site-packages/pydub/utils.py in mediainfo_json(filepath, read_ahead_limit)&#xA; 277     stderr = stderr.decode("utf-8", &#x27;ignore&#x27;)&#xA; 278 &#xA;--> 279     info = json.loads(output)&#xA; 280 &#xA; 281     if not info:&#xA;&#xA;~/opt/anaconda3/lib/python3.8/json/__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)&#xA; 355             parse_int is None and parse_float is None and&#xA; 356             parse_constant is None and object_pairs_hook is None and not kw):&#xA;--> 357         return _default_decoder.decode(s)&#xA; 358     if cls is None:&#xA; 359         cls = JSONDecoder&#xA;&#xA;~/opt/anaconda3/lib/python3.8/json/decoder.py in decode(self, s, _w)&#xA; 335 &#xA; 336         """&#xA;--> 337         obj, end = self.raw_decode(s, idx=_w(s, 0).end())&#xA; 338         end = _w(s, end).end()&#xA; 339         if end != len(s):&#xA;&#xA;~/opt/anaconda3/lib/python3.8/json/decoder.py in raw_decode(self, s, idx)&#xA; 353             obj, end = self.scan_once(s, idx)&#xA; 354         except StopIteration as err:&#xA;--> 355             raise JSONDecodeError("Expecting value", s, err.value) from None&#xA; 356         return obj, end&#xA;&#xA;JSONDecodeError: Expecting value: line 1 column 1 (char 0)```&#xA;</module>

    &#xA;

  • 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 TheColoradoKid

    It 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.&#xA;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.&#xA;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.

    &#xA;

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

    &#xA;

    Here is the code for the play command :

    &#xA;

    @client.command()&#xA;async def play(ctx, *args):&#xA;    global queu&#xA;    #global autom&#xA;    if not args:&#xA;        voice = get(client.voice_clients, guild=ctx.guild)&#xA;        if not voice.is_playing():&#xA;            server = ctx.message.guild&#xA;            voice_channel = server.voice_client&#xA;            if queu:&#xA;                async with ctx.typing():&#xA;                    player = await YTDLSource.from_url(queu[0], loop=client.loop)&#xA;                    voice_channel.play(player, after=lambda e: print(&#x27;Player error: %s&#x27; % e) if e else None)&#xA;&#xA;                await ctx.send(&#x27;**Now playing:** {}&#x27;.format(player.title))&#xA;                del(queu[0])&#xA;                # while autom == True:&#xA;                #     try:&#xA;                #         a = client.get_command(&#x27;auto&#x27;)&#xA;                #         await ctx.invoke(a)&#xA;                #     except:&#xA;                #         print(&#x27;&#x27;)&#xA;            elif not queu:&#xA;                await ctx.send("You can&#x27;t play if there isn&#x27;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``")&#xA;                autom = False&#xA;    if args:&#xA;        global gueu&#xA;        search_keywords = ""&#xA;        print(args)&#xA;        for word in args:&#xA;            search_keywords &#x2B;= word&#xA;            search_keywords &#x2B;= &#x27;&#x2B;&#x27;&#xA;        link = "https://www.youtube.com/results?search_query="&#xA;        link &#x2B;= search_keywords&#xA;        #print(link)&#xA;        html = urllib.request.urlopen(link)&#xA;        video_ids = re.findall(r"watch\?v=(\S{11})", html.read().decode())&#xA;        url = ("https://www.youtube.com/watch?v=" &#x2B; video_ids[0])&#xA;        #print(url)&#xA;        queu.append(url)&#xA;        #print(queu)&#xA;        await ctx.send("``{}`` added to queue!\n If the song doesn&#x27;t start please either let the current song end and run ``;play``/``;next`` again or run ``;next`` to play now".format(url))&#xA;        try:&#xA;            p = client.get_command(&#x27;play&#x27;)&#xA;            await ctx.invoke(p)&#xA;        except:&#xA;            print(&#x27;failed&#x27;)&#xA;

    &#xA;

  • How to get best audio quality on music bot using discord.py ?

    9 mai 2021, par user28606

    I'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.

    &#xA;

    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.

    &#xA;

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

    &#xA;

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

    &#xA;

    from discord import FFmpegPCMAudio&#xA;import discord&#xA;from apscheduler.schedulers.asyncio import AsyncIOScheduler&#xA;from apscheduler.triggers.cron import CronTrigger&#xA;from discord.ext import commands, tasks&#xA;from youtubesearchpython import VideosSearch&#xA;&#xA;class cmd_music(commands.Cog, name="music_commands"):&#xA;&#xA;    def __init__(self, bot):&#xA;        self.bot = bot&#xA;        self.music_queue = []&#xA;        self.scheduler = AsyncIOScheduler()&#xA;        self.scheduler.add_job(self.check_queue, CronTrigger(second="0,5,10,15,20,25,30,35,40,45,50,55"))&#xA;        self.scheduler.start()&#xA;    &#xA;    async def play_raw(self, voice_client):&#xA;        if not self.music_queue:&#xA;            return&#xA;&#xA;        YDL_OPTIONS = {&#x27;format&#x27;: &#x27;bestaudio&#x27;, &#x27;noplaylist&#x27;:&#x27;True&#x27;}&#xA;        FFMPEG_OPTIONS = {&#x27;before_options&#x27;: &#x27;-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5&#x27;, &#x27;options&#x27;: &#x27;-vn&#x27;}&#xA;        if not voice_client.is_playing():&#xA;            with YoutubeDL(YDL_OPTIONS) as ydl:&#xA;                info = ydl.extract_info(self.music_queue.pop(0), download=False)&#xA;            URL = info[&#x27;formats&#x27;][0][&#x27;url&#x27;]&#xA;            voice_client.play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))&#xA;            voice_client.is_playing()&#xA;&#xA;    async def check_queue(self):&#xA;        if not self.bot.voice_clients: return&#xA;        &#xA;        client = self.bot.voice_clients[0]&#xA;        if not client.is_playing():&#xA;            if self.music_queue:&#xA;                await self.play_raw(client)&#xA;           &#xA;        &#xA;    @commands.command(brief="join")&#xA;    async def join(self, ctx):&#xA;        await ctx.author.voice.channel.connect()&#xA;&#xA;    @commands.command(brief="leave")&#xA;    async def leave(self, ctx):&#xA;        await ctx.voice_client.disconnect()&#xA;        self.music_queue = []&#xA;&#xA;    @commands.command(brief="play")&#xA;    async def play(self, ctx, *name):&#xA;        url = VideosSearch(" ".join(name[:]), 1).result().get("result")[0].get("link")&#xA;        self.music_queue.append(url)&#xA;        await ctx.send("Now playing: " &#x2B; url)&#xA;&#xA;    @commands.command(brief="skip")&#xA;    async def skip(self, ctx):&#xA;        await ctx.send("Skipped current song")&#xA;        ctx.voice_client.stop()&#xA;        if self.music_queue:&#xA;            await self.play_raw(ctx.voice_client)``` &#xA;

    &#xA;