function checkUpdatedList(apiKey, listId) {
    return new Promise((resolve, reject) => {

      if (!apiKey || !listId)
        return reject(new Error("No Parameters Provided"));

      Promise.all([
        Youtube.listEtag(apiKey, listId),
        List.findOne({
          listId: listId
        })
      ]).then(([newEtag, list]) => {
        if (list.etag != newEtag) {
          logger.debug(listId + " - Etag modified. List update necesary");
          getListDiferences(apiKey, listId, newEtag).then(returnObject => {
            return resolve(null);
          }).catch(err => {
            return reject(err.stack);
          });
        } else {
          logger.debug(listId + " - Etag not modified. List allready updated");

          list.updated = Date.now();
          list.save();
          return resolve(null);
        }
      }).catch(err => {
        return reject(err.stack);
      });
    });
  }
//Detecta si una lista ha sido modificada.
Detecta si una lista ha sido modificada.
Detecta si una lista ha sido modificada .
function checkUpdatedList(apiKey, listId) {
    return new Promise((resolve, reject) => {
      if (!apiKey || !listId)
        return reject(new Error("No Parameters Provided"));
      Promise.all([
        Youtube.listEtag(apiKey, listId),
        List.findOne({
          listId: listId
        })
      ]).then(([newEtag, list]) => {
        if (list.etag != newEtag) {
          logger.debug(listId + " - Etag modified. List update necesary");
          getListDiferences(apiKey, listId, newEtag).then(returnObject => {
            return resolve(null);
          }).catch(err => {
            return reject(err.stack);
          });
        } else {
          logger.debug(listId + " - Etag not modified. List allready updated");
          list.updated = Date.now();
          list.save();
          return resolve(null);
        }
      }).catch(err => {
        return reject(err.stack);
      });
    });
  }
function checkUpdatedList ( apiKey , listId ) { return new Promise ( ( resolve , reject ) => { if ( ! apiKey || ! listId ) return reject ( new Error ( "No Parameters Provided" ) ) ; Promise . all ( [ Youtube . listEtag ( apiKey , listId ) , List . findOne ( { listId : listId } ) ] ) . then ( ( [ newEtag , list ] ) => { if ( list . etag != newEtag ) { logger . debug ( listId + " - Etag modified. List update necesary" ) ; getListDiferences ( apiKey , listId , newEtag ) . then ( returnObject => { return resolve ( null ) ; } ) . catch ( err => { return reject ( err . stack ) ; } ) ; } else { logger . debug ( listId + " - Etag not modified. List allready updated" ) ; list . updated = Date . now ( ) ; list . save ( ) ; return resolve ( null ) ; } } ) . catch ( err => { return reject ( err . stack ) ; } ) ; } ) ; }
Detecta si una lista ha sido modificada.
Detecta si una lista ha sido modificada .