From 76e9e72f7e502741714aff2f460ff1865632b29f Mon Sep 17 00:00:00 2001 From: iloveicedgreentea <31193909+iloveicedgreentea@users.noreply.github.com> Date: Tue, 6 Feb 2024 17:19:57 -0500 Subject: [PATCH 1/2] fix test and build --- .github/workflows/docker-publish.yml | 2 +- changelog.txt | 3 ++- internal/ezbeq/ezbeq.go | 4 ++-- internal/jellyfin/jellyfin.go | 2 ++ test.sh | 27 +++++++++++++++++++++++---- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 6166031..43d909d 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -64,7 +64,7 @@ jobs: with: context: . # platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 - push: ${{ github.event_name == 'pull_request' && github.head_ref == 'develop' }} + push: ${{ github.head_ref == 'master' || github.event_name == 'pull_request' && github.head_ref == 'develop' }} tags: ${{ steps.meta.outputs.tags }} # cache-from: type=gha # cache-to: type=gha,mode=max diff --git a/changelog.txt b/changelog.txt index cf39d47..73e7b4a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -40,4 +40,5 @@ Modify UUID filter to accept comma for multiple * fix cache on resume * various speedups * remove listen port config -* improve search by using tmdb \ No newline at end of file +* improve search by using tmdb +* add author name to mqtt topic and logs \ No newline at end of file diff --git a/internal/ezbeq/ezbeq.go b/internal/ezbeq/ezbeq.go index dfdb8a6..e337c7a 100644 --- a/internal/ezbeq/ezbeq.go +++ b/internal/ezbeq/ezbeq.go @@ -353,7 +353,7 @@ func (c *BeqClient) LoadBeqProfile(m *models.SearchRequest) error { } if m.DryrunMode { - return fmt.Errorf("BEQ Dry run msg - Would load title %s -- codec %s -- edition: %s, ezbeq entry ID %s", catalog.SortTitle, m.Codec, catalog.Edition, m.EntryID) + return fmt.Errorf("BEQ Dry run msg - Would load title %s -- codec %s -- edition: %s, ezbeq entry ID %s - author %s", catalog.Title, m.Codec, catalog.Edition, m.EntryID, catalog.Author) } // build payload @@ -392,7 +392,7 @@ func (c *BeqClient) LoadBeqProfile(m *models.SearchRequest) error { } } - return mqtt.PublishWrapper(config.GetString("mqtt.topicBeqCurrentProfile"), fmt.Sprintf("%s: Codec: %s, Author: %s", catalog.SortTitle, m.Codec, catalog.Author)) + return mqtt.PublishWrapper(config.GetString("mqtt.topicBeqCurrentProfile"), fmt.Sprintf("%s: %s by %s", catalog.Title, m.Codec, catalog.Author)) } // UnloadBeqProfile will unload all profiles from all devices diff --git a/internal/jellyfin/jellyfin.go b/internal/jellyfin/jellyfin.go index 10aff23..9f381e3 100644 --- a/internal/jellyfin/jellyfin.go +++ b/internal/jellyfin/jellyfin.go @@ -54,6 +54,8 @@ func (c *JellyfinClient) GetPlexMovieDb(payload interface{}) string { // TODO: finish func (c *JellyfinClient) GetAudioCodec(payload interface{}) (string, error) { + // codec, title, profile, err := c.GetCodec(payload.(models.JellyfinMetadata)) + // TODO: parse the response and map this to the beq codec standards return "", nil } // generic function to make a request diff --git a/test.sh b/test.sh index b696422..0ed2010 100755 --- a/test.sh +++ b/test.sh @@ -1,14 +1,33 @@ -#!/bin/bash +#!/usr/bin/env bash unset LOG_LEVEL -set -euo pipefail -readarray -t dirs < <(find . -type d -not -path "./.git*") +set -uo pipefail + +while IFS=\= read -r dir; do + dirs+=("$dir") +done < <(find . -type d -not -path "./.git*") + +# readarray -t dirs < <(find . -type d -not -path "./.git*") run_tests() { local dir=$1 echo "Testing $dir" - (cd "$dir" && go test -cover -coverprofile=coverage.out) + ( + cd "$dir" || exit 1 + out=$(go test -cover -coverprofile=coverage.out 2>&1) + code=$? + if [ $code -ne 0 ]; then + if echo "$out"| grep -q "files in"; then + code=0 + else + echo "Error testing $dir" + echo "$out" + exit $code + fi + fi + + ) } From c67e012879f421185799d013770670aaf4f9e64b Mon Sep 17 00:00:00 2001 From: iloveicedgreentea <31193909+iloveicedgreentea@users.noreply.github.com> Date: Tue, 6 Feb 2024 17:49:27 -0500 Subject: [PATCH 2/2] fix missing master volume --- .github/workflows/docker-publish.yml | 46 +++------------------------- internal/handlers/plex_handler.go | 1 + 2 files changed, 6 insertions(+), 41 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 43d909d..ec55cf1 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,22 +1,13 @@ name: Docker -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - on: push: - branches: ["master"] - # Publish semver tags as releases. - tags: ["v*.*.*"] + tags: ['v*.*.*'] # Triggers on tag following semantic versioning pull_request: - branches: ["master", "develop", "clip_support"] + branches: ['master', 'develop'] # Triggers on PR to these branches env: - # Use docker.io for Docker Hub if empty REGISTRY: ghcr.io - # github.repository as / IMAGE_NAME: ${{ github.repository }} jobs: @@ -25,59 +16,32 @@ jobs: permissions: contents: read packages: write - # This is used to complete the identity challenge - # with sigstore/fulcio when running outside of PRs. id-token: write steps: - name: Checkout repository uses: actions/checkout@v4 - # Workaround: https://github.com/docker/build-push-action/issues/461 + - name: Setup Docker buildx uses: docker/setup-buildx-action@v3.0.0 - # TODO: run tests - - # Login against a Docker registry except on PR - # https://github.com/docker/login-action - name: Log into registry ${{ env.REGISTRY }} - if: ${{ github.event_name == 'pull_request' && github.head_ref == 'develop' }} + if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} uses: docker/login-action@v3.0.0 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5.5.1 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - # Build and push Docker image with Buildx (don't push on PR) - # https://github.com/docker/build-push-action - name: Build and push Docker image - id: build-and-push uses: docker/build-push-action@v5.0.0 with: context: . - # platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 - push: ${{ github.head_ref == 'master' || github.event_name == 'pull_request' && github.head_ref == 'develop' }} + push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} tags: ${{ steps.meta.outputs.tags }} - # cache-from: type=gha - # cache-to: type=gha,mode=max - - # # Sign the resulting Docker image digest except on PRs. - # # This will only write to the public Rekor transparency log when the Docker - # # repository is public to avoid leaking data. If you would like to publish - # # transparency data even for private images, pass --force to cosign below. - # # https://github.com/sigstore/cosign - # - name: Sign the published Docker image - # if: ${{ github.event_name != 'pull_request' }} - # env: - # COSIGN_EXPERIMENTAL: "true" - # # This step uses the identity token to provision an ephemeral certificate - # # against the sigstore community Fulcio instance. - # run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }} diff --git a/internal/handlers/plex_handler.go b/internal/handlers/plex_handler.go index 5b39391..56b12b8 100644 --- a/internal/handlers/plex_handler.go +++ b/internal/handlers/plex_handler.go @@ -143,6 +143,7 @@ func interfaceRemote(cmd string, c *homeassistant.HomeAssistantClient) error { // play is both the "resume" button and play func mediaPlay(client *plex.PlexClient, beqClient *ezbeq.BeqClient, haClient *homeassistant.HomeAssistantClient, avrClient avr.AVRClient, payload models.PlexWebhookPayload, m *models.SearchRequest, useAvrCodec bool, data models.MediaContainer, skipActions *bool, wg *sync.WaitGroup) { go common.ChangeLight("off") + go common.ChangeMasterVolume(m.MediaType) var err error // slower but more accurate // TODO: abstract library this for any AVR