0

こんにちは、Python を使用して独自のユーザー インターフェイスを作成しています。これで、私は現在 nohup をクリックして mplayer を実行しています (実行中のサーバーを台無しにしないように)。私がやりたいのは、一時停止ボタンを追加することです。

nohupを実行しているときにこれは可能ですか、それともより良い方法がありますか?

とてもしようとしている

os.system("nohup mplayer file.mp3 &")

私が見つけることができる限り一時停止を許可しません。

それから;

os.system("rm /tmp/mplayer")
os.system("mkfifo /tmp/mplayer")
os.system("nohup mplayer -slave -input file=/tmp/mplayer file.mp3 &")

私の一時停止ボタンは、次を使用して作成されます。

os.system("echo pause > /tmp/mplayer") ##click again to unplay

新しい端末に入力すると動作しますが、プレイ中にウェブサーバーを強制終了します。したがって、Webサーバーからは機能しません。

現在、Flask/Python および jinja テンプレートを使用しています。

どうもありがとう

4

1 に答える 1

0

Python から mplayer を制御するためにpython-mplayerラッパーを使用していない特定の理由はありますか? このモジュールは非常に完成度が高く、一時停止を含む再生機能を制御できます。

編集: 非標準の mplayer バイナリの場所のイントロスペクション メソッドを呼び出す必要がある場合があります (公式ページの wiki エントリに基づく.

from mplayer import Player

# First, specify the correct path to the MPlayer executable
Player.exec_path = '/actual/path/to/the/mplayer-bin'

# Then, manually call the introspect() class method
Player.introspect()


# Since autospawn is True by default, no need to call player.spawn() manually
player = Player()

# Play a file
player.loadfile('/path/to/file.mkv')

# Pause playback
player.pause()
于 2014-03-05T14:38:31.583 に答える