Skip to content

Commit

Permalink
fix: re-add rating in danbooru.js script (#3276)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddyall-1 authored Sep 10, 2024
1 parent 4a4612b commit bd314e4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/docs/commands/danbooru.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ async function createPost(id, tags, rating, source) {
const form = new FormData();
form.append("upload_media_asset_id", id);
form.append("post[tag_string]", tags);
//form.append("post[rating]", rating.substring(0, 1).toUpperCase());
//g, s, q, or e
form.append("post[rating]", rating.charAt(0).toLowerCase());
form.append("post[source]", source);

const response = await axios.post("posts.json", form, { headers: form.getHeaders() });
Expand All @@ -67,9 +68,13 @@ async function createPost(id, tags, rating, source) {
axios.defaults.headers.common["Accept"] = "application/json";

// Create post
await new Promise(r => setTimeout(r, 1));
const uploadId = await createUpload(argv[3]);
await new Promise(r => setTimeout(r, 1));
const mediaAssetId = await getUploadMediaAssetId(uploadId);
await new Promise(r => setTimeout(r, 1));
const postId = await createPost(mediaAssetId, argv[0], argv[1], argv[2]);
await new Promise(r => setTimeout(r, 1));

// Open browser
if (OPEN_BROWSER) {
Expand Down

0 comments on commit bd314e4

Please sign in to comment.