Chore: script to move images from imgur to panoramax
This commit is contained in:
parent
6e335c91d4
commit
dcfa829e1a
3 changed files with 12 additions and 10 deletions
|
@ -111,9 +111,9 @@ export class ImgurToPanoramax extends Script {
|
||||||
console.log("Writing fallback to", fallbackpath)
|
console.log("Writing fallback to", fallbackpath)
|
||||||
writeFileSync(fallbackpath, JSON.stringify(raw), "utf8")
|
writeFileSync(fallbackpath, JSON.stringify(raw), "utf8")
|
||||||
})
|
})
|
||||||
console.log("Got license via API:", attr.licenseShortName)
|
console.log("Got license via API:", attr?.licenseShortName)
|
||||||
await ScriptUtils.sleep(500)
|
await ScriptUtils.sleep(500)
|
||||||
if (attr.licenseShortName) {
|
if (attr?.licenseShortName) {
|
||||||
return attr
|
return attr
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
|
@ -235,12 +235,12 @@ export class ImgurToPanoramax extends Script {
|
||||||
|
|
||||||
const bounds = new BBox([
|
const bounds = new BBox([
|
||||||
[
|
[
|
||||||
1.7217767788980893,
|
4.025057189545606,
|
||||||
41.00219164121438
|
49.588777455920024
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
2.7238939148245436,
|
-16.063346185815476,
|
||||||
41.9258679932085
|
61.187350355346894
|
||||||
]
|
]
|
||||||
])
|
])
|
||||||
const maxcount = 10000
|
const maxcount = 10000
|
||||||
|
@ -270,7 +270,7 @@ export class ImgurToPanoramax extends Script {
|
||||||
}
|
}
|
||||||
|
|
||||||
let changedTags: (UploadableTag | undefined)[] = []
|
let changedTags: (UploadableTag | undefined)[] = []
|
||||||
console.log("Handling "+f.properties.id)
|
console.log(converted+"/"+total, " handling "+f.properties.id)
|
||||||
for (const k of ["image", "image:menu", "image:streetsign"]) {
|
for (const k of ["image", "image:menu", "image:streetsign"]) {
|
||||||
changedTags.push(await this.uploadImage(k, f))
|
changedTags.push(await this.uploadImage(k, f))
|
||||||
for (let i = 0; i < 20; i++) {
|
for (let i = 0; i < 20; i++) {
|
||||||
|
|
|
@ -88,7 +88,7 @@ export default class GenerateImageAnalysis extends Script {
|
||||||
if (image === undefined) {
|
if (image === undefined) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (!image.match(/https:\/\/i\.imgur\.com\/[a-zA-Z0-9]+\.jpg/)) {
|
if (!image.match(/https:\/\/i\.imgur\.com\/[a-zA-Z0-9]+(\.jpe?g)|(\.png)/)) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
const filename = image.replace(/[\/:.\-%]/g, "_") + ".json"
|
const filename = image.replace(/[\/:.\-%]/g, "_") + ".json"
|
||||||
|
|
|
@ -106,8 +106,10 @@ export class Imgur extends ImageProvider {
|
||||||
|
|
||||||
const imgurData = response.data
|
const imgurData = response.data
|
||||||
const license= Imgur.parseLicense(imgurData.description ?? "")
|
const license= Imgur.parseLicense(imgurData.description ?? "")
|
||||||
|
if(license){
|
||||||
license.views = imgurData.views
|
license.views = imgurData.views
|
||||||
license.date = new Date(Number(imgurData.datetime) * 1000)
|
license.date = new Date(Number(imgurData.datetime) * 1000)
|
||||||
|
}
|
||||||
|
|
||||||
return license
|
return license
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue