Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #Запустить музызку из каталога
  2. elif cmd == 'cmusic':
  3. def createPlaylist():
  4. folder = ("C://Users//Black//Downloads//1")
  5. playlist = glob.glob(folder + "/*.mp3")
  6.  
  7. if len(playlist) == 0:
  8. print("No recognisable MP3 files in ", folder)
  9. return playlist
  10.  
  11. Instance = vlc.Instance('--input-repeat=999999', '--no-video-title-show', '--mouse-hide-timeout=5000')
  12. a = 0
  13. playlist = createPlaylist()
  14.  
  15. while True:
  16. if a == len(playlist):
  17. a = 0
  18. playlist = createPlaylist()
  19. print("Media folder contains ", len(playlist), "MP3 files\n")
  20.  
  21. player = Instance.media_player_new()
  22. player.set_fullscreen(True)
  23. MusicVideo = Instance.media_new(playlist[a])
  24. player.set_media(MusicVideo)
  25. player.play()
  26.  
  27. time.sleep(1.5)
  28. duration = player.get_length() / 1000
  29. dwell = duration - 1.5
  30. time.sleep(dwell)
  31. player.stop()
  32. a += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement