-
Notifications
You must be signed in to change notification settings - Fork 1
/
vmotionplayer.py
94 lines (71 loc) · 1.58 KB
/
vmotionplayer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
from Tkinter import *
import os
import pygame
import tkFileDialog
import numpy as np
import time
master = Tk()
master.minsize(360,70)
master.title("vmotion")
trkno = 0
songs = []
pygame.init()
dir = "/home/crypto/Music"
os.chdir(dir)
for i in os.listdir(dir):
if i.endswith(".mp3"):
songs.append(i)
print songs
pygame.mixer.init()
pygame.mixer.music.load(songs[0])
def play():
global trkname
global trkno
global pi
if pi==0:
pygame.mixer.music.play()
trkname.set((str(songs[trkno])).replace(".mp3",""))
else:
pygame.mixer.music.unpause()
def stop():
global pi
pygame.mixer.music.pause()
pi=1
def nexttrk():
global trkname
global trkno
global songs
trkno += 1
pygame.mixer.music.load(songs[trkno])
pygame.mixer.music.play()
trkname.set((str(songs[trkno])).replace(".mp3",""))
def prevtrk():
global trkname
global trkno
global songs
trkno -= 1
pygame.mixer.music.load(songs[trkno])
pygame.mixer.music.play()
trkname.set((str(songs[trkno])).replace(".mp3",""))
def voli():
global vol
vol=pygame.mixer.music.get_volume()
vol += 0.1
if vol>=0.9921875:
vol = 0.9921875
pygame.mixer.music.set_volume(vol)
def vold():
global vol
vol=pygame.mixer.music.get_volume()
vol -= 0.1
if vol<0:
vol = 0.0
pygame.mixer.music.set_volume(vol)
pi = 0
vol = 1
trkname=StringVar()
play()
print "Done"
time.sleep(5000)
nexttrk()
master.mainloop()