Skip to content

Commit 2c6dabf

Browse files
authored
Merge branch 'EDyO:main' into master
2 parents f6780e8 + 8b4c8ec commit 2c6dabf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3099
-0
lines changed

.github/workflows/release.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
on:
2+
push:
3+
tags:
4+
- '*'
5+
6+
permissions:
7+
packages: write
8+
9+
jobs:
10+
docker:
11+
runs-on: ubuntu-latest
12+
steps:
13+
-
14+
name: Checkout
15+
uses: actions/checkout@v2
16+
-
17+
name: Get tag name
18+
id: tag_name
19+
run: |
20+
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
21+
-
22+
name: Build and publish Docker image
23+
run: |
24+
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u EDyO --password-stdin
25+
docker build --pull --rm -f "appu/Dockerfile" -t ghcr.io/edyo/appu:${{ steps.tag_name.outputs.SOURCE_TAG }} appu/.
26+
docker push ghcr.io/edyo/appu:${{ steps.tag_name.outputs.SOURCE_TAG }}
27+
release:
28+
needs:
29+
- docker
30+
runs-on: ubuntu-latest
31+
strategy:
32+
matrix:
33+
destination_os: [linux, windows, darwin]
34+
steps:
35+
-
36+
name: Checkout
37+
uses: actions/checkout@v2
38+
-
39+
name: Install Go
40+
uses: actions/setup-go@v2
41+
with:
42+
go-version: '^1.16'
43+
-
44+
name: Tidy dependencies to local
45+
run : |
46+
go mod tidy
47+
-
48+
name: Build
49+
run: |
50+
scripts/build.sh ${{ matrix.destination_os }} amd64
51+
-
52+
name: Get the version
53+
id: get_version
54+
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
55+
-
56+
name: Release built binaries
57+
uses: AButler/[email protected]
58+
with:
59+
repo-token: ${{ secrets.GITHUB_TOKEN }}
60+
files: build/*
61+
release-tag: ${{ steps.get_version.outputs.VERSION }}

.github/workflows/test.yaml

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
on:
2+
pull_request:
3+
push:
4+
branches: [main]
5+
6+
jobs:
7+
pytest:
8+
runs-on: ubuntu-latest
9+
steps:
10+
-
11+
name: Checkout
12+
uses: actions/checkout@v2
13+
-
14+
name: Build Docker image
15+
run: docker build --pull --rm -f "appu/Dockerfile" -t appu appu/.
16+
-
17+
name: Run tests in Docker container
18+
run: docker run --rm appu /bin/sh -c 'pip install -r dev-requirements.txt; python -m pytest'
19+
test:
20+
runs-on: ubuntu-latest
21+
steps:
22+
-
23+
name: Checkout
24+
uses: actions/checkout@v2
25+
-
26+
name: Install Go
27+
uses: actions/setup-go@v2
28+
with:
29+
go-version: '^1.16'
30+
-
31+
name: Tidy dependencies to local
32+
run : |
33+
go mod tidy
34+
-
35+
name: Run tests
36+
run: |
37+
go test -v ./... -race -covermode=atomic
38+
check-formatting:
39+
runs-on: ubuntu-latest
40+
steps:
41+
-
42+
name: Checkout
43+
uses: actions/checkout@v2
44+
-
45+
name: Check formatting
46+
run: |
47+
gofmt -s -e -d -l . | tee /tmp/gofmt.output && [ $(cat /tmp/gofmt.output | wc -l) -eq 0 ]
48+
check-smells:
49+
runs-on: ubuntu-latest
50+
steps:
51+
-
52+
name: Checkout
53+
uses: actions/checkout@v2
54+
-
55+
name: Install Go
56+
uses: actions/setup-go@v2
57+
with:
58+
go-version: '^1.16'
59+
-
60+
name: Tidy dependencies to local
61+
run : |
62+
go mod tidy
63+
-
64+
name: Check code smells
65+
run: |
66+
go vet ./...
67+
check-complexity:
68+
runs-on: ubuntu-latest
69+
steps:
70+
-
71+
name: Checkout
72+
uses: actions/checkout@v2
73+
-
74+
name: Install Go
75+
uses: actions/setup-go@v2
76+
with:
77+
go-version: '^1.16'
78+
-
79+
name: Install gocyclo
80+
run: |
81+
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
82+
-
83+
name: Check cyclomatic complexity
84+
run: |
85+
gocyclo -over 15 .
86+
check-style:
87+
runs-on: ubuntu-latest
88+
steps:
89+
-
90+
name: Checkout
91+
uses: actions/checkout@v2
92+
-
93+
name: Install Go
94+
uses: actions/setup-go@v2
95+
with:
96+
go-version: '^1.16'
97+
-
98+
name: Install golint
99+
run: |
100+
go install golang.org/x/lint/golint@latest
101+
-
102+
name: Check Style
103+
run: |
104+
golint ./...
105+
check-ineffectual-assignments:
106+
runs-on: ubuntu-latest
107+
steps:
108+
-
109+
name: Checkout
110+
uses: actions/checkout@v2
111+
-
112+
name: Install Go
113+
uses: actions/setup-go@v2
114+
with:
115+
go-version: '^1.16'
116+
-
117+
name: Install ineffassign
118+
run: |
119+
go install github.com/gordonklaus/ineffassign@latest
120+
-
121+
name: Tidy dependencies to local
122+
run : |
123+
go mod tidy
124+
-
125+
name: Check ineffectual assignments
126+
run: |
127+
ineffassign ./...
128+
check-spelling:
129+
runs-on: ubuntu-latest
130+
steps:
131+
-
132+
name: Checkout
133+
uses: actions/checkout@v2
134+
-
135+
name: Install Go
136+
uses: actions/setup-go@v2
137+
with:
138+
go-version: '^1.16'
139+
-
140+
name: Install spellchecker
141+
run: |
142+
go install github.com/client9/misspell/cmd/misspell@latest
143+
-
144+
name: Check spelling
145+
run: |
146+
misspell -error .
147+
staticcheck:
148+
runs-on: ubuntu-latest
149+
steps:
150+
-
151+
name: Checkout
152+
uses: actions/checkout@v2
153+
-
154+
name: Install Go
155+
uses: actions/setup-go@v2
156+
with:
157+
go-version: '^1.16'
158+
-
159+
name: Install staticcheck
160+
run: |
161+
go get -u honnef.co/go/tools/cmd/staticcheck@latest
162+
-
163+
name: Download dependencies to local
164+
run : |
165+
go mod download
166+
-
167+
name: Run staticcheck
168+
run: |
169+
staticcheck ./...
170+
check-license:
171+
runs-on: ubuntu-latest
172+
steps:
173+
-
174+
name: Checkout
175+
uses: actions/checkout@v2
176+
-
177+
name: Check license file is present
178+
run: |
179+
find . -name LICENSE.md

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Ignasi Fosch
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

appu/.travis.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
os: linux
2+
dist: bionic
3+
sudo: required
4+
language: python
5+
python:
6+
- "3.7"
7+
git:
8+
depth: 1
9+
before_script:
10+
- sudo apt-get install ffmpeg
11+
- pip install -r requirements.txt
12+
13+
branches:
14+
only:
15+
- master
16+
17+
script:
18+
- git config --global user.email "[email protected]"
19+
- git config --global user.name "Travis for EDyO"
20+
21+
# - git clone https://github.com/dacacioa/pydub.git ../pydub
22+
# - ln -s ../pydub/pydub/ pydub
23+
24+
- git checkout -b travis_ci
25+
- python ./appu.py
26+
- git status
27+
- git add -A
28+
- git status
29+
- git commit -am "Pushing podcast from travis..."
30+
- git push "https://${GH_TOKEN}@github.com/EDyO/appu.git" -f

appu/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM python:3.7-alpine
2+
3+
RUN apk --update add \
4+
ffmpeg \
5+
&& rm -rf /var/lib/apt/lists/* \
6+
&& rm /var/cache/apk/*
7+
8+
RUN addgroup -S appu -g 1000 \
9+
&& adduser -S appu -G appu -u 1000
10+
11+
USER appu
12+
13+
COPY --chown=appu:appu . /home/appu
14+
15+
RUN mkdir -p /home/appu/files /home/appu/podcast
16+
17+
RUN cd /home/appu/ \
18+
&& pip install -r requirements.txt
19+
20+
WORKDIR /home/appu
21+
22+
CMD ["/usr/local/bin/python", "/home/appu/appu.py"]

appu/README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# APPu
2+
3+
APPu, **A**utomatic **P**odcast **Pu**blisher, is a tool used to automate podcast episodes' publishing, as we do at the [EDyO](http://www.entredevyops.es) podcast.
4+
5+
6+
## Description
7+
8+
This tool:
9+
10+
1. Downloads the media to edit the audio track: The master recording, and the intro and outro.
11+
2. Joins these tracks and normalizes the volume.
12+
3. Fills the ID3 tags, including the cover image, from provided information.
13+
4. Uploads the resulting audio track to the specified bucket.
14+
15+
The information required is provided through a configuration file.
16+
17+
## Requirements
18+
19+
You'll need:
20+
* to have either [Docker](https://docs.docker.com/get-docker/), for Linux, Mac or Windows, installed, and
21+
* credentials to store the edited audio track in the publishing bucket.
22+
23+
## Usage
24+
### How to build it
25+
26+
1. Clone the git repository and jump into it,
27+
```
28+
git clone https://github.com/EDyO/appu.git
29+
cd appu
30+
```
31+
32+
or jump into it and pull the latest changes:
33+
```
34+
cd appu
35+
git pull
36+
```
37+
38+
2. Build the image:
39+
```
40+
docker build --pull --rm -f "Dockerfile" -t appu .
41+
```
42+
43+
### How to use it
44+
45+
1. Create your `config.cfg`:
46+
47+
This is an [INI](https://docs.python.org/3/library/configparser.html#supported-ini-file-structure) file, with the following sections and keys:
48+
* In the `files-config`:
49+
* `podcast_file`: A path or URL pointing to the master recording.
50+
* `song_file`: A path or URL to the intro and outro jingles. The program will use the first second of the song as intro, and the last 4 seconds, as the outro.
51+
* `cover_file`: A path to the image to use as cover in the resulting audio track.
52+
* `final_file`: The bucket object ID.
53+
* `podcast_bucket`: The name of the publishing bucket.
54+
* In the `tag-config`:
55+
* `title`: The title of the episode.
56+
* `artist`: The name of the author/s.
57+
* `album`: The name of the podcast.
58+
* `track`: The number of this track.
59+
* `year`: The year of the publishing.
60+
* `comment`: The summary of the episode.
61+
62+
2. Run the appu container. The following is an example of the run command in Linux:
63+
```
64+
docker run --rm -v $(pwd)/yourconfig.cfg:/home/appu/config.cfg -v $(pwd)/bucket.credentials:/home/appu/.aws/credentials appu
65+
```
66+
67+
On completion, your episode should be present in the specified bucket.

0 commit comments

Comments
 (0)