From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 208.118.235.0/24 X-Spam-Status: No, score=-2.3 required=3.0 tests=AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: dtas-all@80x24.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id B019A1F7FA for ; Sat, 27 Dec 2014 12:03:16 +0000 (UTC) Received: from localhost ([::1]:55720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y4q5U-0001j0-4Y for dtas-all@80x24.org; Sat, 27 Dec 2014 07:03:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y4q5R-0001iP-ML for dtas-all@nongnu.org; Sat, 27 Dec 2014 07:03:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y4q5Q-00066q-Jg for dtas-all@nongnu.org; Sat, 27 Dec 2014 07:03:13 -0500 Received: from dcvr.yhbt.net ([64.71.152.64]:37772) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y4q5Q-00066B-Ep for dtas-all@nongnu.org; Sat, 27 Dec 2014 07:03:12 -0500 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 8CF0A1F7F3; Sat, 27 Dec 2014 12:03:09 +0000 (UTC) From: Eric Wong To: Subject: [PATCH 3/3] player: support "source restart" command Date: Sat, 27 Dec 2014 12:02:58 +0000 Message-Id: <1419681778-6183-4-git-send-email-e@80x24.org> X-Mailer: git-send-email 2.1.2.571.ged78782.dirty In-Reply-To: <1419681778-6183-1-git-send-email-e@80x24.org> References: <1419681778-6183-1-git-send-email-e@80x24.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.71.152.64 Cc: Eric Wong X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+dtas-all=80x24.org@nongnu.org Sender: dtas-all-bounces+dtas-all=80x24.org@nongnu.org This becomes useful for systems without inotify when we're editing YAML (or whatever) files frequently and want changes to be reflected right away during playback. This is a weaker version of the plain "restart" command, which restarts the entire playback chain. --- Documentation/dtas-player_protocol.txt | 12 +++++++++++- lib/dtas/player/client_handler.rb | 6 +++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Documentation/dtas-player_protocol.txt b/Documentation/dtas-player_protocol.txt index b8f8264..ff8f7ae 100644 --- a/Documentation/dtas-player_protocol.txt +++ b/Documentation/dtas-player_protocol.txt @@ -169,7 +169,9 @@ Commands here should be alphabetized according to `LC_ALL=C sort' * restart - restarts all processes in the current pipeline. Playback will be momentarily interrupted while this change occurs. This is necessary if one of the commands (e.g. sox or ecasound) or loaded - libraries (e.g. a LADSPA plugin) is upgraded. + libraries (e.g. a LADSPA plugin) is upgraded. Use "source restart" + instead to only restart the source chain, leaving the sinks + untouched. * rg RGARGS - configure ReplayGain support All FLOAT values may be adjusted via '+=' or '-=' instead of simple @@ -233,6 +235,14 @@ Commands here should be alphabetized according to `LC_ALL=C sort' 1. input type (flac/opus/mp3/etc) 2. transport protocol (local FS/http/ftp/sftp/etc) +* source ls - dump the names of sources sorted by tryorder + +* source restart - restart the current source command + This can be useful if the source file is changed during playback + and the current player process is holding onto an unlinked inode. + This is advantageous over a full "restart" as there is no audible + gap on most systems. + * state dump [FILENAME] Immediately dump the state of the player. If a FILENAME is specified, the state is written to that file. Otherwise, the default state file diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb index 37357f7..35f85c2 100644 --- a/lib/dtas/player/client_handler.rb +++ b/lib/dtas/player/client_handler.rb @@ -463,7 +463,11 @@ module DTAS::Player::ClientHandler # :nodoc: def source_handler(io, msg) map = @source_map op = msg.shift - if op == "ls" + case op + when "restart" + __current_requeue + return io.emit("OK") + when "ls" s = map.keys.sort { |a,b| map[a].tryorder <=> map[b].tryorder } return io.emit(s.join(' ')) end -- EW