Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

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

Autres articles (48)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

Sur d’autres sites (8834)

  • How to make your plugin multilingual – Introducing the Piwik Platform

    29 octobre 2014, par Thomas Steur — Development

    This is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was Generating test data – Introducing the Piwik Platform). This time you’ll learn how to equip your plugin with translations. Users of your plugin will be very thankful that they can use and translate the plugin in their language !

    Getting started

    In this post, we assume that you have already set up your development environment and created a plugin. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik and other Guides that help you to develop a plugin.

    Managing translations

    Piwik is available in over 50 languages and comes with many translations. The core itself provides some basic translations for words like “Visitor” and “Help”. They are stored in the directory /lang. In addition, each plugin can provide its own translations for wordings that are used in this plugin. They are located in /plugins/*/lang. In those directories you’ll find one JSON file for each language. Each language file consists in turn of tokens that belong to a group.

    {
       "MyPlugin":{
           "BlogPost": "Blog post",
           "MyToken": "My translation",
           "InteractionRate": "Interaction Rate"
       }
    }

    A group usually represents the name of a plugin, in this case “MyPlugin”. Within this group, all the tokens are listed on the left side and the related translations on the right side.

    Building a translation key

    As you will later see to actually translate a word or a sentence you’ll need to know the corresponding translation key. This key is built by combining a group and a token separated by an underscore. You can for instance use the key MyPlugin_BlogPost to get a translation of “Blog post”. Defining a new key is as easy as adding a new entry to the “MyPlugin” group.

    Providing default translations

    If a translation cannot be found then the English translation will be used as a default. Therefore, you should always provide a default translation in English for all keys in the file en.json (ie, /plugins/MyPlugin/lang/en.json).

    Adding translations for other languages

    This is as easy as creating new files in the lang subdirectory of your plugin. The filename consists of a 2 letter ISO 639-1 language code completed by the extension .json. This means German translations go into a file named de.json, French ones into a file named fr.json. To see a list of languages you can use have a look at the /lang directory.

    Reusing translations

    As mentioned Piwik comes with quite a lot of translations. You can and should reuse them but you are supposed to be aware that a translation key might be removed or renamed in the future. It is also possible that a translation key was added in a recent version and therefore is not available in older versions of Piwik. We do not currently announce any of such changes. Still, 99% of the translation keys do not change and it is therefore usually a good idea to reuse existing translations. Especially when you or your company would otherwise not be able to provide them. To find any existing translation keys go to Settings => Translation search in your Piwik installation. The menu item will only appear if the development mode is enabled.

    Translations in PHP

    Use the Piwik::translate() function to translate any text in PHP. Simply pass any existing translation key and you will get the translated text in the language of the current user in return. The English translation will be returned in case none for the current language exists.

    $translatedText = Piwik::translate('MyPlugin_BlogPost');

    Translations in Twig Templates

    To translate text in Twig templates, use the translate filter.

    {{ 'MyPlugin_BlogPost'|translate }}

    Contributing translations to Piwik

    Did you know you can contribute translations to Piwik ? In case you want to improve an existing translation, translate a missing one or add a new language go to Piwik Translations and sign up for an account. You won’t need any knowledge in development to do this.

    Advanced features

    Of course there are more useful things you can do with translations. For instance you can use placeholders like %s in your translations and you can use translations in JavaScript as well. In case you want to know more about those topics check out our Internationalization guide. Currently, this guide only covers translations but we will cover more topics like formatting numbers and handling currencies in the future.

    Congratulations, you have learnt how to make your plugin multilingual !

    If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us.

  • ffmpeg issue with Jupyter notebook

    16 novembre 2022, par Nanda

    I am trying to extract frames from a video file using ffmpeg in Python. I installed ffmpeg using Homebrew and ffmpeg-python on the Anaconda-Navigator. Yet when I call ffmpeg on Jupyter notebook as follows

    


    !ffmpeg -i "$file" "$rootdir"/"$folder_name"/frame%04d.png


    


    I get an error saying

    


    zsh:1: command not found: ffmpeg


    


    I clearly see ffmpeg in my usr/local/bin. Can someone please assist me in sorting this ? I am able to use ffmpeg in Google Colab, though.

    


  • Using ffmpeg to convert voice recording captured by HTML5

    8 juillet 2014, par user3789242

    I’m building an HTML5 voice recording software with visualizer.I want the user when recording the voice, and after uploading the file as wave in a blob (server-side), the user should be able to select the audio format of that file using ffmpeg. what I Have achieved so far is uploading the file as wave.what I still want to do is :

    • On the server
    • side pick your preferable web programming framework
    • The web programming framework accepts the upload and stores the file on the server
    • The web programming framework runs a ffmpeg (command line) which processes the file
    • The user can download the processed file

    here is my code so far :

    // variables
    var leftchannel = [];
    var rightchannel = [];
    var recorder = null;
    var recording = false;
    var recordingLength = 0;
    var volume = null;
    var audioInput = null;
    var sampleRate = 44100;
    var audioContext = null;
    var context = null;
    var outputString;



    if (!navigator.getUserMedia)
       navigator.getUserMedia = navigator.getUserMedia ||
       navigator.webkitGetUserMedia ||
       navigator.mozGetUserMedia ||
       navigator.msGetUserMedia;

    if (navigator.getUserMedia) {
       navigator.getUserMedia({
           audio: true
       }, success, function (e) {
           alert('Error capturing audio.');
       });
    } else alert('getUserMedia not supported in this browser.');



    function getVal(value) {

       // if R is pressed, we start recording
       if (value == "record") {
           recording = true;
           // reset the buffers for the new recording
           leftchannel.length = rightchannel.length = 0;
           recordingLength = 0;
           document.getElementById('output').innerHTML = "Recording now...";

           // if S is pressed, we stop the recording and package the WAV file
       } else if (value == "stop") {

           // we stop recording
           recording = false;
           document.getElementById('output').innerHTML = "Building wav file...";

           // we flat the left and right channels down
           var leftBuffer = mergeBuffers(leftchannel, recordingLength);
           var rightBuffer = mergeBuffers(rightchannel, recordingLength);
           // we interleave both channels together
           var interleaved = interleave(leftBuffer, rightBuffer);



           var buffer = new ArrayBuffer(44 + interleaved.length * 2);
           var view = new DataView(buffer);

           // RIFF chunk descriptor
           writeUTFBytes(view, 0, 'RIFF');
           view.setUint32(4, 44 + interleaved.length * 2, true);
           writeUTFBytes(view, 8, 'WAVE');
           // FMT sub-chunk
           writeUTFBytes(view, 12, 'fmt ');
           view.setUint32(16, 16, true);
           view.setUint16(20, 1, true);
           // stereo (2 channels)
           view.setUint16(22, 2, true);
           view.setUint32(24, sampleRate, true);
           view.setUint32(28, sampleRate * 4, true);
           view.setUint16(32, 4, true);
           view.setUint16(34, 16, true);
           // data sub-chunk
           writeUTFBytes(view, 36, 'data');
           view.setUint32(40, interleaved.length * 2, true);


           var lng = interleaved.length;
           var index = 44;
           var volume = 1;
           for (var i = 0; i < lng; i++) {
               view.setInt16(index, interleaved[i] * (0x7FFF * volume), true);
               index += 2;
           }

           var blob = new Blob([view], {
               type: 'audio/wav'
           });

           // let's save it locally

           document.getElementById('output').innerHTML = 'Handing off the file now...';
           var url = (window.URL || window.webkitURL).createObjectURL(blob);

           var li = document.createElement('li');
           var au = document.createElement('audio');
           var hf = document.createElement('a');

           au.controls = true;
           au.src = url;
           hf.href = url;
           hf.download = 'audio_recording_' + new Date().getTime() + '.wav';
           hf.innerHTML = hf.download;
           li.appendChild(au);
           li.appendChild(hf);
           recordingList.appendChild(li);

       }
    }


    function success(e) {

       audioContext = window.AudioContext || window.webkitAudioContext;
       context = new audioContext();


       volume = context.createGain();

       // creates an audio node from the microphone incoming stream(source)
       source = context.createMediaStreamSource(e);

       // connect the stream(source) to the gain node
       source.connect(volume);

       var bufferSize = 2048;

       recorder = context.createScriptProcessor(bufferSize, 2, 2);

       //node for the visualizer
       analyser = context.createAnalyser();
       analyser.smoothingTimeConstant = 0.3;
       analyser.fftSize = 512;

       splitter = context.createChannelSplitter();
       //when recording happens
       recorder.onaudioprocess = function (e) {

           if (!recording) return;
           var left = e.inputBuffer.getChannelData(0);
           var right = e.inputBuffer.getChannelData(1);

           leftchannel.push(new Float32Array(left));
           rightchannel.push(new Float32Array(right));
           recordingLength += bufferSize;

           // get the average for the first channel
           var array = new Uint8Array(analyser.frequencyBinCount);
           analyser.getByteFrequencyData(array);

           var c = document.getElementById("myCanvas");
           var ctx = c.getContext("2d");
           // clear the current state
           ctx.clearRect(0, 0, 1000, 325);
           var gradient = ctx.createLinearGradient(0, 0, 0, 300);
           gradient.addColorStop(1, '#000000');
           gradient.addColorStop(0.75, '#ff0000');
           gradient.addColorStop(0.25, '#ffff00');
           gradient.addColorStop(0, '#ffffff');
           // set the fill style
           ctx.fillStyle = gradient;
           drawSpectrum(array);

           function drawSpectrum(array) {
               for (var i = 0; i < (array.length); i++) {
                   var value = array[i];
                   ctx.fillRect(i * 5, 325 - value, 3, 325);
               }

           }
       }

       function getAverageVolume(array) {
           var values = 0;
           var average;

           var length = array.length;

           // get all the frequency amplitudes
           for (var i = 0; i < length; i++) {
               values += array[i];
           }

           average = values / length;
           return average;
       }

       // we connect the recorder(node to destination(speakers))
       volume.connect(splitter);
       splitter.connect(analyser, 0, 0);

       analyser.connect(recorder);
       recorder.connect(context.destination);

    }




    function mergeBuffers(channelBuffer, recordingLength) {
       var result = new Float32Array(recordingLength);
       var offset = 0;
       var lng = channelBuffer.length;
       for (var i = 0; i < lng; i++) {
           var buffer = channelBuffer[i];
           result.set(buffer, offset);
           offset += buffer.length;
       }
       return result;
    }

    function interleave(leftChannel, rightChannel) {
       var length = leftChannel.length + rightChannel.length;
       var result = new Float32Array(length);

       var inputIndex = 0;

       for (var index = 0; index < length;) {
           result[index++] = leftChannel[inputIndex];
           result[index++] = rightChannel[inputIndex];
           inputIndex++;
       }
       return result;
    }


    function writeUTFBytes(view, offset, string) {
       var lng = string.length;
       for (var i = 0; i < lng; i++) {

           view.setUint8(offset + i, string.charCodeAt(i));
       }
    }