Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

41
LINES

< > BotCompany Repo | #1027073 // List Playing Programs [Linux, Pulse Audio, dev.]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (4884L/27K).

1  
!7
2  
3  
srecord PlayingProgram(
4  
  S processID,
5  
  S applicationName,
6  
  S sinkName,
7  
  int sinkIndex,
8  
  int index
9  
) {}
10  
11  
cmodule ListPlayingPrograms > DynObjectTable<PlayingProgram> {
12  
  start {
13  
    set fieldsInOrder;
14  
    dontPersist();
15  
    doEvery(0.0, 10.0, r updateList);
16  
  }
17  
  
18  
  void updateList enter {
19  
    LS parts = withoutEmptyAfterTrims(splitByZeroIndent(backtick("pactl list sink-inputs")));
20  
    new L<PlayingProgram> list;
21  
    
22  
    for (S part : parts) {
23  
      int idx = parseFirstInt(part);
24  
      SS properties1 = parseColonProperties(part);
25  
      SS properties2 = parseEqualsProperties(part);
26  
      int sinkIndex = parseIntOrMinus1(properties1.get("Sink"));
27  
      S sinkName = cast dm_findAndCallModule("#1027072/ListAudioSinks", 'getSinkName, sinkIndex);
28  
      list.add(nu(PlayingProgram,
29  
        index := idx,
30  
        applicationName := unquote(properties2.get("application.name")),
31  
        processID := unquote(properties2.get("application.process.id")),
32  
        +sinkIndex, +sinkName));
33  
    }
34  
    setData(list);
35  
  }
36  
  
37  
  visualize {
38  
    JComponent c = super.visualize();
39  
    ret centerAndEastWithMargins(c, vstackWithSpacing(jlabel("Buttons go here")));
40  
  }
41  
}

Author comment

Began life as a copy of #1020410

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027073
Snippet name: List Playing Programs [Linux, Pulse Audio, dev.]
Eternal ID of this version: #1027073/4
Text MD5: 76eb7cb63537bfa155e850ee0d120c86
Transpilation MD5: 1d1f0fa9151a289a2b2e323fdfe1c1c9
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-17 13:27:13
Source code size: 1207 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 269 / 11779
Version history: 3 change(s)
Referenced in: [show references]