Skip to content

Commit 65d2635

Browse files
authored
Feature/support linux (#11)
* added linux * add libjack0 for linux - attempt to fix missing audacity libs * updated linux requirements for audacity * attempt to fix libjackd installation * added portaudio for linux * portaudio shared libs only * added tmate session * fixed audacity config path * increased timeout * added portaudio * attempt to install audacity with ubuntu packages * print processes before killing * attempt to wait for audacity * keep audacity running * removed ubuntu build for now * run linux on my machine * fixed audacity start for windows * skip python installation for self hosted runner * keep audacity running * do not fail fast * removed the need in pyperclip * attempt to use xvfb * added github actions ubuntu * attempt to fix xvfb for github runner * removed self hosted runner * updated docs * removed grep before kill
1 parent f37d8bc commit 65d2635

File tree

7 files changed

+64
-47
lines changed

7 files changed

+64
-47
lines changed

.github/workflows/test.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@ name: Tests
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
tmate_session:
7+
type: boolean
8+
description: "tmate session"
9+
required: false
10+
default: false
11+
tmate_os:
12+
type: choice
13+
description: "tmate os"
14+
required: false
15+
default: "ubuntu-22.04"
16+
options:
17+
- "ubuntu-22.04"
18+
- "windows-2022"
19+
- "macos-12"
520
push:
621
paths-ignore:
722
- "README.md"
@@ -17,12 +32,14 @@ env:
1732
jobs:
1833
tests:
1934
name: Tests
20-
timeout-minutes: 10
35+
timeout-minutes: 20
2136
strategy:
37+
fail-fast: false
2238
matrix:
2339
include:
2440
- OS: windows-2022
25-
- OS: macos-latest
41+
- OS: macos-12
42+
- OS: ubuntu-22.04
2643
runs-on: ${{ matrix.OS }}
2744
steps:
2845
- uses: actions/checkout@v4.1.1
@@ -40,8 +57,23 @@ jobs:
4057
- name: Download Audacity
4158
if: matrix.OS == 'windows-2022'
4259
run: make audacity-download
60+
- name: Install Linux Requirements
61+
if: matrix.OS == 'ubuntu-22.04'
62+
run: |
63+
sudo apt-get update && \
64+
sudo apt-get install -y xvfb
4365
- name: Install Audacity
4466
run: make audacity-install
67+
- name: Setup tmate session
68+
uses: mxschmitt/action-tmate@v3
69+
with:
70+
limit-access-to-actor: true
71+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.tmate_os == matrix.OS && inputs.tmate_session && github.actor == 'unfor19' }}
72+
- name: Start Xvfb - For Running GUI Apps on Linux
73+
if: matrix.OS == 'ubuntu-22.04'
74+
run: |
75+
Xvfb :99 -ac &
76+
echo "DISPLAY=:99" >> $GITHUB_ENV
4577
- name: Start Audacity for the first time
4678
run: make audacity-start
4779
- name: Kill Audacity

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
*.exe
99
*.zip
1010

11+
# linux
12+
*.appimage
13+
*.AppImage
14+
1115
# python
1216
*__pycache__
1317
ENV/

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ AUDACITY_KILL_COMMAND:=killall Audacity
4444
AUDACITY_INSTALL_COMMAND:=brew reinstall --no-quarantine --cask audacity
4545
VENV_BIN_ACTIVATE:=${VENV_DIR_PATH}/bin/activate
4646
endif
47+
48+
ifneq (,$(findstring Linux, $(UNAME)))
49+
_OS:=linux
50+
AUDACITY_PREFERENCES_PATH:=${HOME}/.config/audacity/audacity.cfg
51+
AUDACITY_KILL_COMMAND:=killall audacity
52+
VENV_BIN_ACTIVATE:=${VENV_DIR_PATH}/bin/activate
53+
AUDACITY_BIN_PATH:=/usr/bin/audacity
54+
AUDACITY_INSTALL_COMMAND:=sudo add-apt-repository -y ppa:ubuntuhandbook1/audacity && sudo apt-get update && sudo apt-get install -y audacity audacity-data
55+
endif
4756
# --- OS Settings --- END --------------------------------------------------------------
4857

4958
SHELL:=${BASH_PATH}
@@ -158,14 +167,14 @@ audacity-start: validate-AUDACITY_BIN_PATH ## Start Audacity GUI app
158167
@if [[ "${CI}" = "true" ]]; then \
159168
echo "Sleeping 10 seconds to allow Audacity to start the pipes ..." ; \
160169
sleep 10 ; \
161-
echo "Hopefully Audacity is up" ; \
170+
echo "Completed sleeping" ; \
162171
fi
163172

164173
audacity-test-pipe: ## Test Audacity pipe
165174
python ${ROOT_DIR}/scripts/audacity_pipetest.py
166175

167176
audacity-kill: validate-AUDACITY_KILL_COMMAND ## Kill Audacity
168-
${AUDACITY_KILL_COMMAND}
177+
@${AUDACITY_KILL_COMMAND}
169178

170179
audacity-restart: audacity-kill audacity-start
171180

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ https://github.com/unfor19/audacity-scripting/assets/15122452/080e772c-3e40-424b
2222

2323
## Installation
2424

25+
Supported OS: Windows, Linux, and macOS
26+
2527
```
2628
python -m pip install audacity-scripting
2729
```
@@ -34,11 +36,15 @@ python -m pip install audacity-scripting
3436
- [ ] Normalize audio
3537
- [ ] End Goal - Prepare videos for voice-clone-finetuning-vits
3638

37-
## Known Issues
39+
<!-- available_commands_end -->
3840

39-
- macOS prints Audacity's server logs (`Server sending`, `Read failed on fifo, quitting`, etc.) - documented in [JOURNEY.md](./JOURNEY.md)
41+
## Getting Started
4042

41-
## Available Commands
43+
All the commands assume that the _Audacity_ application is up and running; That is mandatory as we communicate with [_Audacity_'s pipe](https://manual.audacityteam.org/man/scripting.html) to execute all the commands.
44+
45+
> **NOTE**: See the [GitHub Actions Tests Workflow](https://github.com/unfor19/audacity-scripting/actions/workflows/test.yml) to check it in action.
46+
47+
### Available Commands
4248

4349
Auto-generated by [unfor19/replacer-action](https://github.com/marketplace/actions/replacer-action), see [readme.yml](https://github.com/unfor19/frigga/blob/master/.github/workflows/readme.yml)
4450

@@ -61,20 +67,12 @@ Commands:
6167
version-print Get the version from the version file.
6268
```
6369

64-
<!-- available_commands_end -->
65-
66-
## Getting Started
67-
68-
All the commands assume that the _Audacity_ application is up and running; That is mandatory as we communicate with [_Audacity_'s pipe](https://manual.audacityteam.org/man/scripting.html) to execute all the commands.
69-
70-
> **NOTE**: See the [GitHub Actions Tests Workflow](https://github.com/unfor19/audacity-scripting/actions/workflows/test.yml) to check it in action.
71-
7270
### Remove spaces between clips
7371

7472
This command copies the original file and removes spaces (gaps) between audio clips from the copied file.
7573

7674
```bash
77-
audacity_scripting clean-spaces --path "/path/to/my_project.aup3"
75+
audacity_scripting clean-spaces --file_path "/path/to/my_project.aup3"
7876
```
7977

8078
### Send a command to Audacity
@@ -85,6 +83,10 @@ Send a command to Audacity according to [Audacity's Scripting Reference](https:/
8583
audacity_scripting do-command --command "Select: Tracks=0.0 Start=0.0 End=0.0"
8684
```
8785

86+
## Known Issues
87+
88+
- macOS prints Audacity's server logs (`Server sending`, `Read failed on fifo, quitting`, etc.) - documented in [JOURNEY.md](./JOURNEY.md)
89+
8890
## References
8991

9092
- [GitHub Issue - Audacity Remove spaces between clips](https://github.com/audacity/audacity/issues/3924)

requirements.txt

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,7 @@
1-
build==1.0.3
2-
certifi==2023.11.17
3-
charset-normalizer==3.3.2
41
click==8.1.7
52
dill==0.3.7
6-
docutils==0.20.1
7-
idna==3.6
8-
importlib-metadata==7.0.0
9-
jaraco.classes==3.3.0
10-
keyring==24.3.0
113
lib-detect-testenv==2.0.8
12-
markdown-it-py==3.0.0
13-
mdurl==0.1.2
14-
more-itertools==10.1.0
154
multiprocess==0.70.15
16-
nh3==0.2.15
17-
packaging==23.2
18-
pkginfo==1.9.6
195
psutil==5.9.7
20-
Pygments==2.17.2
21-
pyperclip==1.8.2
22-
pyproject_hooks==1.0.0
23-
readme-renderer==42.0
24-
requests==2.31.0
25-
requests-toolbelt==1.0.0
26-
rfc3986==2.0.0
27-
rich==13.7.0
28-
tomli==2.0.1
29-
tqdm==4.66.1
30-
twine==4.0.2
31-
urllib3==2.1.0
326
wrapt==1.16.0
337
wrapt-timeout-decorator==1.4.0
34-
zipp==3.17.0

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ setup_requires =
77
install_requires =
88
click>=7.1.2
99
wrapt_timeout_decorator>=1.4.0
10-
pyperclip>=1.8.2
1110
pywin32 >= 1.0;platform_system=='Windows'
1211
### ------------------------------------------------------------------
1312

src/audacity_scripting/bridge/wrappers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from typing import List
2-
import pyperclip
32
from ..utils.logger import logger
43
from .pipe import do_command
54
from .clip import Clip
@@ -87,8 +86,7 @@ def copy_and_paste_clip(source_track_index, target_track_index, clip):
8786

8887
def add_label_to_clip(label_iterator, sleep_seconds=0.01):
8988
do_command('AddLabel:')
90-
pyperclip.copy(label_iterator)
91-
do_command('Paste:')
89+
do_command(f'SetLabel: Label="{label_iterator}" Text="{label_iterator}"')
9290
sleep(sleep_seconds)
9391
return label_iterator + 1
9492

0 commit comments

Comments
 (0)