Archived
7 lines
307 B
Python
7 lines
307 B
Python
def media_url(v, kind="thumb"):
|
|
key = {"video": "optimized_path", "source": "download_path",
|
|
"poster": "poster_path", "thumb": "thumb_path",
|
|
"preview": "preview_path"}.get(kind, "thumb_path")
|
|
if not v or not v.get(key):
|
|
return None
|
|
return f"/media/{v['id']}/{kind}" |