~ctf/checkbox/bug811177

« back to all changes in this revision

Viewing changes to scripts/audio_question

  • Committer: Marc Tardif
  • Date: 2007-10-09 13:30:59 UTC
  • mfrom: (42.1.12 bug-149630)
  • Revision ID: marc.tardif@canonical.com-20071009133059-7mfmzlbwehoq537w
Extended configuration file model to centralize variables in a single location to fix bug #149630.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
 
3
import os
 
4
import sys
3
5
import gnome
4
 
import os
5
 
 
6
 
from hwtest.constants import HWTEST_DIR
7
 
 
8
 
gnome.sound_init("localhost")
9
 
sound_file = os.path.join(HWTEST_DIR, "data", "sound.wav")
10
 
gnome.sound_play(sound_file)
11
 
 
12
 
device = "None"
13
 
path = "/proc/asound/card0/id"
14
 
if os.path.exists(path):
15
 
    fd = file(path, "r")
16
 
    device = fd.readline().strip()
17
 
 
18
 
print device
 
6
 
 
7
 
 
8
def main(args):
 
9
    if len(args) < 1:
 
10
        raise Exception, "Missing sound file as argument."
 
11
 
 
12
    gnome.sound_init("localhost")
 
13
    sound_file = os.path.join(args[0])
 
14
    gnome.sound_play(sound_file)
 
15
 
 
16
    device = "None"
 
17
    path = "/proc/asound/card0/id"
 
18
    if os.path.exists(path):
 
19
        fd = file(path, "r")
 
20
        device = fd.readline().strip()
 
21
 
 
22
    print device
 
23
 
 
24
 
 
25
if __name__ == "__main__":
 
26
    sys.exit(main(sys.argv[1:]))