history.py 974 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import sys
  2. from plugins.plugin import Plugin
  3. sys.path.append("..")
  4. from src.video import Video
  5. from src.config import Config
  6. from src.history import History
  7. class PHistory(Plugin):
  8. def __init__(self, history: History=History(), config: Config=Config()) -> None:
  9. super().__init__(history, config)
  10. self.history = history
  11. self.config = config
  12. self.name = "[+] History"
  13. self.category = "History"
  14. self.query_description = """"""
  15. self.params = {}
  16. self.flag = "-h"
  17. self.full_flag = "--history"
  18. self.flag_help = "show roseng history list"
  19. self.flag_action = "store_true"
  20. self.config = Config()
  21. def get_history(self):
  22. videos = list()
  23. for video in self.history.video_list:
  24. video.isWatched = True
  25. videos.append(video.to_json())
  26. return videos
  27. def get_items(self, params):
  28. return self.get_history()