Advertisement
Guest User

Untitled

a guest
Jun 4th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. try:
  2. current_file = self.player.getPlayingFile()
  3. except RuntimeError as exc:
  4. if 'not playing any' in str(exc):
  5. self.log('No file is playing - stop up next tracking', 2)
  6. self.player.disable_tracking()
  7. continue
  8. raise
  9. self.log('Failed getPlayingFile: No file is playing - stop up next tracking', 2)
  10. self.player.disable_tracking()
  11. continue
  12.  
  13. if last_file and last_file == current_file:
  14. continue
  15.  
  16. total_time = self.player.getTotalTime()
  17. try:
  18. total_time = self.player.getTotalTime()
  19. except RuntimeError as exc:
  20. self.log('Failed getTotalTime: No file is playing - stop up next tracking', 2)
  21. self.player.disable_tracking()
  22. continue
  23.  
  24. if total_time == 0:
  25. continue
  26.  
  27. play_time = self.player.getTime()
  28. try:
  29. play_time = self.player.getTime()
  30. except RuntimeError as exc:
  31. self.log('Failed getTime: No file is playing - stop up next tracking', 2)
  32. self.player.disable_tracking()
  33. continue
  34.  
  35. notification_time = self.api.notification_time(total_time=total_time)
  36. if total_time - play_time > notification_time:
  37. continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement