Improved StashDB import tool entity argument handling.
This commit is contained in:
parent
aa1a5bd95d
commit
6a5bb6a0f8
|
|
@ -89,10 +89,10 @@ async function curateData(data) {
|
||||||
.leftJoin('entities', 'entities.id', 'releases.entity_id')
|
.leftJoin('entities', 'entities.id', 'releases.entity_id')
|
||||||
.leftJoin('entities as parents', 'parents.id', 'entities.parent_id')
|
.leftJoin('entities as parents', 'parents.id', 'entities.parent_id')
|
||||||
.modify((builder) => {
|
.modify((builder) => {
|
||||||
if (args.channel.charAt(0) === '_') {
|
if (args.network) {
|
||||||
builder.where('parents.slug', args.entity.slice(1));
|
builder.where('parents.slug', args.network);
|
||||||
} else {
|
} else {
|
||||||
builder.where('entities.slug', args.entity);
|
builder.where('entities.slug', args.channel);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.whereIn('entry_id', stashScenes.map((scene) => scene.entryId || scene.urlId));
|
.whereIn('entry_id', stashScenes.map((scene) => scene.entryId || scene.urlId));
|
||||||
|
|
@ -133,6 +133,14 @@ async function curateData(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
|
if (!args.studioId) {
|
||||||
|
throw new Error('No StashDB studio ID specified');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!args.network && !args.channel) {
|
||||||
|
throw new Error('No traxxx channel or network specified');
|
||||||
|
}
|
||||||
|
|
||||||
const res = await unprint.post('https://stashdb.org/graphql', {
|
const res = await unprint.post('https://stashdb.org/graphql', {
|
||||||
operationName: 'Scenes',
|
operationName: 'Scenes',
|
||||||
query,
|
query,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue