From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.0.0.0/16 X-Spam-Status: No, score=-3.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 098FF1F576 for ; Tue, 30 Jan 2018 09:17:31 +0000 (UTC) Received: from localhost ([::1]:51716 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egS2k-0002mT-AX for e@80x24.org; Tue, 30 Jan 2018 04:17:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egS2d-0002l1-5J for dtas-all@nongnu.org; Tue, 30 Jan 2018 04:17:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1egS2c-0003Qs-8r for dtas-all@nongnu.org; Tue, 30 Jan 2018 04:17:23 -0500 Received: from dcvr.yhbt.net ([64.71.152.64]:59076) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1egS2c-0003QL-2M for dtas-all@nongnu.org; Tue, 30 Jan 2018 04:17:22 -0500 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 3FEDB1FAE3 for ; Tue, 30 Jan 2018 09:17:14 +0000 (UTC) From: Eric Wong To: dtas-all@nongnu.org Subject: [PATCH 2/4] mlib: remove redundant tag massaging and encoding Date: Tue, 30 Jan 2018 09:17:10 +0000 Message-Id: <20180130091712.21755-3-e@80x24.org> In-Reply-To: <20180130091712.21755-1-e@80x24.org> References: <20180130091712.21755-1-e@80x24.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.71.152.64 X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: duct tape audio suite List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+e=80x24.org@nongnu.org Sender: "dtas-all" Redundant since ("player: support guessing encodings for comments") --- lib/dtas/mlib.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/dtas/mlib.rb b/lib/dtas/mlib.rb index e217b59..d1707fb 100644 --- a/lib/dtas/mlib.rb +++ b/lib/dtas/mlib.rb @@ -106,18 +106,10 @@ def worker_work(job) return ignore(job) if tlen < 0 tlen = tlen.round tmp = {} - found.comments.each do |tag, value| - tag_id = @tag_map[tag] or next - value.strip! - - # FIXME: this fallback needs testing - [ Encoding::UTF_8, Encoding::ISO_8859_1 ].each do |enc| - value.force_encoding(enc) - if value.valid_encoding? - value.encode!(Encoding::UTF_8) if enc != Encoding::UTF_8 - tmp[tag_id] = value - break - end + if comments = found.comments + comments.each do |tag, value| + tag_id = @tag_map[tag] or next + tmp[tag_id] = value if value.valid_encoding? end end @db.transaction do -- EW