2024-04-27 07:50:22 +00:00
|
|
|
import json
|
|
|
|
import random
|
2024-04-30 01:05:28 +00:00
|
|
|
from .models import Picture
|
|
|
|
|
|
|
|
pics=Picture.objects.order_by("?")
|
2024-04-27 07:50:22 +00:00
|
|
|
|
2024-04-30 05:09:31 +00:00
|
|
|
def get_random_picture_url():
|
2024-04-30 05:40:39 +00:00
|
|
|
return "https://cdn.clf3.org/tianyi-random/"+pics[0].name+".webp"
|
|
|
|
def get_random_picture_meta():
|
|
|
|
return {
|
|
|
|
"name":pics[0].name,
|
|
|
|
"description":pics[0].description,
|
|
|
|
"author":pics[0].author,
|
|
|
|
"author_url":pics[0].author_url,
|
|
|
|
"original_url":pics[0].original_url
|
|
|
|
}
|