arthur.bebou

Le site arthur.bebou.netlib.re - retour accueil

git clone git://bebou.netlib.re/arthur.bebou
Log | Files | Refs |

arguments-to-plumber.patch (2543B)


      1 From f5f7675939ca3e5463c7dbd106daaf79802a37ed Mon Sep 17 00:00:00 2001
      2 From: arthur <arthur.pons@unistra.fr>
      3 Date: Wed, 2 Nov 2022 12:52:18 +0100
      4 Subject: [PATCH] Added new argument to plumber command
      5 
      6 ---
      7  sfeed_curses.c | 18 ++++++++++++------
      8  1 file changed, 12 insertions(+), 6 deletions(-)
      9 
     10 diff --git a/sfeed_curses.c b/sfeed_curses.c
     11 index 4d2b698..5f6a823 100644
     12 --- a/sfeed_curses.c
     13 +++ b/sfeed_curses.c
     14 @@ -1429,11 +1429,11 @@ feed_open_selected(struct pane *p)
     15  }
     16  
     17  void
     18 -feed_plumb_selected_item(struct pane *p, int field)
     19 +feed_plumb_selected_item(struct pane *p, int field, char *audio)
     20  {
     21  	struct row *row;
     22  	struct item *item;
     23 -	char *cmd[3]; /* will have: { plumbercmd, arg, NULL } */
     24 +	char *cmd[4]; /* will have: { plumbercmd, arg, NULL } */
     25  
     26  	if (!(row = pane_row_get(p, p->pos)))
     27  		return;
     28 @@ -1441,7 +1441,8 @@ feed_plumb_selected_item(struct pane *p, int field)
     29  	item = row->data;
     30  	cmd[0] = plumbercmd;
     31  	cmd[1] = item->fields[field]; /* set first argument for plumber */
     32 -	cmd[2] = NULL;
     33 +	cmd[2] = audio;
     34 +	cmd[3] = NULL;
     35  	forkexec(cmd, plumberia);
     36  }
     37  
     38 @@ -1700,7 +1701,7 @@ mousereport(int button, int release, int keymask, int x, int y)
     39  			if (i == PaneFeeds)
     40  				feed_open_selected(&panes[PaneFeeds]);
     41  			else if (i == PaneItems && dblclick && !changedpane)
     42 -				feed_plumb_selected_item(&panes[PaneItems], FieldLink);
     43 +				feed_plumb_selected_item(&panes[PaneItems], FieldLink, "");
     44  			break;
     45  		case 2: /* right-click */
     46  			if (!p->nrows || pos >= p->nrows)
     47 @@ -2268,7 +2269,7 @@ nextpage:
     48  		case 'e': /* enclosure */
     49  		case '@':
     50  			if (selpane == PaneItems)
     51 -				feed_plumb_selected_item(&panes[selpane], FieldEnclosure);
     52 +				feed_plumb_selected_item(&panes[selpane], FieldEnclosure, "");
     53  			break;
     54  		case 'm': /* toggle mouse mode */
     55  			usemouse = !usemouse;
     56 @@ -2300,11 +2301,16 @@ nextpage:
     57  				pane_setpos(p, 0);
     58  			break;
     59  		case 'o': /* feeds: load, items: plumb URL */
     60 +			if (selpane == PaneFeeds && panes[selpane].nrows)
     61 +				feed_open_selected(&panes[selpane]);
     62 +			else if (selpane == PaneItems && panes[selpane].nrows)
     63 +				feed_plumb_selected_item(&panes[selpane], FieldLink, "audio");
     64 +			break;
     65  		case '\n':
     66  			if (selpane == PaneFeeds && panes[selpane].nrows)
     67  				feed_open_selected(&panes[selpane]);
     68  			else if (selpane == PaneItems && panes[selpane].nrows)
     69 -				feed_plumb_selected_item(&panes[selpane], FieldLink);
     70 +				feed_plumb_selected_item(&panes[selpane], FieldLink, "");
     71  			break;
     72  		case 'c': /* items: pipe TSV line to program */
     73  		case 'p':
     74 -- 
     75 2.25.1
     76