mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-03-28 06:17:46 +01: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
|
||||
[
|
||||
Anthro: "Anthro",
|
||||
Feral: "Feral",
|
||||
Cub: "Cub",
|
||||
Adult: "Adult",
|
||||
Human: "Human",
|
||||
"Canon Characters": "Canon Characters",
|
||||
Comics: "Comics",
|
||||
"Fetish Art": "Fetish Art",
|
||||
"Human and EqG": "Human and EqG",
|
||||
BDSM: "BDSM",
|
||||
NSFW: "NSFW",
|
||||
"Original Characters": "Original Characters",
|
||||
"Original Species": "Original Species",
|
||||
Pony: "Pony",
|
||||
Requests: "Requests",
|
||||
Safe: "Safe",
|
||||
Shipping: "Shipping",
|
||||
"Violence and Gore": "Violence and Gore"
|
||||
Violence: "Violence"
|
||||
]
|
||||
end
|
||||
|
||||
|
|
|
@ -15,17 +15,17 @@ defmodule Philomena.Scrapers.Pixiv do
|
|||
submission = json["body"]
|
||||
|
||||
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,
|
||||
author_name: submission["author_details"]["user_account"],
|
||||
description: description,
|
||||
images: [
|
||||
%{
|
||||
url: "#{submission["illust_details"]["manga_a"]["url_big"]}",
|
||||
camo_url: Camo.Image.image_url(submission["illust_details"]["manga_a"]["url"])
|
||||
}
|
||||
]
|
||||
images: images
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue