settings.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. from kddit import app
  2. ROOT = app.config["kddit.root"]
  3. TIMESHIFT = int(app.config["kddit.timeshift"])
  4. PROXY_ALLOW = {
  5. "image": [
  6. "preview.redd.it",
  7. "i.redd.it",
  8. "v.redd.it",
  9. "b.thumbs.redditmedia.com",
  10. "society.kalli.st",
  11. "i.kalli.st",
  12. "preview.redd.it",
  13. "emoji.redditmedia.com",
  14. "www.redditstatic.com",
  15. "external-preview.redd.it",
  16. ],
  17. "video": [
  18. "v.redd.it",
  19. ],
  20. }
  21. DEFAULT_OPTION = "hot"
  22. SUBREDDIT_OPTIONS = ["hot", "new", "top", "rising", "controversial"]
  23. USER_OPTIONS = ["overview", "comments", "submitted"]
  24. USER_SORT = ["hot", "new", "top", "controversial"]
  25. SEARCH_SORT = ["relevance", "top", "new", "comments"]
  26. EXPANDED_OPTIONS = ["top", "controversial"]
  27. TIME_OPTIONS = {
  28. "hour": "now",
  29. "day": "today",
  30. "week": "this week",
  31. "month": "this month",
  32. "year": "this year",
  33. "all": "all time"
  34. }
  35. SAFE_SUBS = ["all", "random"]
  36. FILE_PATH = f"{ROOT}/videos/"
  37. UA = app.config.get("user_agent") or "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
  38. HEADERS = {
  39. "User-Agent": UA
  40. }
  41. YDL_OPTS = {
  42. 'format': 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4',
  43. 'merge-output-format': 'mp4',
  44. 'outtmpl': FILE_PATH + '%(id)s.%(ext)s'
  45. }
  46. CLIENT_ID = app.config.get("kddit.client_id")
  47. CLIENT_SECRET = app.config.get("kddit.client_secret")
  48. if (CLIENT_SECRET and CLIENT_ID):
  49. URL = "https://oauth.reddit.com"
  50. else:
  51. URL = "https://old.reddit.com"