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).

!7

srecord PlayingProgram(
  S processID,
  S applicationName,
  S sinkName,
  int sinkIndex,
  int index
) {}

cmodule ListPlayingPrograms > DynObjectTable<PlayingProgram> {
  start {
    set fieldsInOrder;
    dontPersist();
    doEvery(0.0, 10.0, r updateList);
  }
  
  void updateList enter {
    LS parts = withoutEmptyAfterTrims(splitByZeroIndent(backtick("pactl list sink-inputs")));
    new L<PlayingProgram> list;
    
    for (S part : parts) {
      int idx = parseFirstInt(part);
      SS properties1 = parseColonProperties(part);
      SS properties2 = parseEqualsProperties(part);
      int sinkIndex = parseIntOrMinus1(properties1.get("Sink"));
      S sinkName = cast dm_findAndCallModule("#1027072/ListAudioSinks", 'getSinkName, sinkIndex);
      list.add(nu(PlayingProgram,
        index := idx,
        applicationName := unquote(properties2.get("application.name")),
        processID := unquote(properties2.get("application.process.id")),
        +sinkIndex, +sinkName));
    }
    setData(list);
  }
  
  visualize {
    JComponent c = super.visualize();
    ret centerAndEastWithMargins(c, vstackWithSpacing(jlabel("Buttons go here")));
  }
}

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: 191 / 11677
Version history: 3 change(s)
Referenced in: [show references]