compress_voice_ids.py 742 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #EDIT THIS: Put voice IDs here
  2. VOICE_IDS = []
  3. RESULT = []
  4. id_start = 0
  5. prev = 0
  6. running_ids = False
  7. for i in sorted(VOICE_IDS):
  8. if not running_ids:
  9. running_ids = True
  10. id_start = i
  11. prev = i
  12. if running_ids and (i - prev > 1):
  13. if prev - id_start > 0:
  14. RESULT.append([id_start, prev])
  15. else:
  16. RESULT.append(prev)
  17. id_start = i
  18. prev = i
  19. if prev - id_start > 0:
  20. RESULT.append([id_start, prev])
  21. else:
  22. RESULT.append(prev)
  23. print(RESULT)
  24. FLATTED = []
  25. for item in RESULT:
  26. if isinstance(item, list):
  27. for i in item:
  28. FLATTED.append(i)
  29. else:
  30. FLATTED.append(item)
  31. print(f"Original: {len(VOICE_IDS)}; Minified: {len(FLATTED)}")