Recherche avancée

Médias (0)

Mot : - Tags -/signalement

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

Autres articles (68)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

Sur d’autres sites (6854)

  • How can I use FFMpeg to convert videos saved in gallery to mp4 no matter what extension is chose ?

    7 juin 2014, par user3587194
    Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
    intent.setType("video/*");
    startActivityForResult(intent, VIDEO_SELECTED_GALLERY);
              }
          }, expires);
       }
    });

    sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" +Environment.getExternalStorageDirectory())));

    Here is my OnActivityResults this is after the Intent happens when i choose a video from the selected gallery. Im trying to implement in FFMpeg command during the onActivityResult so i can be able to convert all video files to mp4 when choosing a video from the gallery

    else if (requestCode == VIDEO_SELECTED_GALLERY) {      

            if (resultCode == RESULT_OK) {

                try {

                    selectedVideo = intent.getData();

                    if (selectedVideo != null) {

                        try {

                            String[] filePathColumn = {

                                    MediaStore.Video.VideoColumns.DATA,

                                    MediaStore.Video.VideoColumns.SIZE,

                                    MediaStore.Video.VideoColumns.DURATION,

                                    MediaStore.Video.VideoColumns.MIME_TYPE

                            };

                           Cursor cursor = getContentResolver().query(selectedVideo, filePathColumn, null, null, null);

                           cursor.moveToFirst();

                           int columnIndex0 = cursor.getColumnIndex(filePathColumn[0]);

                           int columnIndex1 = cursor.getColumnIndex(filePathColumn[1]);

                           int columnIndex2 = cursor.getColumnIndex(filePathColumn[2]);

                           int columnIndex3 = cursor.getColumnIndex(filePathColumn[3]);

                            if (cursor.getString(columnIndex3) != null && cursor.getString(columnIndex3).compareTo("")!=0 && cursor.getString(columnIndex3).contains("wmv")) {

                                displayErrorAlert("Upload Alert", "You cannot upload .wmv format videos. Sorry, that file format is not supported at this time");

                            }

                            else {

                                float lduration = 0.0f;

                                String lpath = "";

                                if(cursor.getString(columnIndex1) != null && cursor.getString(columnIndex1).compareTo("")!=0) {

                                    lsize  = Long.parseLong(cursor.getString(columnIndex1));

                                    size_of_file = lsize;

                                }

                                if (cursor.getString(columnIndex2) != null && cursor.getString(columnIndex2).compareTo("")!=0) {

                                    lduration = Float.parseFloat(cursor.getString(columnIndex2));

                                }

                                if(cursor.getString(columnIndex0) != null && cursor.getString(columnIndex0).compareTo("")!= 0) {

                                    lpath = cursor.getString(columnIndex0);

                                    lduration = lduration / 1000;

                                    if (lduration > 31.00) {

                                        displayErrorAlert("Time Limit", "Duration of video is more than 30 seconds");

                                    }

                                    else {

                                        path = lpath;

                                        getVideoFileSize();

                                        if (lsize > 26214400 && lsize < FILE_SIZE) {

                                            AlertDialog.Builder confirm = new AlertDialog.Builder(this);

                                            confirm.setTitle("Warning: Long Upload Time");

                                            confirm.setMessage("This video is larger than 25MB. Uploading may take more than 5 minutes, depending on your internet speed.");

                                            confirm.setPositiveButton("Yes", new DialogInterface.OnClickListener() {

                                                @Override
                                                public void onClick (DialogInterface dialog, int which) {

                                                    if (mConnectionDetector.isConnectedToInternet()) {
                                                        // TODO Auto-generated method

                                                        new S3PutObjectTask(VideoPlay.this, s3Client, code, path, size_of_file, securityCode).execute();

                                                    }

                                                    else {

                                                        mTosty.showToast(getResources().getString(R.string.internetIssue));

                                                    }

                                                }

                                            });

                                            confirm.setNegativeButton("No", new DialogInterface.OnClickListener() {

                                                public void onClick (DialogInterface dialog, int which) {

                                                    dialog.dismiss();

                                                }

                                            });

                                            confirm.show().show();

                                        }

                                        else {

                                            if (mConnectionDetector.isConnectedToInternet()) {

                                                new S3PutObjectTask(VideoPlay.this, s3Client, code, path, size_of_file, securityCode).execute();

                                            }

                                            else {

                                                mTosty.showToast(getResources().getString(R.string.internetIssue));

                                            }

                                        }

                                    }

                                }

                                else {

                                    if (lsize > FILE_SIZE) {

                                        displayErrorAlert("File Size Too Big", "You can not download greater than 50mb.");                                                                

                                    }

                                    else if (lsize > 26214400 && lsize < FILE_SIZE) {

                                        AlertDialog.Builder confirm = new AlertDialog.Builder(this);

                                        confirm.setTitle("Warning: Long Download Time");

                                        confirm.setMessage("This video is larger than 25MB. Downloading may take more than 5 minutes, depending on your internet speed.");

                                        confirm.setPositiveButton("Yes", new DialogInterface.OnClickListener() {

                                            @Override
                                            public void onClick(DialogInterface dialog, int which) {

                                                VideoDownloaderTaskForAlbum mTask =new VideoDownloaderTaskForAlbum(VideoPlay.this,VideoPlay.this,lsize,selectedVideo);

                                                mTask.execute(selectedVideo);

                                                dialog.dismiss();

                                            }

                                        });

                                        confirm.setNegativeButton("No", new DialogInterface.OnClickListener() {

                                            public void onClick(DialogInterface dialog, int which) {

                                                dialog.dismiss();

                                            }

                                        });

                                        confirm.show().show();

                                    }

                                    else {

                                        VideoDownloaderTaskForAlbum mTask =new VideoDownloaderTaskForAlbum(VideoPlay.this,VideoPlay.this,lsize,selectedVideo);

                                        mTask.execute(selectedVideo);  

                                    }                              

                                }

                            }

                        }

                        catch(Exception e) {

                            e.printStackTrace();

                        }

                    }

                    else {

                        displayErrorAlert("Wrong File", "Wrong file Path");

                    }

                }

                catch (Exception e) {

                    Log.i("tag", e.getMessage());

                }

            } else if (resultCode == RESULT_CANCELED) {

                mTosty.showToast("Result Canceled");

            }

        }

    }
  • Révision 19897 : Dans une requete HEAD renvoyer le vrai en-tête. Pour cela on est bien obligé de ...

    11 septembre 2012, par cedric -

    On perd donc la rapidité de calcul des requetes HEAD au profit de leur exactitude. Dans la mesure ou HEAD représente en général moins de 1% des requetes (voire de l’ordre de 2/1000 sur un echantillon de sites en production) la perte en performance serveur est négligeable (d’autant plus qu’une (...)

  • Method For Crawling Google

    28 mai 2011, par Multimedia Mike — Big Data

    I wanted to crawl Google in order to harvest a large corpus of certain types of data as yielded by a certain search term (we’ll call it “term” for this exercise). Google doesn’t appear to offer any API to automatically harvest their search results (why would they ?). So I sat down and thought about how to do it. This is the solution I came up with.



    FAQ
    Q : Is this legal / ethical / compliant with Google’s terms of service ?
    A : Does it look like I care ? Moving right along…

    Manual Crawling Process
    For this exercise, I essentially automated the task that would be performed by a human. It goes something like this :

    1. Search for “term”
    2. On the first page of results, download each of the 10 results returned
    3. Click on the next page of results
    4. Go to step 2, until Google doesn’t return anymore pages of search results

    Google returns up to 1000 results for a given search term. Fetching them 10 at a time is less than efficient. Fortunately, the search URL can easily be tweaked to return up to 100 results per page.

    Expanding Reach
    Problem : 1000 results for the “term” search isn’t that many. I need a way to expand the search. I’m not aiming for relevancy ; I’m just searching for random examples of some data that occurs around the internet.

    My solution for this is to refine the search using the “site” wildcard. For example, you can ask Google to search for “term” at all Canadian domains using “site :.ca”. So, the manual process now involves harvesting up to 1000 results for every single internet top level domain (TLD). But many TLDs can be more granular than that. For example, there are 50 sub-domains under .us, one for each state (e.g., .ca.us, .ny.us). Those all need to be searched independently. Same for all the sub-domains under TLDs which don’t allow domains under the main TLD, such as .uk (search under .co.uk, .ac.uk, etc.).

    Another extension is to combine “term” searches with other terms that are likely to have a rich correlation with “term”. For example, if “term” is relevant to various scientific fields, search for “term” in conjunction with various scientific disciplines.

    Algorithmically
    My solution is to create an SQLite database that contains a table of search seeds. Each seed is essentially a “site :” string combined with a starting index.

    Each TLD and sub-TLD is inserted as a searchseed record with a starting index of 0.

    A script performs the following crawling algorithm :

    • Fetch the next record from the searchseed table which has not been crawled
    • Fetch search result page from Google
    • Scrape URLs from page and insert each into URL table
    • Mark the searchseed record as having been crawled
    • If the results page indicates there are more results for this search, insert a new searchseed for the same seed but with a starting index 100 higher

    Digging Into Sites
    Sometimes, Google notes that certain sites are particularly rich sources of “term” and offers to let you search that site for “term”. This basically links to another search for ‘term site:somesite”. That site gets its own search seed and the program might harvest up to 1000 URLs from that site alone.

    Harvesting the Data
    Armed with a database of URLs, employ the following algorithm :

    • Fetch a random URL from the database which has yet to be downloaded
    • Try to download it
    • For goodness sake, have a mechanism in place to detect whether the download process has stalled and automatically kill it after a certain period of time
    • Store the data and update the database, noting where the information was stored and that it is already downloaded

    This step is easy to parallelize by simply executing multiple copies of the script. It is useful to update the URL table to indicate that one process is already trying to download a URL so multiple processes don’t duplicate work.

    Acting Human
    A few factors here :

    • Google allegedly doesn’t like automated programs crawling its search results. Thus, at the very least, don’t let your script advertise itself as an automated program. At a basic level, this means forging the User-Agent : HTTP header. By default, Python’s urllib2 will identify itself as a programming language. Change this to a well-known browser string.
    • Be patient ; don’t fire off these search requests as quickly as possible. My crawling algorithm inserts a random delay of a few seconds in between each request. This can still yield hundreds of useful URLs per minute.
    • On harvesting the data : Even though you can parallelize this and download data as quickly as your connection can handle, it’s a good idea to randomize the URLs. If you hypothetically had 4 download processes running at once and they got to a point in the URL table which had many URLs from a single site, the server might be configured to reject too many simultaneous requests from a single client.

    Conclusion
    Anyway, that’s just the way I would (and did) do it. What did I do with all the data ? That’s a subject for a different post.

    Adorable spider drawing from here.