settings.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. USER_COMMENT_SORT = ["best", "top", "new", "controversial", "old"]
  27. EXPANDED_OPTIONS = ["top", "controversial"]
  28. TIME_OPTIONS = {
  29. "hour": "now",
  30. "day": "today",
  31. "week": "this week",
  32. "month": "this month",
  33. "year": "this year",
  34. "all": "all time"
  35. }
  36. SAFE_SUBS = ["all", "random"]
  37. FILE_PATH = f"{ROOT}/videos/"
  38. 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"
  39. HEADERS = {
  40. "User-Agent": UA
  41. }
  42. YDL_OPTS = {
  43. 'format': 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4',
  44. 'merge-output-format': 'mp4',
  45. 'outtmpl': FILE_PATH + '%(id)s.%(ext)s'
  46. }
  47. CLIENT_ID = app.config.get("kddit.client_id")
  48. CLIENT_SECRET = app.config.get("kddit.client_secret")
  49. if (CLIENT_SECRET and CLIENT_ID):
  50. URL = "https://oauth.reddit.com"
  51. else:
  52. URL = "https://old.reddit.com"