
Recherche avancée
Autres articles (35)
-
Gestion de la ferme
2 mars 2010, parLa ferme est gérée dans son ensemble par des "super admins".
Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
Dans un premier temps il utilise le plugin "Gestion de mutualisation" -
ANNEXE : Les extensions, plugins SPIP des canaux
11 février 2010, parUn plugin est un ajout fonctionnel au noyau principal de SPIP. MediaSPIP consiste en un choix délibéré de plugins existant ou pas auparavant dans la communauté SPIP, qui ont pour certains nécessité soit leur création de A à Z, soit des ajouts de fonctionnalités.
Les extensions que MediaSPIP nécessite pour fonctionner
Depuis la version 2.1.0, SPIP permet d’ajouter des plugins dans le répertoire extensions/.
Les "extensions" ne sont ni plus ni moins que des plugins dont la particularité est qu’ils se (...) -
Personnaliser les catégories
21 juin 2013, parFormulaire 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 (...)
Sur d’autres sites (5110)
-
download and fill file on fly
4 mai 2017, par Gianluca CalabriaI’m trying to create a service for a client which takes some audio chunks and concatenate them. For this I’m using FFmpeg. The user should also be able to download the result on the fly without waiting for the conversion/concatenation to finish. The idea is to "fill" the file as the process goes on. I cannot work my way around it, is it possible to do ? I’m using a RESTful service which calls a class like this one
public ReadableRepresentation serveDownloadRequest(Representation entity) throws SystemInitializationException {
InputStreamChannel inputStreamChannel;
Form reqParameters=getQuery();
try {
String parameters = readStringParameter(reqParameters, AudioCutAndJoinParameters.PARAMETERS, AudioCutAndJoinParameters.PARAMETERS_MANDATORY);
trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.PARAMETERS + "=" + parameters);
String inputUri = readStringParameter(reqParameters, AudioCutAndJoinParameters.INPUT_URI, AudioCutAndJoinParameters.INPUT_URI_MANDATORY);
trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.INPUT_URI + "=" + inputUri);
String markInRelative = readStringParameter(reqParameters, AudioCutAndJoinParameters.MARKIN_ID_RELATIVE, AudioCutAndJoinParameters.MARKIN_ID_RELATIVE_MANDATORY);
trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.MARKIN_ID_RELATIVE + "=" + markInRelative);
String parametersString = readStringParameter(reqParameters, AudioCutAndJoinParameters.PARAMETERS_STRING, AudioCutAndJoinParameters.PARAMETERS_STRING_MANDATORY);
trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.PARAMETERS_STRING + "=" + parametersString);
String cmdFolder = readStringParameter(reqParameters, AudioCutAndJoinParameters.COMMAND_FOLDER, AudioCutAndJoinParameters.COMMAND_FOLDER_MANDATORY);
trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.COMMAND_FOLDER + "=" + cmdFolder);
Map markInIdRelativeMap=JsonEntityManager.getInstance().deserializeMap(markInRelative);
Map parametersMap=JsonEntityManager.getInstance().deserializeMap(parameters);
List <string> InputUri= JsonEntityManager.getInstance().deserializeList(inputUri);
InputStream transcodeOutput = Services.getInstance().runAudioCutAndJoin(parametersMap,markInIdRelativeMap,InputUri,parametersString,cmdFolder);
inputStreamChannel = new InputStreamChannel(transcodeOutput);
ReadableRepresentation result = new ReadableRepresentation(inputStreamChannel, MediaType.AUDIO_ALL);
Disposition disp = new Disposition(Disposition.TYPE_ATTACHMENT);
disp.setFilename("test-cut.wav");
result.setDisposition(disp);
return result;
</string>I’m using the
process.getInputStream()
as return of myrunAudioCutAndJoin
but no download happens until the process of conversion/concatenation is done. Can somebody please help me out ? -
How to find and download m3u8 file from websites's link like hotstar, voot and sonyliv in php, javascript or nodejs or python [on hold]
10 juillet 2018, par gaurav pandeyI’m trying to download the m3u8 file from website’s(Like hotstar, voot etc) video link using php or javascript or nodejs or python.
Please help.
Thanks -
Attempting to use recursion, why does my code only download 4 videos and exit ?
16 avril 2024, par Andrew AtwoodI am attempting to download videos from an API that I have access to. This should loop through all of the videos that were returned from the API call, save them to disc, use ffmpeg to verify the meta data from the API (this step is necessary because the API is sometimes returning incorrect information), then save attribution information and continue on if no error. However, my output from the below code is simple this :


[]
Download Done: 0
Saved 'Owner: Anthony �; Owner URL: https://www.pexels.com/@inspiredimages' to animals.txt 
13
0
Download Done: 1
Saved 'Owner: PMA; Owner URL: https://www.pexels.com/@pma-1470250' to animals.txt
35
1
Download Done: 2
Saved 'Owner: Pressmaster; Owner URL: https://www.pexels.com/@pressmaster' to animals.txt 
65
2
Download Done: 3
Saved 'Owner: Ruvim Miksanskiy; Owner URL: https://www.pexels.com/@digitech' to animals.txt 
75
3



No errors, no exit code. Just stops running. I've walked through the process in my head a few times, and I can't figure out why it only gets called 4 times. Would anyone have any insight as to where I could try troubleshooting ?


Code Here :


require("dotenv").config();
const axios = require("axios");
const concat = require("ffmpeg-concat");
const fluent = require("fluent-ffmpeg");
const fs = require("fs");

const PEXELS_API_KEY = process.env.PEXELS_API_KEY;

const SUBTOPIC = "animals";

const URLBase = `https://api.pexels.com/videos/search?query=${SUBTOPIC}&per_page=80&size=medium&orientation=landscape`;
let rVideos;
let videosToConcat = [];
let duration = 0;
let current = 0;

const fetchVideos = async () => {
 const response = await axios.get(URLBase, {
 headers: {
 Authorization: PEXELS_API_KEY,
 },
 });

 return response.data.videos;
};

const writeVideoToDisc = async (videoObj) => {
 let found = false;
 videoObj.forEach(async (file, index) => {
 if (
 found === false &&
 file.quality === "hd" &&
 file.width === 1920 &&
 file.height === 1080 &&
 file.file_type === "video/mp4"
 ) {
 found = true;
 let writer = fs.createWriteStream("raw/" + current + ".mp4");
 let streamResponse = await axios({
 url: rVideos[current].video_files[index].link,
 method: "get",
 responseType: "stream",
 });
 streamResponse.data.pipe(writer);
 writer.on("finish", () => {
 console.log(`Download Done: ${current}`);
 fluent.ffprobe(`./raw/${current}.mp4`, (err, metadata) => {
 if (err) {
 console.error(err);
 } else {
 if (
 metadata.streams[0].width !== 1920 ||
 metadata.streams[0].height !== 1080
 ) {
 fs.unlink(`./raw/${current}.mp4`, (err) => {
 if (err) throw err;
 console.log("File deleted!");
 });
 } else {
 duration += rVideos[current].duration;
 videosToConcat.push(`./raw/${current}.mp4`);
 fs.appendFile(
 `./attribution/${SUBTOPIC}.txt`,
 `Owner: ${rVideos[current].user.name}; Owner URL: ${rVideos[current].user.url} \n`,
 function (err) {
 if (err) throw err;
 console.log(
 `Saved 'Owner: ${rVideos[current].user.name}; Owner URL: ${rVideos[current].user.url}' to ${SUBTOPIC}.txt`
 );
 if (duration < 600) {
 console.log(duration);
 console.log(current);
 current++;
 writeVideoToDisc(rVideos[current].video_files);
 }
 }
 );
 }
 }
 });
 });
 writer.on("error", () => console.error("Error while dowloading video"));
 }
 });
};

const main = async () => {
 rVideos = await fetchVideos();
 console.log(rVideos.length);
 await writeVideoToDisc(rVideos[current].video_files);
 console.log(videosToConcat);
 // concat videos together
};

main();