Merge pull request #793 from gpodder/remove-advertise
[mygpo.git] / mygpo / search / json.py
blob2286040bad40e5e6a4636960a18de263202ff1de
1 """ Converts models to a JSON representation """
4 def podcast_to_json(podcast):
5 """Convert a podcast to JSON for indexing"""
6 doc = {
7 "title": podcast.title,
8 "subtitle": podcast.subtitle,
9 "description": podcast.description,
10 "link": podcast.link,
11 "language": podcast.language,
12 "last_update": podcast.last_update,
13 "created": podcast.created,
14 # modified is not indexed
15 "license": podcast.license, # maybe get a license name here?
16 # flattr_url
17 "content_types": list(filter(None, podcast.content_types)),
18 "outdated": podcast.outdated,
19 "author": podcast.author,
20 "logo_url": podcast.logo_url,
21 # group, group_member_name ???
22 "subscribers": podcast.subscribers,
23 # restrictions ?
24 # common_episode_title
25 # new_location
26 "latest_episode_timestamp": podcast.latest_episode_timestamp,
27 "episode_count": podcast.episode_count,
28 # hub
29 "twitter": podcast.twitter,
30 # update_interval
31 "slugs": [s.slug for s in podcast.slugs.all()],
32 "urls": [u.url for u in podcast.urls.all()],
35 return doc