sqlQuery Conversion : uploaders

add-archived-and-accountType-columns
Moe 2020-07-10 18:58:23 -07:00
parent aebd01cefd
commit 1abef5ebe7
5 changed files with 137 additions and 113 deletions

View File

@ -100,23 +100,26 @@ module.exports = function(s,config,lang){
s.userLog(e,{type:lang['Amazon S3 Upload Error'],msg:err})
}
if(s.group[e.ke].init.aws_s3_log === '1' && data && data.Location){
var save = [
e.mid,
e.ke,
k.startTime,
1,
s.s({
type : 's3',
location : saveLocation
}),
k.filesize,
k.endTime,
data.Location
]
s.sqlQuery('INSERT INTO `Cloud Videos` (mid,ke,time,status,details,size,end,href) VALUES (?,?,?,?,?,?,?,?)',save)
s.knexQuery({
action: "insert",
table: "Cloud Videos",
insert: {
mid: e.mid,
ke: e.ke,
time: k.startTime,
status: 1,
details: s.s({
type : 's3',
location : saveLocation
}),
size: k.filesize,
end: k.endTime,
href: data.Location
}
})
s.setCloudDiskUsedForGroup(e,{
amount : k.filesizeMB,
storageType : 's3'
amount: k.filesizeMB,
storageType: 's3'
})
s.purgeCloudDiskForGroup(e,'s3')
}
@ -142,18 +145,21 @@ module.exports = function(s,config,lang){
s.userLog(e,{type:lang['Wasabi Hot Cloud Storage Upload Error'],msg:err})
}
if(s.group[e.ke].init.aws_s3_log === '1' && data && data.Location){
var save = [
queryInfo.mid,
queryInfo.ke,
queryInfo.time,
s.s({
type : 's3',
location : saveLocation,
}),
queryInfo.size,
data.Location
]
s.sqlQuery('INSERT INTO `Cloud Timelapse Frames` (mid,ke,time,details,size,href) VALUES (?,?,?,?,?,?)',save)
s.knexQuery({
action: "insert",
table: "Cloud Timelapse Frames",
insert: {
mid: queryInfo.mid,
ke: queryInfo.ke,
time: queryInfo.time,
details: s.s({
type : 's3',
location : saveLocation
}),
size: queryInfo.size,
href: data.Location
}
})
s.setCloudDiskUsedForGroup(e,{
amount : s.kilobyteToMegabyte(queryInfo.size),
storageType : 's3'
@ -405,4 +411,4 @@ module.exports = function(s,config,lang){
},
]
}
}
}

View File

@ -129,22 +129,25 @@ module.exports = function(s,config,lang){
}).then(function(resp){
if(s.group[e.ke].init.bb_b2_log === '1' && resp.data.fileId){
var backblazeDownloadUrl = s.group[e.ke].bb_b2_downloadUrl + '/file/' + s.group[e.ke].init.bb_b2_bucket + '/' + backblazeSavePath
var save = [
e.mid,
e.ke,
k.startTime,
1,
s.s({
type : 'b2',
bucketId : resp.data.bucketId,
fileId : resp.data.fileId,
fileName : resp.data.fileName
}),
k.filesize,
k.endTime,
backblazeDownloadUrl
]
s.sqlQuery('INSERT INTO `Cloud Videos` (mid,ke,time,status,details,size,end,href) VALUES (?,?,?,?,?,?,?,?)',save)
s.knexQuery({
action: "insert",
table: "Cloud Videos",
insert: {
mid: e.mid,
ke: e.ke,
time: k.startTime,
status: 1,
details: s.s({
type : 'b2',
bucketId : resp.data.bucketId,
fileId : resp.data.fileId,
fileName : resp.data.fileName
}),
size: k.filesize,
end: k.endTime,
href: backblazeDownloadUrl
}
})
s.setCloudDiskUsedForGroup(e,{
amount : k.filesizeMB,
storageType : 'b2'

View File

@ -157,20 +157,23 @@ module.exports = (s,config,lang,app,io) => {
const data = response.data
if(s.group[e.ke].init.googd_log === '1' && data && data.id){
var save = [
e.mid,
e.ke,
k.startTime,
1,
s.s({
type : 'googd',
id : data.id
}),
k.filesize,
k.endTime,
''
]
s.sqlQuery('INSERT INTO `Cloud Videos` (mid,ke,time,status,details,size,end,href) VALUES (?,?,?,?,?,?,?,?)',save)
s.knexQuery({
action: "insert",
table: "Cloud Videos",
insert: {
mid: e.mid,
ke: e.ke,
time: k.startTime,
status: 1,
details: s.s({
type: 'googd',
id: data.id
}),
size: k.filesize,
end: k.endTime,
href: ''
}
})
s.setCloudDiskUsedForGroup(e,{
amount : k.filesizeMB,
storageType : 'googd'
@ -208,18 +211,21 @@ module.exports = (s,config,lang,app,io) => {
s.userLog(e,{type:lang['Google Drive Storage Upload Error'],msg:err})
}
if(s.group[e.ke].init.googd_log === '1' && data && data.id){
var save = [
queryInfo.mid,
queryInfo.ke,
queryInfo.time,
s.s({
type : 'googd',
id : data.id,
}),
queryInfo.size,
''
]
s.sqlQuery('INSERT INTO `Cloud Timelapse Frames` (mid,ke,time,details,size,href) VALUES (?,?,?,?,?,?)',save)
s.knexQuery({
action: "insert",
table: "Cloud Timelapse Frames",
insert: {
mid: queryInfo.mid,
ke: queryInfo.ke,
time: queryInfo.time,
details: s.s({
type : 'googd',
id : data.id,
}),
size: queryInfo.size,
href: ''
}
})
s.setCloudDiskUsedForGroup(e,{
amount : s.kilobyteToMegabyte(queryInfo.size),
storageType : 'googd'

View File

@ -117,20 +117,23 @@ module.exports = function(s,config,lang){
if(s.group[e.ke].init.whcs_log === '1' && data && data.Location){
var cloudLink = data.Location
cloudLink = fixCloudianUrl(e,cloudLink)
var save = [
e.mid,
e.ke,
k.startTime,
1,
s.s({
type : 'whcs',
location : saveLocation
}),
k.filesize,
k.endTime,
cloudLink
]
s.sqlQuery('INSERT INTO `Cloud Videos` (mid,ke,time,status,details,size,end,href) VALUES (?,?,?,?,?,?,?,?)',save)
s.knexQuery({
action: "insert",
table: "Cloud Videos",
insert: {
mid: e.mid,
ke: e.ke,
time: k.startTime,
status: 1,
details: s.s({
type : 'whcs',
location : saveLocation
}),
size: k.filesize,
end: k.endTime,
href: cloudLink
}
})
s.setCloudDiskUsedForGroup(e,{
amount : k.filesizeMB,
storageType : 'whcs'
@ -159,18 +162,21 @@ module.exports = function(s,config,lang){
s.userLog(e,{type:lang['Wasabi Hot Cloud Storage Upload Error'],msg:err})
}
if(s.group[e.ke].init.whcs_log === '1' && data && data.Location){
var save = [
queryInfo.mid,
queryInfo.ke,
queryInfo.time,
s.s({
type : 'whcs',
location : saveLocation,
}),
queryInfo.size,
data.Location
]
s.sqlQuery('INSERT INTO `Cloud Timelapse Frames` (mid,ke,time,details,size,href) VALUES (?,?,?,?,?,?)',save)
s.knexQuery({
action: "insert",
table: "Cloud Timelapse Frames",
insert: {
mid: queryInfo.mid,
ke: queryInfo.ke,
time: queryInfo.time,
details: s.s({
type : 'whcs',
location : saveLocation
}),
size: queryInfo.size,
href: data.Location
}
})
s.setCloudDiskUsedForGroup(e,{
amount : s.kilobyteToMegabyte(queryInfo.size),
storageType : 'whcs'

View File

@ -81,23 +81,26 @@ module.exports = function(s,config,lang){
fs.createReadStream(k.dir + k.filename).pipe(wfs.createWriteStream(webdavUploadDir + k.filename))
if(s.group[e.ke].init.webdav_log === '1'){
var webdavRemoteUrl = s.addUserPassToUrl(s.checkCorrectPathEnding(s.group[e.ke].init.webdav_url),s.group[e.ke].init.webdav_user,s.group[e.ke].init.webdav_pass) + s.group[e.ke].init.webdav_dir + e.ke + '/'+e.mid+'/'+k.filename
var save = [
e.mid,
e.ke,
k.startTime,
1,
s.s({
type : 'webdav',
location : webdavUploadDir + k.filename
}),
k.filesize,
k.endTime,
webdavRemoteUrl
]
s.sqlQuery('INSERT INTO `Cloud Videos` (mid,ke,time,status,details,size,end,href) VALUES (?,?,?,?,?,?,?,?)',save)
s.knexQuery({
action: "insert",
table: "Cloud Videos",
insert: {
mid: e.mid,
ke: e.ke,
time: k.startTime,
status: 1,
details: s.s({
type : 'webdav',
location : webdavUploadDir + k.filename
}),
size: k.filesize,
end: k.endTime,
href: webdavRemoteUrl
}
})
s.setCloudDiskUsedForGroup(e,{
amount : k.filesizeMB,
storageType : 'webdav'
amount: k.filesizeMB,
storageType: 'webdav'
})
s.purgeCloudDiskForGroup(e,'webdav')
}