|
@@ -28,12 +28,12 @@ function store_skin(rid, userId, profile, cache_details, callback) {
|
|
|
callback(err, skin_hash);
|
|
|
});
|
|
|
} else {
|
|
|
- logging.log(rid + "new skin hash: " + skin_hash);
|
|
|
+ logging.log(rid, "new skin hash:", skin_hash);
|
|
|
var facepath = __dirname + "/../" + config.faces_dir + skin_hash + ".png";
|
|
|
var helmpath = __dirname + "/../" + config.helms_dir + skin_hash + ".png";
|
|
|
fs.exists(facepath, function(exists) {
|
|
|
if (exists) {
|
|
|
- logging.log(rid + "skin already exists, not downloading");
|
|
|
+ logging.log(rid, "skin already exists, not downloading");
|
|
|
callback(null, skin_hash);
|
|
|
} else {
|
|
|
networking.get_from(rid, url, function(img, response, err1) {
|
|
@@ -42,13 +42,13 @@ function store_skin(rid, userId, profile, cache_details, callback) {
|
|
|
} else {
|
|
|
skins.extract_face(img, facepath, function(err2) {
|
|
|
if (err2) {
|
|
|
- logging.error(rid + err2.stack);
|
|
|
+ logging.error(rid, err2.stack);
|
|
|
callback(err2, null);
|
|
|
} else {
|
|
|
- logging.debug(rid + "face extracted");
|
|
|
+ logging.debug(rid, "face extracted");
|
|
|
skins.extract_helm(rid, facepath, img, helmpath, function(err3) {
|
|
|
- logging.debug(rid + "helm extracted");
|
|
|
- logging.debug(rid + helmpath);
|
|
|
+ logging.debug(rid, "helm extracted");
|
|
|
+ logging.debug(rid, helmpath);
|
|
|
callback(err3, skin_hash);
|
|
|
});
|
|
|
}
|
|
@@ -77,20 +77,20 @@ function store_cape(rid, userId, profile, cache_details, callback) {
|
|
|
callback(err, cape_hash);
|
|
|
});
|
|
|
} else {
|
|
|
- logging.log(rid + "new cape hash: " + cape_hash);
|
|
|
+ logging.log(rid, "new cape hash:", cape_hash);
|
|
|
var capepath = __dirname + "/../" + config.capes_dir + cape_hash + ".png";
|
|
|
fs.exists(capepath, function(exists) {
|
|
|
if (exists) {
|
|
|
- logging.log(rid + "cape already exists, not downloading");
|
|
|
+ logging.log(rid, "cape already exists, not downloading");
|
|
|
callback(null, cape_hash);
|
|
|
} else {
|
|
|
networking.get_from(rid, url, function(img, response, err) {
|
|
|
if (err || !img) {
|
|
|
- logging.error(rid + err.stack);
|
|
|
+ logging.error(rid, err.stack);
|
|
|
callback(err, null);
|
|
|
} else {
|
|
|
skins.save_image(img, capepath, function(err) {
|
|
|
- logging.debug(rid + "cape saved");
|
|
|
+ logging.debug(rid, "cape saved");
|
|
|
callback(err, cape_hash);
|
|
|
});
|
|
|
}
|
|
@@ -116,7 +116,7 @@ function callback_for(userId, type, err, hash) {
|
|
|
req_count++;
|
|
|
if (req_count !== 1) {
|
|
|
// otherwise this would show up on single/first requests, too
|
|
|
- logging.debug(current.rid + "queued " + type + " request continued");
|
|
|
+ logging.debug(current.rid, "queued", type + " request continued");
|
|
|
}
|
|
|
currently_running.splice(i, 1); // remove from array
|
|
|
current.callback(err, hash);
|
|
@@ -124,7 +124,7 @@ function callback_for(userId, type, err, hash) {
|
|
|
}
|
|
|
}
|
|
|
if (req_count > 1) {
|
|
|
- logging.debug(req_count + " simultaneous requests for " + userId);
|
|
|
+ logging.debug(req_count + " simultaneous requests for", userId);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -194,7 +194,7 @@ function store_images(rid, userId, cache_details, type, callback) {
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
- logging.log(rid + "ID already being processed, adding to queue");
|
|
|
+ logging.log(rid, "ID already being processed, adding to queue");
|
|
|
currently_running.push(new_hash);
|
|
|
}
|
|
|
}
|
|
@@ -223,14 +223,14 @@ exp.get_image_hash = function(rid, userId, type, callback) {
|
|
|
} else {
|
|
|
if (cache_details && cache_details[type] !== undefined && cache_details.time + config.local_cache_time * 1000 >= new Date().getTime()) {
|
|
|
// use cached image
|
|
|
- logging.log(rid + "userId cached & recently updated");
|
|
|
+ logging.log(rid, "userId cached & recently updated");
|
|
|
callback(null, (cached_hash ? 1 : 0), cached_hash);
|
|
|
} else {
|
|
|
// download image
|
|
|
if (cache_details) {
|
|
|
- logging.log(rid + "userId cached, but too old");
|
|
|
+ logging.log(rid, "userId cached, but too old");
|
|
|
} else {
|
|
|
- logging.log(rid + "userId not cached");
|
|
|
+ logging.log(rid, "userId not cached");
|
|
|
}
|
|
|
store_images(rid, userId, cache_details, type, function(err, new_hash) {
|
|
|
if (err) {
|
|
@@ -241,8 +241,8 @@ exp.get_image_hash = function(rid, userId, type, callback) {
|
|
|
});
|
|
|
} else {
|
|
|
var status = cache_details && (cached_hash === new_hash) ? 3 : 2;
|
|
|
- logging.debug(rid + "cached hash: " + (cache_details && cached_hash));
|
|
|
- logging.log(rid + "new hash: " + new_hash);
|
|
|
+ logging.debug(rid, "cached hash:", (cache_details && cached_hash));
|
|
|
+ logging.log(rid, "new hash:", new_hash);
|
|
|
callback(null, status, new_hash);
|
|
|
}
|
|
|
});
|
|
@@ -288,7 +288,7 @@ exp.get_skin = function(rid, userId, callback) {
|
|
|
var skinpath = __dirname + "/../" + config.skins_dir + skin_hash + ".png";
|
|
|
fs.exists(skinpath, function(exists) {
|
|
|
if (exists) {
|
|
|
- logging.log(rid + "skin already exists, not downloading");
|
|
|
+ logging.log(rid, "skin already exists, not downloading");
|
|
|
skins.open_skin(rid, skinpath, function(err, img) {
|
|
|
callback(err, skin_hash, img);
|
|
|
});
|
|
@@ -337,7 +337,7 @@ exp.get_render = function(rid, userId, scale, helm, body, callback) {
|
|
|
} else {
|
|
|
fs.writeFile(renderpath, img, "binary", function(err) {
|
|
|
if (err) {
|
|
|
- logging.error(rid + err.stack);
|
|
|
+ logging.error(rid, err.stack);
|
|
|
}
|
|
|
callback(null, 2, skin_hash, img);
|
|
|
});
|
|
@@ -359,7 +359,7 @@ exp.get_cape = function(rid, userId, callback) {
|
|
|
var capepath = __dirname + "/../" + config.capes_dir + cape_hash + ".png";
|
|
|
fs.exists(capepath, function(exists) {
|
|
|
if (exists) {
|
|
|
- logging.log(rid + "cape already exists, not downloading");
|
|
|
+ logging.log(rid, "cape already exists, not downloading");
|
|
|
skins.open_skin(rid, capepath, function(err, img) {
|
|
|
callback(err, cape_hash, img);
|
|
|
});
|