m3u.py 591 B

12345678910111213141516171819202122
  1. #!./bin/python3
  2. import os
  3. from handler.filelist import FileListHandler
  4. class M3UHandler(FileListHandler):
  5. def getPlaylistItems(self, item):
  6. path = item["path"]
  7. items = []
  8. with open(path) as f:
  9. for line in f:
  10. item_path = str(line).strip()
  11. if not item_path.startswith("#"):
  12. items.append({
  13. "name" : self.toDisplayName(os.path.basename(item_path)),
  14. "path" : os.path.join(os.path.dirname(path), item_path)
  15. })
  16. return items