Recherche avancée

Médias (0)

Mot : - Tags -/api

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (80)

  • Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs

    12 avril 2011, par

    La manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
    Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (11157)

  • Anomalie #4831 (Nouveau) : URLs arbo non mise à jour au changement de rubrique

    23 juin 2021, par Julien Tessier

    Etapes pour reproduire :

    • Utiliser les URL arbos
    • Créer un article "Lorem ipsum" dans la rubrique 1
    • Publier l’article, son URL est /rubrique-1/lorem-ipsum
    • Créer un article "Lorem ipsum" dans la rubrique 2
    • Proposer l’article à la publication, son URL est /rubrique-2/lorem-ipsum
    • Déplacer l’article dans la rubrique 1
    • SPIP génère une erreur dans les logs :
      2021-06-23 11:32:54 127.0.0.1 (pid 498) :Pri:ERREUR : Erreur 1062 de mysql : Duplicate entry ’1-lorem-ipsum’ for key ’PRIMARY’
      in .../plugins-dist/urls_etendues/action/editer_url.php L155 [sql_insertq(),url_insert(),declarer_url_arbo(),_generer_url_arbo(),urls_arbo_dist(),generer_url_entite(),html_af5c93b1e9d12543df40c819344ffc73(),public_parametrer_dist(),public_produire_page_dist(),inclure_page(),evaluer_fond(),recuperer_fond(),urls_afficher_fiche_objet(),minipipe(),execute_pipeline_afficher_fiche_objet(),pipeline(),f_afficher_blocs_ecrire(),f_recuperer_fond(),minipipe(),execute_pipeline_recuperer_fond(),pipeline(),recuperer_fond(),traiter_appels_inclusions_ajax()]
      
    • Publier l’article
    • L’URL du nouvel article est inchangée donc il est inaccessible (= son URL a déjà été "prise" par un autre)

    Comportement attendu

    Au changement de rubrique, URL arbos regénère une URL unique (avec l’ID donc).

    Résolution temporaire

    J’ai réglé ça de la manière suivante, via un plugin et la pipeline post_edition :

    1. <span class="CodeRay"><span class="keyword">function</span> <span class="function">plugin_post_edition</span>(<span class="local-variable">$e</span>) {
    2.     <span class="keyword">switch</span> (objet_type(<span class="local-variable">$e</span>[<span class="string"><span class="delimiter">'</span><span class="content">args</span><span class="delimiter">'</span></span>][<span class="string"><span class="delimiter">'</span><span class="content">table</span><span class="delimiter">'</span></span>])) {
    3.         <span class="keyword">case</span> <span class="string"><span class="delimiter">'</span><span class="content">article</span><span class="delimiter">'</span></span>;
    4.             <span class="keyword">if</span> (!<span class="predefined">empty</span>(<span class="local-variable">$e</span>[<span class="string"><span class="delimiter">'</span><span class="content">data</span><span class="delimiter">'</span></span>][<span class="string"><span class="delimiter">'</span><span class="content">id_rubrique</span><span class="delimiter">'</span></span>])) {
    5.                 <span class="local-variable">$id_rubrique</span> = <span class="predefined">intval</span>(<span class="local-variable">$e</span>[<span class="string"><span class="delimiter">'</span><span class="content">data</span><span class="delimiter">'</span></span>][<span class="string"><span class="delimiter">'</span><span class="content">id_rubrique</span><span class="delimiter">'</span></span>]);
    6.                 <span class="local-variable">$id_article</span> = <span class="predefined">intval</span>(<span class="local-variable">$e</span>[<span class="string"><span class="delimiter">'</span><span class="content">args</span><span class="delimiter">'</span></span>][<span class="string"><span class="delimiter">'</span><span class="content">id_objet</span><span class="delimiter">'</span></span>]);
    7.                 <span class="keyword">if</span> (<span class="local-variable">$url</span> = sql_fetsel(<span class="string"><span class="delimiter">'</span><span class="content">url</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">spip_urls</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">type = 'article' AND id_objet = </span><span class="local-variable">$id_article</span><span class="delimiter">"</span></span>, <span class="string"><span class="delimiter">'</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">perma DESC, date DESC</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">1</span><span class="delimiter">'</span></span>)) {
    8.                     <span class="local-variable">$url</span> = <span class="local-variable">$url</span>[<span class="string"><span class="delimiter">'</span><span class="content">url</span><span class="delimiter">'</span></span>];
    9.                     <span class="keyword">if</span> (sql_countsel(<span class="string"><span class="delimiter">'</span><span class="content">spip_urls</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">url = </span><span class="delimiter">"</span></span>.sql_quote(<span class="local-variable">$url</span>).<span class="string"><span class="delimiter">"</span><span class="content"> AND type = 'article' AND id_parent = </span><span class="local-variable">$id_rubrique</span><span class="content"> AND id_objet != </span><span class="local-variable">$id_article</span><span class="delimiter">"</span></span>)) {
    10.                         sql_delete(<span class="string"><span class="delimiter">'</span><span class="content">spip_urls</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">type = 'article' AND id_objet = </span><span class="local-variable">$id_article</span><span class="content"> AND url = </span><span class="delimiter">"</span></span>.sql_quote(<span class="local-variable">$url</span>));
    11.                     }
    12.                 }
    13.             }
    14.             <span class="keyword">break</span>;
    15.         <span class="keyword">default</span>:
    16.             <span class="keyword">break</span>;
    17.     }
    18.     <span class="keyword">return</span> <span class="local-variable">$e</span>;
    19. }
    20. </span>

    Télécharger

    Ce n’est peut être pas élégant mais ça marche en attendant un fix :)

  • Command raised an exception : NameError : name 'player' is not defined

    20 mars 2023, par baartys

    I finally got myself a hosting for my project, but got into an error and I don't know how to resolve it.&#xA;I ran command !play to start streaming in vc, but I got this error :

    &#xA;

    2023-03-19 18:36:04 INFO     discord.client logging in using static token&#xA;2023-03-19 18:36:04 INFO     discord.gateway Shard ID None has connected to Gateway (Session ID: f983009c9f2881b87ee119278692efc9).&#xA;Eurobeat Radio is running!&#xA;2023-03-19 18:36:10 ERROR    discord.ext.commands.bot Ignoring exception in command play&#xA;Traceback (most recent call last):&#xA;  File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 229, in wrapped&#xA;    ret = await coro(*args, **kwargs)&#xA;  File "/home/container/radio.py", line 44, in play&#xA;    player.play(FFmpegPCMAudio(&#x27;http://stream.eurobeat.xyz&#x27;))&#xA;NameError: name &#x27;player&#x27; is not defined&#xA;The above exception was the direct cause of the following exception:&#xA;Traceback (most recent call last):&#xA;  File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1350, in invoke&#xA;    await ctx.command.invoke(ctx)&#xA;  File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1023, in invoke&#xA;    await injected(*ctx.args, **ctx.kwargs)  # type: ignore&#xA;  File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 238, in wrapped&#xA;    raise CommandInvokeError(exc) from exc&#xA;discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name &#x27;player&#x27; is not defined&#xA;

    &#xA;

    I tried running it on my pc and that was without error, but once it was on the hosting it ran in to the error up the page.

    &#xA;

    Here is the code :

    &#xA;

    import discord&#xA;import urllib.request, json &#xA;from discord import FFmpegPCMAudio&#xA;from discord.ext import commands&#xA;from discord.ext import tasks&#xA;client= commands.Bot(command_prefix="er!", intents=discord.Intents.all(), help_command=None)&#xA;&#xA;@tasks.loop(seconds=10.0)&#xA;async def my_background_task():&#xA;    """Will loop every 60 seconds and change the bots presence"""&#xA;    with urllib.request.urlopen(&#x27;https://api.laut.fm/station/eurobeat/current_song&#x27;) as url:&#xA;        data = json.load(url)&#xA;        global namestatus&#xA;        global artiststatus&#xA;        namestatus = data[&#x27;title&#x27;]&#xA;        artiststatus = data[&#x27;artist&#x27;][&#x27;name&#x27;]&#xA;    await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="Eurobeat FM"))&#xA;    await client.change_presence(activity=discord.Game(name="Para para dancing ~"))&#xA;    await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=f"{namestatus} by {artiststatus}"))&#xA;&#xA;&#xA;@client.event&#xA;async def on_ready():&#xA;    print(&#x27;Eurobeat Radio is running!&#x27;)&#xA;    await client.wait_until_ready()&#xA;    my_background_task.start()&#xA;&#xA;&#xA;@client.event&#xA;async def on_voice_state_update(member, prev, cur):&#xA;    if client.user in prev.channel.members and len([m for m in prev.channel.members if not m.bot]) == 0:&#xA;        channel = discord.utils.get(client.voice_clients, channel=prev.channel)&#xA;        await channel.disconnect()&#xA;&#xA;@client.command(aliases=[&#x27;p&#x27;, &#x27;pla&#x27;, &#x27;join&#x27;, &#x27;j&#x27;])&#xA;async def play(ctx, url: str = &#x27;http://stream.eurobeat.xyz&#x27;): &#xA;    channel = ctx.message.author.voice.channel&#xA;    global player&#xA;    try:&#xA;        player = await channel.connect()&#xA;    except:&#xA;        pass&#xA;    player.play(FFmpegPCMAudio(&#x27;http://stream.eurobeat.xyz&#x27;))&#xA;    embedVar = discord.Embed(title="Started Playing!", color=discord.Color.random())&#xA;    await ctx.send(embed=embedVar)&#xA;

    &#xA;

    Would be very grateful for your help !

    &#xA;

  • RTSP to HLS conversion with error on some devices

    2 septembre 2024, par Wallace Ketler

    I'm trying to convert, on a node server, RTSP IP camera devices to HLS to run livestreams on the web. The following code works well for some RTSP devices, but for others I encounter problems.

    &#xA;

       function startLive(rtspUrl, outputDir, id_local, id_camera) {&#xA;        return new Promise((resolve, reject) => {&#xA;            const processKey = `${id_local}_${id_camera}`;&#xA;            if (ffmpegProcesses[processKey]) {&#xA;                return reject(new Error(&#x27;Convers&#xE3;o j&#xE1; est&#xE1; em andamento para esta c&#xE2;mera&#x27;));&#xA;            }&#xA;        &#xA;            const process = ffmpeg(rtspUrl)&#xA;                .inputOptions([&#xA;                    &#x27;-rtsp_transport&#x27;, &#x27;tcp&#x27;,&#xA;                    &#x27;-fflags&#x27;, &#x27;nobuffer&#x27;,&#xA;                    &#x27;-max_delay&#x27;, &#x27;1000000&#x27;,&#xA;                    &#x27;-analyzeduration&#x27;, &#x27;1000000&#x27;,&#xA;                    &#x27;-probesize&#x27;, &#x27;1000000&#x27;,&#xA;                    &#x27;-flush_packets&#x27;, &#x27;1&#x27;,&#xA;                    &#x27;-avioflags&#x27;, &#x27;direct&#x27;&#xA;                ])&#xA;                .outputOptions([&#xA;                    &#x27;-c:v&#x27;, &#x27;libx264&#x27;,&#xA;                    &#x27;-preset&#x27;, &#x27;ultrafast&#x27;,&#xA;                    &#x27;-tune&#x27;, &#x27;zerolatency&#x27;,&#xA;                    &#x27;-c:a&#x27;, &#x27;aac&#x27;,&#xA;                    &#x27;-hls_time&#x27;, &#x27;10&#x27;,&#xA;                    &#x27;-hls_flags&#x27;, &#x27;delete_segments&#x27;,&#xA;                    &#x27;-hls_list_size&#x27;, &#x27;5&#x27;,&#xA;                    &#x27;-hls_wrap&#x27;, &#x27;5&#x27;,&#xA;                    &#x27;-strict&#x27;, &#x27;-2&#x27;&#xA;                ])&#xA;                .output(path.join(outputDir, &#x27;stream.m3u8&#x27;))&#xA;                .on(&#x27;start&#x27;, (commandLine) => {&#xA;                    console.log(&#x27;Spawned FFmpeg with command: &#x27; &#x2B; commandLine);&#xA;                })&#xA;                .on(&#x27;stderr&#x27;, (stderrLine) => {&#xA;                    console.log(&#x27;FFmpeg stderr: &#x27; &#x2B; stderrLine);&#xA;                })&#xA;                .on(&#x27;end&#x27;, () => {&#xA;                    console.log(&#x27;Convers&#xE3;o conclu&#xED;da&#x27;);&#xA;                    delete ffmpegProcesses[processKey]; &#xA;                    resolve();&#xA;                })&#xA;                .on(&#x27;error&#x27;, (err, stdout, stderr) => {&#xA;                    console.error(&#x27;Erro na convers&#xE3;o&#x27;, err);&#xA;                    console.error(&#x27;FFmpeg stdout:&#x27;, stdout);&#xA;                    console.error(&#x27;FFmpeg stderr:&#x27;, stderr);&#xA;                    delete ffmpegProcesses[processKey]; &#xA;                    reject(err);&#xA;                })&#xA;                .run();&#xA;    &#xA;            ffmpegProcesses[processKey] = process; &#xA;        });&#xA;    }&#xA;

    &#xA;

    When the conversion succeeds, it continues indefinitely with the logs :

    &#xA;

    FFmpeg stderr: frame=   61 fps= 48 q=13.0 size=N/A time=00:00:02.03 bitrate=N/A dup=60 drop=0 speed= 1.6x    &#xA;FFmpeg stderr: frame=   75 fps= 42 q=17.0 size=N/A time=00:00:02.52 bitrate=N/A dup=62 drop=0 speed=1.41x    &#xA;FFmpeg stderr: frame=   91 fps= 39 q=16.0 size=N/A time=00:00:03.04 bitrate=N/A dup=65 drop=0 speed=1.31x    &#xA;FFmpeg stderr: frame=  108 fps= 38 q=15.0 size=N/A time=00:00:03.60 bitrate=N/A dup=68 drop=0 speed=1.27x    &#xA;FFmpeg stderr: frame=  121 fps= 36 q=24.0 size=N/A time=00:00:04.03 bitrate=N/A dup=70 drop=0 speed=1.21x    &#xA;FFmpeg stderr: frame=  138 fps= 36 q=16.0 size=N/A time=00:00:04.60 bitrate=N/A dup=73 drop=0 speed= 1.2x    &#xA;FFmpeg stderr: frame=  152 fps= 35 q=17.0 size=N/A time=00:00:05.08 bitrate=N/A dup=75 drop=0 speed=1.17x    &#xA;FFmpeg stderr: frame=  168 fps= 35 q=16.0 size=N/A time=00:00:05.60 bitrate=N/A dup=78 drop=0 speed=1.15x    &#xA;FFmpeg stderr: frame=  183 fps= 34 q=21.0 size=N/A time=00:00:06.11 bitrate=N/A dup=80 drop=0 speed=1.13x    &#xA;FFmpeg stderr: frame=  198 fps= 34 q=16.0 size=N/A time=00:00:06.60 bitrate=N/A dup=83 drop=0 speed=1.12x    &#xA;FFmpeg stderr: frame=  215 fps= 33 q=16.0 size=N/A time=00:00:07.16 bitrate=N/A dup=86 drop=0 speed=1.11x    &#xA;FFmpeg stderr: frame=  230 fps= 33 q=16.0 size=N/A time=00:00:07.66 bitrate=N/A dup=88 drop=0 speed= 1.1x    &#xA;FFmpeg stderr: frame=  246 fps= 33 q=19.0 size=N/A time=00:00:08.20 bitrate=N/A dup=91 drop=0 speed= 1.1x    &#xA;

    &#xA;

    And with the segments saved in the folder configured as output. But for certain devices, after creating the stream.m3u8 file and saving the first segment, the conversion is considered finished and falls into .on(&#x27;end&#x27;) . The error log is as follows :

    &#xA;

    FFmpeg stderr: frame=    0 fps=0.0 q=0.0 size=N/A time=00:00:01.12 bitrate=N/A speed=2.08x    &#xA;FFmpeg stderr: [hls @ 0x55e00dfc4380] Opening &#x27;my_path/stream0.ts&#x27; for writing&#xA;FFmpeg stderr: [hls @ 0x55e00dfc4380] Opening &#x27;my_path/stream.m3u8.tmp&#x27; for writing&#xA;FFmpeg stderr: frame=    0 fps=0.0 q=0.0 Lsize=N/A time=00:00:01.37 bitrate=N/A speed= 2.5x    &#xA;FFmpeg stderr: video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;FFmpeg stderr: [aac @ 0x55e00dfff840] Qavg: 65536.000&#xA;FFmpeg stderr: &#xA;Convers&#xE3;o conclu&#xED;da&#xA;

    &#xA;

    The muxing overhead: unknown only appears when the error occurs and the conversion is complete.

    &#xA;

    I've already tried changing the video and audio encoders, as well as the various input and output parameters of the conversion. I also tried updating ffmpeg (it's already on the latest version, using fluent-ffmpeg, "fluent-ffmpeg": "^2.1.3",)

    &#xA;

    I would like to understand why this happens on some devices and how to fix it. Thanks.

    &#xA;