Skip to content

Commit

Permalink
Added parameter and renamed variables
Browse files Browse the repository at this point in the history
  • Loading branch information
TJScalzo committed Aug 3, 2017
1 parent 576d17c commit f8d6f05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dbSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const async = require('async');

var folders = {};

var q = async.queue(function(data, callback) {
gdrive.getFolders(data, callback);
var q = async.queue(function(folderID, callback) {
gdrive.getFolders(folderID, callback);
}, 1);
q.drain = function() {
console.log('That\'s all folks!')
Expand All @@ -17,17 +17,17 @@ exports.makeTree = function() {
});
}

function iterate(data, titleList, folderID) {
function iterate(data, folderList, folderID) {
if (folderID != "") {
folders[folderID] = titleList;
console.log(folderID + ': ' + titleList);
folders[folderID] = folderList;
console.log(folderID + ': ' + folderList);
}
if (data != null) {
data.items.forEach(function(folder) {
q.push(folder.id, function(newData) {
var newTitleList = titleList.slice();
newTitleList.push(folder.title);
iterate(newData, newTitleList, folder.id);
var newFolderList = folderList.slice();
newFolderList.push(folder.title);
iterate(newData, newFolderList, folder.id);
});
});
}
Expand Down
2 changes: 2 additions & 0 deletions gdrive.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ exports.setFileTitle = function(fileID, newTitle) {
drive.files.patch({
auth: jwtClient,
fileId: fileID,
setModifiedDate: true,
resource: {title: newTitle}
}, function (err, resp) {
console.log("Error:", err);
Expand All @@ -99,6 +100,7 @@ exports.setFileDescription = function(fileID, newDescription) {
drive.files.patch({
auth: jwtClient,
fileId: fileID,
setModifiedDate: true,
resource: {description: newDescription}
}, function (err, resp) {
console.log("Error:", err);
Expand Down

0 comments on commit f8d6f05

Please sign in to comment.