Recherche avancée

Médias (33)

Mot : - Tags -/creative commons

Autres articles (63)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • 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 (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (8881)

  • Android- Error during executing Runtime.getRuntime().exec() - Environment Null -ffmpeg

    18 février 2015, par Chaitanya Chandurkar

    I have compiled ffmpeg library on ubuntu 11.10 and ported compiled files on android.
    After compiling i got libffmpeg.so successfully. It gets loaded on android successfully.

    I am doing it on ubuntu 11.10 eclipse android emulator.

    I have created a small test application which act as command prompt which accepts command from user and displays result. (testing ffmpeg commands)

    When i run simple commands like "ls", "ls -l" it works perfectly. but when i simply type "cd mnt" or "ffmpeg" as command and try to run it. I got Warnings in Logcat saying that

    08-26 16:44:52.553: W/System.err(5961): java.io.IOException: Error running exec(). Command: [ffmpeg] Working Directory: null Environment: null
    08-26 16:44:52.573: W/System.err(5961):     at java.lang.ProcessManager.exec(ProcessManager.java:211)
    08-26 16:44:52.573: W/System.err(5961):     at java.lang.Runtime.exec(Runtime.java:168)
    08-26 16:44:52.573: W/System.err(5961):     at java.lang.Runtime.exec(Runtime.java:241)
    08-26 16:44:52.583: W/System.err(5961):     at java.lang.Runtime.exec(Runtime.java:184)
    08-26 16:44:52.593: W/System.err(5961):     at ch.ffmpeg.reversit.MainActivity.Execute(MainActivity.java:61)
    08-26 16:44:52.593: W/System.err(5961):     at ch.ffmpeg.reversit.MainActivity$1.onClick(MainActivity.java:46)
    08-26 16:44:52.593: W/System.err(5961):     at android.view.View.performClick(View.java:3480)
    08-26 16:44:52.593: W/System.err(5961):     at android.view.View$PerformClick.run(View.java:13983)
    08-26 16:44:52.603: W/System.err(5961):     at android.os.Handler.handleCallback(Handler.java:605)
    08-26 16:44:52.603: W/System.err(5961):     at android.os.Handler.dispatchMessage(Handler.java:92)
    08-26 16:44:52.603: W/System.err(5961):     at android.os.Looper.loop(Looper.java:137)
    08-26 16:44:52.614: W/System.err(5961):     at android.app.ActivityThread.main(ActivityThread.java:4340)
    08-26 16:44:52.624: W/System.err(5961):     at java.lang.reflect.Method.invokeNative(Native Method)
    08-26 16:44:52.624: W/System.err(5961):     at java.lang.reflect.Method.invoke(Method.java:511)
    08-26 16:44:52.634: W/System.err(5961):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    08-26 16:44:52.634: W/System.err(5961):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    08-26 16:44:52.644: W/System.err(5961):     at dalvik.system.NativeStart.main(Native Method)
    08-26 16:44:52.644: W/System.err(5961): Caused by: java.io.IOException: Permission denied
    08-26 16:44:52.674: W/System.err(5961):     at java.lang.ProcessManager.exec(Native Method)
    08-26 16:44:52.674: W/System.err(5961):     at java.lang.ProcessManager.exec(ProcessManager.java:209)
    08-26 16:44:52.684: W/System.err(5961):     ... 16 more

    Here is my code :

    imports;
    public class MainActivity extends Activity {
       String com;
       Process process;
       EditText command;
       Button run;
       RelativeLayout main_layout;

       static {
        System.loadLibrary("ffmpeg");
       }

       /** Called when the activity is first created. */
       @Override
       public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_main);

          //find view
          command=(EditText)findViewById(R.id.command);
          run=(Button)findViewById(R.id.run);

           run.setOnClickListener(new OnClickListener() {
               public void onClick(View v) {
                   com=command.getText().toString();
                   try {
                       Execute();
                   } catch (IOException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
                   } catch (InterruptedException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
                   }

               }
           });

       }

       public void Execute() throws IOException, InterruptedException{
           process=Runtime.getRuntime().exec(com);
           // process = pb.command(com).redirectErrorStream(true).start();

           if(process!=null)
           ShowOutput();
           else
           Toast.makeText(getBaseContext(),"Null Process",Toast.LENGTH_LONG).show();
       }

       public void ShowOutput() throws IOException, InterruptedException{
           String s,text="",errors="";
           BufferedReader stdInput = new BufferedReader(new
                   InputStreamReader(process.getInputStream()));

              BufferedReader stdError = new BufferedReader(new
                   InputStreamReader(process.getErrorStream()));


              TextView output=(TextView)findViewById(R.id.output);
              TextView error=(TextView)findViewById(R.id.error);

               while ((s = stdInput.readLine()) != null) {
                      text+=s.toString()+"\n";
                      System.out.println("Error: "+s);
                  }

            output.setText(text);
            text="";
              // read any errors from the attempted command
              System.out.println("Here is the standard error of the command (if any):\n");
              while ((s = stdError.readLine()) != null) {
                  text+=s.toString()+"\n";
                  System.out.println("Error: "+s);
              }

              error.setText(text);

              error.setMovementMethod(new ScrollingMovementMethod());
              output.setMovementMethod(new ScrollingMovementMethod());

              stdInput.close();
              stdError.close();

              process.waitFor();
              process.getOutputStream().close();
              process.getInputStream().close();
              process.getErrorStream().close();
              process.destroy();


       }

    }

    I even tried process = pb.command(com).redirectErrorStream(true).start(); for execution. It gives me same error but this time environment was [ANDROID_SOCKET_Zygot] bla bla bla..

    EDIT 1 :
    I use Openjdk on ubuntu

    Help me out !!

  • Disable image file name correction by default. Closes #3332

    2 septembre 2014, par blueimp
    Disable image file name correction by default. Closes #3332
    

    To enable image file correction, the option `correct_image_extensions`
    can be set to `true`.
    This applies the exif_imagetype function on all files if available and
    corrects the file extension if it doesn’t match.

  • How to create a scheduled task – Introducing the Piwik Platform

    28 août 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 How to create a custom theme in Piwik). This time you’ll learn how to execute scheduled tasks in the background, for instance sending a daily email. For this tutorial you will need to have basic knowledge of PHP.

    What can you do with scheduled tasks ?

    Scheduled tasks let you execute tasks regularly (hourly, weekly, …). For instance you can :

    • create and send custom reports or summaries
    • sync users and websites with other systems
    • clear any caches
    • import third-party data into Piwik
    • monitor your Piwik instance
    • execute any other task you can think of

    Getting started

    In this series of posts, we assume that you have already set up your development environment. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik.

    To summarize the things you have to do to get setup :

    • Install Piwik (for instance via git).
    • Activate the developer mode : ./console development:enable --full.
    • Generate a plugin : ./console generate:plugin --name="MyTasksPlugin". There should now be a folder plugins/MyTasksPlugin.
    • And activate the created plugin under Settings => Plugins.

    Let’s start creating a scheduled task

    We start by using the Piwik Console to create a tasks template :

    ./console generate:scheduledtask

    The command will ask you to enter the name of the plugin the task should belong to. I will simply use the above generated plugin name “MyTasksPlugin”. There should now be a file plugins/MyTasksPlugin/Tasks.php which contains some examples to get you started easily :

    class Tasks extends \Piwik\Plugin\Tasks
    {
       public function schedule()
       {
           $this->hourly('myTask');  // method will be executed once every hour
           $this->daily('myTask');   // method will be executed once every day
           $this->weekly('myTask');  // method will be executed once every week
           $this->monthly('myTask'); // method will be executed once every month

           // pass a parameter to the task
           $this->weekly('myTaskWithParam', 'anystring');

           // specify a different priority
           $this->monthly('myTask', null, self::LOWEST_PRIORITY);
           $this->monthly('myTaskWithParam', 'anystring', self::HIGH_PRIORITY);
       }

       public function myTask()
       {
           // do something
       }

       public function myTaskWithParam($param)
       {
           // do something
       }
    }

    A simple example

    As you can see in the generated template you can execute tasks hourly, daily, weekly and monthly by registering a method which represents the actual task :

    public function schedule()
    {
       // register method remindMeToLogIn to be executed once every day
       $this->daily('remindMeToLogIn');  
    }

    public function remindMeToLogIn()
    {
       $mail = new \Piwik\Mail();
       $mail->addTo('me@example.com');
       $mail->setSubject('Check stats');
       $mail->setBodyText('Log into your Piwik instance and check your stats!');
       $mail->send();
    }

    This example sends you an email once a day to remind you to log into your Piwik daily. The Piwik platform makes sure to execute the method remindMeToLogIn exactly once every day.

    How to pass a parameter to a task

    Sometimes you want to pass a parameter to a task method. This is useful if you want to register for instance one task for each user or for each website. You can achieve this by specifying a second parameter when registering the method to execute.

    public function schedule()
    {
       foreach (\Piwik\Site::getSites() as $site) {
           // create one task for each site and pass the URL of each site to the task
           $this->hourly('pingSite', $site['main_url']);
       }
    }

    public function pingSite($siteMainUrl)
    {
       file_get_contents($siteMainUrl);
    }

    How to test scheduled tasks

    After you have created your task you are surely wondering how to test it. First, you should write a unit or integration test which we will cover in one of our future blog posts. Just one hint : You can use the command ./console generate:test to create a test. To manually execute all scheduled tasks you can execute the API method CoreAdminHome.runScheduledTasks by opening the following URL in your browser :

    http://piwik.example.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&token_auth=YOUR_API_TOKEN

    Don’t forget to replace the domain and the token_auth URL parameter.

    There is one problem with executing the scheduled tasks : The platform makes sure they will be executed only once an hour, a day, etc. This means you can’t simply reload the URL and test the method again and again as you would have to wait for the next hour or day. The proper solution is to set the constant DEBUG_FORCE_SCHEDULED_TASKS to true within the file Core/TaskScheduler.php. Don’t forget to set it back to false again once you have finished testing it.

    Starting from Piwik 2.6.0 you can alternatively execute the following command :

    ./console core:run-scheduled-tasks --force --token-auth=YOUR_TOKEN_AUTH

    The option “–force” will make sure to execute even tasks that are not due to run at this time. So you won’t have to modify any files.

    Which tasks are registered and when is the next execution time of my task ?

    The TasksTimetable plugin from the Marketplace can answer this question for you. Simply install and activate the plugin with one click by going to Settings => Marketplace => Get new functionality. It’ll add a new admin menu item under Settings named Scheduled Tasks.

    Publishing your Plugin on the Marketplace

    In case you want to share your task(s) with other Piwik users you can do this by pushing your plugin to a public GitHub repository and creating a tag. Easy as that. Read more about how to distribute a plugin.

    Advanced features

    Isn’t it easy to create scheduled tasks ? We never even created a file ! Of course, based on our API design principle “The complexity of our API should never exceed the complexity of your use case.” you can accomplish more if you want. For instance, you can define priorities, you can directly register methods from different objects and classes, you can specify at which time of a day a task should run and more.

    Would you like to know more about tasks ? Go to our Tasks class reference in the Piwik Developer Zone.

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