Update e621 JSON format.

This commit is contained in:
Syfaro 2020-04-06 19:51:20 -05:00
parent 95b0ec910b
commit 86c8037745

View File

@ -84,17 +84,17 @@ pub fn image_query_sync(
hashes.twitter_id, hashes.twitter_id,
CASE CASE
WHEN furaffinity_id IS NOT NULL THEN (f.url) WHEN furaffinity_id IS NOT NULL THEN (f.url)
WHEN e621_id IS NOT NULL THEN (e.data->>'file_url') WHEN e621_id IS NOT NULL THEN (e.data->'file'->>'url')
WHEN twitter_id IS NOT NULL THEN (tm.url) WHEN twitter_id IS NOT NULL THEN (tm.url)
END url, END url,
CASE CASE
WHEN furaffinity_id IS NOT NULL THEN (f.filename) WHEN furaffinity_id IS NOT NULL THEN (f.filename)
WHEN e621_id IS NOT NULL THEN ((e.data->>'md5') || '.' || (e.data->>'file_ext')) WHEN e621_id IS NOT NULL THEN ((e.data->'file'->>'md5') || '.' || (e.data->'file'->>'ext'))
WHEN twitter_id IS NOT NULL THEN (SELECT split_part(split_part(tm.url, '/', 5), ':', 1)) WHEN twitter_id IS NOT NULL THEN (SELECT split_part(split_part(tm.url, '/', 5), ':', 1))
END filename, END filename,
CASE CASE
WHEN furaffinity_id IS NOT NULL THEN (ARRAY(SELECT f.name)) WHEN furaffinity_id IS NOT NULL THEN (ARRAY(SELECT f.name))
WHEN e621_id IS NOT NULL THEN ARRAY(SELECT jsonb_array_elements_text(e.data->'artist')) WHEN e621_id IS NOT NULL THEN ARRAY(SELECT jsonb_array_elements_text(e.data->'tags'->'artist'))
WHEN twitter_id IS NOT NULL THEN ARRAY(SELECT tw.data->'user'->>'screen_name') WHEN twitter_id IS NOT NULL THEN ARRAY(SELECT tw.data->'user'->>'screen_name')
END artists, END artists,
CASE CASE