Giter Site home page Giter Site logo

avatar-plugin-blague's People

Contributors

spikharpax avatar

Watchers

 avatar  avatar

avatar-plugin-blague's Issues

aide

salut stephane,
je suis sur plusieurs plugin (ordinateur,planingserie, internet, bonjour, cava,clavier,depuis plusieurs mois c est pour les finir et les mettre sur le github je sollicite ton aide
je suis sur un plugin cinema(allocine) je voudrai juste le codage pour que avatar me dises les horaires du film, j essayer deux codage des plugin de jp encause et jeannel L, mais ca n a pas fonctionnais, pour la salle de cinema et les films en salle ca c est fait
sachant le scrape du film : var film=film+$('a.meta-title-link').eq(a).text()
scrape des horaires du film : var heure=heure+$('span.hours-item-value').eq(a).text()

jennel L:
var hours = function($, pos){
var nfilmtemp= $('a.meta-title-link').eq(pos);
var nfilm=""
if(nfilmtemp!==""){
var nfilmtemp='"'+nfilmtemp+'"';var nfilmtemp=nfilmtemp.replace(new RegExp('[^0-9]', 'ig'),"")
for(var i=0;i<6;i++){var nfilm=nfilm+nfilmtemp[i]}
console.log("numéros film : "+nfilm)
}
var fichierheure=$('#movie'+nfilm+' span.hours-item-value').text()
var heure=""
var s=0
for(var z=0;z<fichierheure.length;z++){
var heure=heure+fichierheure[z]
if(z==29){var z=fichierheure.length}
var s=s+1
if((s==5)&&(z<fichierheure.length-1)){var heure=heure+",";var s=0}
}
var heure=heure.split(',')
if(heure==""){var heure="pas de séances"}
console.log('horaire : '+heure)
console.log('a')
var hours=heure
return(hours)
}

jp encause:
var hours = function($, pos){
return $('DIV.cell').eq(pos).find('DIV[style*=red]').map(function(){ return clean($(this).text()); });
}

var clean = function(hours){
hours = hours.replace(/
/g,'. ').replace(/Lun[-,]* /g,'Lundi ')
.replace(/Mar[-,]* /g,'Mardi ').replace(/Mer[-,]* /g,'Mercredi ')
.replace(/Jeu[-,]* /g,'Jeudi ').replace(/Ven[-,]* /g,'Vendredi ')
.replace(/Sam[-,]* /g,'Samedi ').replace(/Dim[-,]* /g,'Dimanche ');
return hours;
}
merci stephane

aide au plugin

bonjour stephane,
stp un aide , ce que je fait pas seulement pour moi mais pour le systeme avatar et pour les membes
j ai un peux corriger le plugin est fonctionnel mais ca ne prend pas en compte ce que j ai rajouter
if (!Config.num_departement){
console.log("numero non défini");
} else {
Avatar.speak('numéro département non renseigner', data.client, function(){
Avatar.Speech.end(data.client);
});

    callback();

}
var num_departement = Config.num_departement;
console.log('dept :' + Config.num_departement);

fichier.prop
{
"modules" : {
"vigilance" : {
"description": "Avatar donne les vigilance intempérie ",
"version": "1.0",
"active" : true,
"num_departement" : "93100",
"rules" : ["vigilance"]
}
}
}

fichier.js
var Promise = require('q').Promise;

require('colors');

exports.action = function(data, callback){

    var num_departement = data.action.sentence;

    if (!Config.num_departement){
    console.log("numero non défini");
    } else {
    	Avatar.speak('numéro département non renseigner', data.client, function(){ 
        Avatar.Speech.end(data.client);
    });

    callback();

}
var num_departement = Config.num_departement;
console.log('dept :' + Config.num_departement);

info("Alerte vigilance from:", data.client.yellow);
var url = 'http://alerte.vigilance-meteo.fr/getwarning_fr.php?plz='+num_departement+'&uwz=UWZ-FR&lang=fr';
http_request(url)
.then(body => scraper(body))
.then(function(vigilance) { 
	Avatar.speak("voici les vigilance:" + vigilance, data.client, function(){ 
		Avatar.Speech.end(data.client);
    });
})
.catch(function(err) {
	Avatar.speak(err, data.client, function(){ 
		Avatar.Speech.end(data.client);
    });
});

    callback();

}

function scraper(body) {

return new Promise(function (resolve, reject) { 
	var $ = require('cheerio').load(body, { xmlMode: true, ignoreWhitespace: false, lowerCaseTags: false });
    console.log(vigilance)
    var vigilance = $("#content h1:nth-child(2)").first().text()+ " : "+$('#content p:nth-child(3)').first().text();
	
	if (!vigilance) {
		return reject('Désolé je n\'arrive pas accédé au site');
	}
	
	resolve (vigilance);
});

}

function http_request (url) {

return new Promise(function (resolve, reject) {
	
	var request = require('request');
	request({ 'uri' : url}, function (err, response, body) {
	
		if (err || response.statusCode != 200) {
		  return reject ('Désolé je n\'arrive pas accédé au site');
		}

		resolve(body);
	});
	
});

}
merci, cordialement

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.