|
@@ -1,55 +0,0 @@
|
|
-#!/usr/bin/env python3
|
|
|
|
-#
|
|
|
|
-# mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
|
|
|
|
-# Copyright (C)2013-2020 The MMGen Project <mmgen@tuta.io>
|
|
|
|
-#
|
|
|
|
-# This program is free software: you can redistribute it and/or modify
|
|
|
|
-# it under the terms of the GNU General Public License as published by
|
|
|
|
-# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
-# (at your option) any later version.
|
|
|
|
-#
|
|
|
|
-# This program is distributed in the hope that it will be useful,
|
|
|
|
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
-# GNU General Public License for more details.
|
|
|
|
-#
|
|
|
|
-# You should have received a copy of the GNU General Public License
|
|
|
|
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
-#
|
|
|
|
-"""
|
|
|
|
-mmnode-play-sound: play a sound with controlled volume
|
|
|
|
-"""
|
|
|
|
-
|
|
|
|
-import sys
|
|
|
|
-from mmgen.common import *
|
|
|
|
-from mmgen.util import die
|
|
|
|
-from mmgen.node_tools.Sound import *
|
|
|
|
-volume = 100
|
|
|
|
-
|
|
|
|
-opts_data = {
|
|
|
|
- 'text': {
|
|
|
|
- 'desc': 'Play a sound file at controlled volume',
|
|
|
|
- 'usage': '[opts]',
|
|
|
|
- 'options': """
|
|
|
|
--h, --help Print this help message
|
|
|
|
--t, --testing Test, don't execute shell commands
|
|
|
|
--v, --volume= n Adjust sound volume by percentage 'n' (default: {})
|
|
|
|
-""".format(volume)
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-args = opts.init(opts_data)
|
|
|
|
-
|
|
|
|
-if opt.volume:
|
|
|
|
- try:
|
|
|
|
- assert 1 <= int(opt.volume) <= 120
|
|
|
|
- except:
|
|
|
|
- die(1,'Sound volume must be an integer between 1 and 120')
|
|
|
|
-
|
|
|
|
-if len(args) != 1:
|
|
|
|
- die(1,'You must supply a sound file')
|
|
|
|
-
|
|
|
|
-try: os.stat(args[0])
|
|
|
|
-except: die(1,"Couldn't stat file '{}'".format(args[0]))
|
|
|
|
-
|
|
|
|
-play_sound(args[0],int(opt.volume),testing=opt.testing)
|
|
|