mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-03-31 00:37:45 +02:00
Customized commission categories
This commit is contained in:
parent
76b794184d
commit
431e99aea1
3 changed files with 44 additions and 15 deletions
31
lib/philomena/channels/pomf_channel.ex
Normal file
31
lib/philomena/channels/pomf_channel.ex
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
defmodule Philomena.Channels.PomfChannel do
|
||||||
|
@api_online "https://pomf.tv/api/streams/getinfo.php?data=onlinestreams"
|
||||||
|
|
||||||
|
@spec live_channels(DateTime.t()) :: map()
|
||||||
|
def live_channels(now) do
|
||||||
|
@api_online
|
||||||
|
|> Philomena.Http.get()
|
||||||
|
|> case do
|
||||||
|
{:ok, %Tesla.Env{body: body, status: 200}} ->
|
||||||
|
body
|
||||||
|
|> Jason.decode!()
|
||||||
|
|> Map.new(&{&1["onlinelist"], fetch(&1, now)})
|
||||||
|
|
||||||
|
_error ->
|
||||||
|
%{}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp fetch(api, now) do
|
||||||
|
%{
|
||||||
|
title: api["streamtitle"],
|
||||||
|
is_live: true,
|
||||||
|
nsfw: true,
|
||||||
|
viewers: api["viewers"],
|
||||||
|
thumbnail_url: api["profileimage"],
|
||||||
|
last_fetched_at: now,
|
||||||
|
last_live_at: now,
|
||||||
|
description: api["streamdesc"]
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
|
@ -55,18 +55,16 @@ defmodule Philomena.Commissions.Commission do
|
||||||
def categories do
|
def categories do
|
||||||
[
|
[
|
||||||
Anthro: "Anthro",
|
Anthro: "Anthro",
|
||||||
|
Feral: "Feral",
|
||||||
|
Cub: "Cub",
|
||||||
|
Adult: "Adult",
|
||||||
|
Human: "Human",
|
||||||
"Canon Characters": "Canon Characters",
|
"Canon Characters": "Canon Characters",
|
||||||
Comics: "Comics",
|
BDSM: "BDSM",
|
||||||
"Fetish Art": "Fetish Art",
|
|
||||||
"Human and EqG": "Human and EqG",
|
|
||||||
NSFW: "NSFW",
|
NSFW: "NSFW",
|
||||||
"Original Characters": "Original Characters",
|
|
||||||
"Original Species": "Original Species",
|
|
||||||
Pony: "Pony",
|
Pony: "Pony",
|
||||||
Requests: "Requests",
|
|
||||||
Safe: "Safe",
|
|
||||||
Shipping: "Shipping",
|
Shipping: "Shipping",
|
||||||
"Violence and Gore": "Violence and Gore"
|
Violence: "Violence"
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -15,17 +15,17 @@ defmodule Philomena.Scrapers.Pixiv do
|
||||||
submission = json["body"]
|
submission = json["body"]
|
||||||
|
|
||||||
description = submission["illust_details"]["comment"]
|
description = submission["illust_details"]["comment"]
|
||||||
|
images = for x <- submission["illust_details"]["manga_a"] do
|
||||||
|
%{
|
||||||
|
url: "#{x["url_big"]}",
|
||||||
|
camo_url: Camo.Image.image_url(x["url"])
|
||||||
|
}
|
||||||
|
end
|
||||||
%{
|
%{
|
||||||
source_url: url,
|
source_url: url,
|
||||||
author_name: submission["author_details"]["user_account"],
|
author_name: submission["author_details"]["user_account"],
|
||||||
description: description,
|
description: description,
|
||||||
images: [
|
images: images
|
||||||
%{
|
|
||||||
url: "#{submission["illust_details"]["manga_a"]["url_big"]}",
|
|
||||||
camo_url: Camo.Image.image_url(submission["illust_details"]["manga_a"]["url"])
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue