From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Dec 5 21:20:01 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 303E2430 for ; Thu, 5 Dec 2013 21:20:01 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0ACC61D1C for ; Thu, 5 Dec 2013 21:20:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id rB5LK0gP033538 for ; Thu, 5 Dec 2013 21:20:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id rB5LK0TG033525; Thu, 5 Dec 2013 21:20:00 GMT (envelope-from gnats) Resent-Date: Thu, 5 Dec 2013 21:20:00 GMT Resent-Message-Id: <201312052120.rB5LK0TG033525@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Arseny Nasokin Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5CD7E3D2 for ; Thu, 5 Dec 2013 21:14:48 +0000 (UTC) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3D6851CF9 for ; Thu, 5 Dec 2013 21:14:48 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rB5LEmVb065917 for ; Thu, 5 Dec 2013 21:14:48 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rB5LElAJ065800; Thu, 5 Dec 2013 21:14:47 GMT (envelope-from nobody) Message-Id: <201312052114.rB5LElAJ065800@oldred.freebsd.org> Date: Thu, 5 Dec 2013 21:14:47 GMT From: Arseny Nasokin To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: ports/184524: [PATCH] RPC sugar for transmission-cli and daemon X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2013 21:20:01 -0000 >Number: 184524 >Category: ports >Synopsis: [PATCH] RPC sugar for transmission-cli and daemon >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Dec 05 21:20:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Arseny Nasokin >Release: FreeBSD 11-CURRENT >Organization: private person >Environment: >Description: I want to share my RPC sugar patch I use for years. It adds several categories for torrent files filtered inside libtransmission, because client (e.g. transmission-remote in my case) don't have enough information. >How-To-Repeat: >Fix: Patch attached with submission follows: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # rpc-sugar # Makefile.patch # echo x - rpc-sugar sed 's/^X//' >rpc-sugar << 'END-of-rpc-sugar' XIndex: libtransmission/rpcimpl.c X=================================================================== X--- libtransmission/rpcimpl.c (revision 14215) X+++ libtransmission/rpcimpl.c (working copy) X@@ -160,7 +160,7 @@ X } X else if (tr_variantDictFindStr (args, TR_KEY_ids, &str, NULL)) X { X- if (!strcmp (str, "recently-active")) X+ if (!strcmp (str, "recently-active")) /* Torrents with last activity in RECENTLY_ACTIVE_SECONDS */ X { X tr_torrent * tor = NULL; X const time_t now = tr_time (); X@@ -171,6 +171,147 @@ X if (tor->anyDate >= now - window) X torrents[torrentCount++] = tor; X } X+ else if (!strcmp (str, "running")) /* Currently active torrents. */ X+ { X+ tr_torrent * tor = NULL; X+ const int n = tr_sessionCountTorrents (session); X+ torrents = tr_new0 (tr_torrent *, n); X+ while ((tor = tr_torrentNext (session, tor))) X+ { X+ const tr_torrent_activity activity = tr_torrentGetActivity (tor); X+ if (activity != TR_STATUS_STOPPED && activity != TR_STATUS_CHECK && \ X+ activity != TR_STATUS_CHECK_WAIT) X+ torrents[torrentCount++] = tor; X+ } X+ } X+ else if (!strcmp (str, "paused")) /* Not finished and stopped torrents */ X+ { X+ tr_torrent * tor = NULL; X+ const int n = tr_sessionCountTorrents (session); X+ torrents = tr_new0 (tr_torrent *, n); X+ while ((tor = tr_torrentNext (session, tor))) X+ if (tr_torrentGetActivity (tor) == TR_STATUS_STOPPED && \ X+ tr_torrentGetCompleteness(tor) != TR_SEED) X+ torrents[torrentCount++] = tor; X+ } X+ else if (!strcmp (str, "stopped")) /* Finished and stopped torrents */ X+ { X+ tr_torrent * tor = NULL; X+ const int n = tr_sessionCountTorrents (session); X+ torrents = tr_new0 (tr_torrent *, n); X+ while ((tor = tr_torrentNext (session, tor))) X+ if (tr_torrentGetActivity (tor) == TR_STATUS_STOPPED && \ X+ tr_torrentGetCompleteness(tor) == TR_SEED) X+ torrents[torrentCount++] = tor; X+ } X+ else if (!strcmp (str, "idle")) /* Torrents has been queued to seed or download */ X+ { X+ tr_torrent * tor = NULL; X+ const int n = tr_sessionCountTorrents (session); X+ torrents = tr_new0 (tr_torrent *, n); X+ while ((tor = tr_torrentNext (session, tor))) X+ { X+ const tr_torrent_activity activity = tr_torrentGetActivity (tor); X+ if (activity == TR_STATUS_SEED_WAIT || activity == TR_STATUS_DOWNLOAD_WAIT) X+ torrents[torrentCount++] = tor; X+ } X+ } X+ else if (!strcmp (str, "downloading")) /* Download in progress */ X+ { X+ tr_torrent * tor = NULL; X+ const int n = tr_sessionCountTorrents (session); X+ torrents = tr_new0 (tr_torrent *, n); X+ while ((tor = tr_torrentNext (session, tor))) X+ if (tr_torrentGetActivity (tor) == TR_STATUS_DOWNLOAD) X+ torrents[torrentCount++] = tor; X+ } X+ else if (!strcmp (str, "seeding")) /* Now seeding */ X+ { X+ tr_torrent * tor = NULL; X+ const int n = tr_sessionCountTorrents (session); X+ torrents = tr_new0 (tr_torrent *, n); X+ while ((tor = tr_torrentNext (session, tor))) X+ if (tr_torrentGetActivity (tor) == TR_STATUS_SEED) X+ torrents[torrentCount++] = tor; X+ } X+ else if (!strcmp (str, "verify")) /* Torrents in verify state */ X+ { X+ tr_torrent * tor = NULL; X+ const int n = tr_sessionCountTorrents (session); X+ torrents = tr_new0 (tr_torrent *, n); X+ while ((tor = tr_torrentNext (session, tor))) X+ { X+ const tr_torrent_activity activity = tr_torrentGetActivity (tor); X+ if (activity == TR_STATUS_CHECK || activity == TR_STATUS_CHECK_WAIT) X+ torrents[torrentCount++] = tor; X+ } X+ } X+ else if (!strcmp (str, "error")) /* Torrents with local errors */ X+ { X+ tr_torrent * tor = NULL; X+ const int n = tr_sessionCountTorrents (session); X+ torrents = tr_new0 (tr_torrent *, n); X+ while ((tor = tr_torrentNext (session, tor))) X+ { X+ const tr_torrent_activity activity = tr_torrentGetActivity (tor); X+ if (tor->error == TR_STAT_LOCAL_ERROR && activity != TR_STATUS_CHECK && \ X+ activity != TR_STATUS_CHECK_WAIT) X+ torrents[torrentCount++] = tor; X+ } X+ } X+ else if (!strcmp (str, "gone")) /* Torrents with permanent tracker errors */ X+ { X+ tr_torrent * tor = NULL; X+ const int n = tr_sessionCountTorrents (session); X+ torrents = tr_new0 (tr_torrent *, n); X+ while ((tor = tr_torrentNext (session, tor))) X+ { X+ const tr_torrent_activity activity = tr_torrentGetActivity (tor); X+ if (tor->error == TR_STAT_TRACKER_ERROR && activity != TR_STATUS_CHECK && \ X+ activity != TR_STATUS_CHECK_WAIT) X+ torrents[torrentCount++] = tor; X+ } X+ } X+ else if (!strcmp (str, "warn")) /* Torrents which has tracker warnings */ X+ { X+ tr_torrent * tor = NULL; X+ const int n = tr_sessionCountTorrents (session); X+ torrents = tr_new0 (tr_torrent *, n); X+ while ((tor = tr_torrentNext (session, tor))) X+ { X+ const tr_torrent_activity activity = tr_torrentGetActivity (tor); X+ if (tor->error == TR_STAT_TRACKER_WARNING && activity != TR_STATUS_CHECK && \ X+ activity != TR_STATUS_CHECK_WAIT) X+ torrents[torrentCount++] = tor; X+ } X+ } X+ else if (!strcmp (str, "healthy")) /* Fine torrents */ X+ { X+ tr_torrent * tor = NULL; X+ const int n = tr_sessionCountTorrents (session); X+ torrents = tr_new0 (tr_torrent *, n); X+ while ((tor = tr_torrentNext (session, tor))) X+ if (tor->error == TR_STAT_OK) X+ torrents[torrentCount++] = tor; X+ } X+ else if (!strcmp (str, "done")) /* Finished torrents */ X+ { X+ tr_torrent * tor = NULL; X+ const int n = tr_sessionCountTorrents (session); X+ torrents = tr_new0 (tr_torrent *, n); X+ while ((tor = tr_torrentNext (session, tor))) X+ if (tr_torrentGetCompleteness(tor) == TR_SEED) X+ torrents[torrentCount++] = tor; X+ } X+ else if (!strcmp (str, "leech")) /* Not finished torrents */ X+ { X+ tr_torrent * tor = NULL; X+ const int n = tr_sessionCountTorrents (session); X+ torrents = tr_new0 (tr_torrent *, n); X+ while ((tor = tr_torrentNext (session! tor))) X+ if (tr_torrentGetCompleteness(tor) != TR_SEED) X+ torrents[torrentCount++] = tor; X+ } X else X { X tr_torrent * tor; END-of-rpc-sugar echo x - Makefile.patch sed 's/^X//' >Makefile.patch << 'END-of-Makefile.patch' X27a28,32 X> .if ${SLAVEPORT} == cli || ${SLAVEPORT} == daemon X> OPTIONS_DEFINE+= RPC_SUGAR X> RPC_SUGAR_DESC?= some RPC sugar for CLI and daemon X> .endif X> X56a62,65 X> .if ${PORT_OPTIONS:MRPC_SUGAR} X> CONFIGURE_ARGS+=--enable-lightweight X> .endif X> END-of-Makefile.patch exit >Release-Note: >Audit-Trail: >Unformatted: