diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..8c61d09 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,38 @@ +name: Publish Docker image + +on: + push: + branches: + - 'main' + +env: + DOCKERHUB_REPO: your-pod + +jobs: + build_and_push: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Get short SHA + id: sha + run: echo "::set-output name=sha::$(git rev-parse --short ${{ github.sha }})" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPO }}:${{ steps.sha.outputs.sha }} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPO }}:latest diff --git a/src/routers/admin/detail/getDetails.js b/src/routers/admin/detail/getDetails.js index d99f643..eff7c7e 100644 --- a/src/routers/admin/detail/getDetails.js +++ b/src/routers/admin/detail/getDetails.js @@ -12,8 +12,7 @@ async function podcastDetailsHandler(request, h) { { title: podcast.title, slug: podcast.slug, - audioUrl: buildObjectURL('patreon/' + podcast.audio_file_key), - audioUrl_2: buildObjectURL('episodes/' + podcast.slug + '.mp3'), + audioUrl: buildObjectURL(podcast.origin_file), timecodes: podcast.charters.map((chapter, index) => { const splitTime = chapter.time.split(':'); const hour = splitTime[0]; diff --git a/src/routers/admin/details.js b/src/routers/admin/details.js index 69c5465..3896af6 100644 --- a/src/routers/admin/details.js +++ b/src/routers/admin/details.js @@ -14,10 +14,10 @@ async function updatePodcastName(request, h) { return h.response().code(200).header('HX-Trigger', 'update-preview'); } -async function buildPublicAudio(podcast) { +async function createPublicAudio(podcast) { const chapters = podcast.charters; - let filterString = ''; + let complexFilterString = ''; let publicIndex = 1; chapters.forEach((chapter, index) => { @@ -35,19 +35,19 @@ async function buildPublicAudio(podcast) { filterMainPart = `${filterStart}`; } - filterString += `${filterMainPart},asetpts=PTS-STARTPTS[a${publicIndex}]; `; + complexFilterString += `${filterMainPart},asetpts=PTS-STARTPTS[a${publicIndex}]; `; publicIndex++; } }); // add part with [a0]...[a] for (let i = 1; i < publicIndex; i++) { - filterString += `[a${i}]`; + complexFilterString += `[a${i}]`; } - filterString += `concat=n=${publicIndex - 1}:v=0:a=1`; + complexFilterString += `concat=n=${publicIndex - 1}:v=0:a=1`; - await applyFFmpegToFileInMinio(podcast.origin_file, `episodes/${podcast.slug}.mp3`, filterString) + await applyFFmpegToFileInMinio(podcast.origin_file, `episodes/${podcast.slug}.mp3`, complexFilterString) } async function updateFiles(request, h) { @@ -59,7 +59,7 @@ async function updateFiles(request, h) { console.log('publicChapters', publicChapters); - await buildPublicAudio(podcast); + await createPublicAudio(podcast); return h.response().code(200) } diff --git a/src/templates/pages/admin/admin_podcast_detail.html b/src/templates/pages/admin/admin_podcast_detail.html index cd91408..3e23688 100644 --- a/src/templates/pages/admin/admin_podcast_detail.html +++ b/src/templates/pages/admin/admin_podcast_detail.html @@ -13,14 +13,6 @@ Your browser does not support the audio element. - -
- -
-

Time codes