Skip to content

Commit

Permalink
feat: Add crossplatform to snapshot conversion (#315)
Browse files Browse the repository at this point in the history
* Added --crossplatform to snapshot conversion

* Fix world conversion
  • Loading branch information
dalkia authored Aug 29, 2023
1 parent e9f80ac commit cf847ee
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/commands/queue-ab-conversion-snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import arg from "arg"
import { fetch } from "undici"
import { CliError } from "../bin"
import { assert } from "../helpers/assert"
import { queueConversion } from "../helpers/asset-bundles"
import { queueConversions} from "../helpers/asset-bundles"
import { StringDecoder } from "string_decoder"

// PROCESS AN ENTIRE SNAPSHOT
Expand All @@ -16,13 +16,23 @@ export default async () => {
"--start-date": String,
"--grep": String,
"--ab-server": String,
"--token": String
"--token": String,
"--crossplatform": Boolean,
})

const snapshot = args["--snapshot"] || 'wearable'
const token = args["--token"]!
const abServer = args["--ab-server"] || "https://asset-bundle-converter.decentraland.org"

const crossplatform = args["--crossplatform"] || false
const abServers = crossplatform
? [
"https://asset-bundle-converter.decentraland.org",
"https://asset-bundle-converter-windows.decentraland.org",
"https://asset-bundle-converter-mac.decentraland.org",
]
: [abServer]

assert(!!snapshot, "--snapshot is missing")
assert(!!token, "--token is missing")

Expand All @@ -36,7 +46,7 @@ export default async () => {
if (snapshot == "worlds")
{
console.log(`Processing worlds`)
await processWorlds(abServer, token);
await processWorlds(abServers, token);
console.log(`Finished!`)
return;
}
Expand Down Expand Up @@ -97,7 +107,7 @@ export default async () => {
}

if (startDate <= entity.entityTimestamp && entity.entityType == snapshot) {
await queueConversion(abServer, {
await queueConversions(abServers, {
entity: {
entityId: entity.entityId, authChain: [
{
Expand All @@ -120,7 +130,7 @@ export default async () => {
console.log(`Finished!`)
}

const processWorlds = async (abServer : string, token:string ) => {
const processWorlds = async (abServers : string[], token:string ) => {
const worldsIndexUrl = 'https://worlds-content-server.decentraland.org/index'
const worldsContentUrl = 'https://worlds-content-server.decentraland.org/'

Expand All @@ -144,7 +154,7 @@ const processWorlds = async (abServer : string, token:string ) => {

console.log(`> [${percent}%]`, name, scene.id)

await queueConversion(abServer, {
await queueConversions(abServers, {
entity: {
entityId: scene.id, authChain: [
{
Expand Down

0 comments on commit cf847ee

Please sign in to comment.