-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmusic.py
72 lines (49 loc) · 1.52 KB
/
music.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
import os
import assistant_details as ad
music_path = "D:/music/"
def play_music():
if ad.is_ubuntu():
os.system("rhythmbox-client --play")
return "Playing Music"
else:
#windows code
return "For windows its not available it"
def pause_music():
if ad.is_ubuntu():
os.system("rhythmbox-client --pause")
return "Music paused"
else:
#windows code
return "For windows its not available it"
def stop_music():
if ad.is_ubuntu():
os.system("rhythmbox-client --stop")
return "Music stopped"
else:
return "Not available for windows yet"
def next_song():
if ad.is_ubuntu():
os.system("rhythmbox-client --next")
return "Playing next song"
else:
return "not availble for windows yet"
def previous_song():
if ad.is_ubuntu():
os.system("rhythmbox-client --previous")
return "Playing previous song"
else:
return "not availble for windows yet"
def play_specific_song(song_name : str):
song_name = song_name.replace('play', '')
if ad.is_ubuntu():
file_search.set_root(music_path)
songs = file_search.searchFile(song_name)
try:
song_uri = songs[0]
command = 'rhythmbox-client --play-uri="' + song_uri + '"'
os.system(command)
return "playing " + song_name
except:
return "song not found in your computer"
else:
return "not availble for windows yet"