Skip to content

Commit

Permalink
Main: fix a regression bug with option -play
Browse files Browse the repository at this point in the history
  • Loading branch information
soimort committed Aug 17, 2014
1 parent 1abf553 commit 0ae04cc
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions include/Main.awk
Expand Up @@ -37,7 +37,7 @@ function init() {
Option["width"] = ENVIRON["COLUMNS"] ? ENVIRON["COLUMNS"] : 64

Option["play"] = 0
Option["player"] = ENVIRON["PLAYER"] ? ENVIRON["PLAYER"] : AudioPlayer
Option["player"] = ENVIRON["PLAYER"]

Option["interactive"] = 0
Option["no-rlwrap"] = 0
Expand Down Expand Up @@ -129,10 +129,7 @@ BEGIN {
# -p, -play
match(ARGV[pos], /^--?p(l(ay?)?)?$/)
if (RSTART) {
if (Option["player"] || SpeechSynthesizer)
Option["play"] = 1
else
w("[WARNING] No available audio player or speech synthesizer is found.")
Option["play"] = 1
continue
}

Expand Down Expand Up @@ -302,8 +299,17 @@ BEGIN {

if (Option["play"]) {
# Initialize audio player or speech synthesizer
initAudioPlayer()
if (!AudioPlayer) initSpeechSynthesizer()
if (!Option["player"]) {
initAudioPlayer()
Option["player"] = AudioPlayer ? AudioPlayer : Option["player"]
if (!Option["player"])
initSpeechSynthesizer()
}

if (!Option["player"] && !SpeechSynthesizer) {
w("[WARNING] No available audio player or speech synthesizer is found.")
Option["play"] = 0
}
}

if (pos < ARGC) {
Expand Down

0 comments on commit 0ae04cc

Please sign in to comment.