diff --git a/.github/workflows/auto-close-stale-pr.yml b/.github/workflows/auto-close-stale-pr.yml index 360f18ac..5cdd7447 100644 --- a/.github/workflows/auto-close-stale-pr.yml +++ b/.github/workflows/auto-close-stale-pr.yml @@ -10,7 +10,7 @@ jobs: permissions: pull-requests: write steps: - - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8 + - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9 with: days-before-issue-stale: -1 days-before-issue-close: -1 diff --git a/.github/workflows/automations.yml b/.github/workflows/automations.yml index 20210f28..175a134f 100644 --- a/.github/workflows/automations.yml +++ b/.github/workflows/automations.yml @@ -6,8 +6,6 @@ concurrency: on: push: - branches: - - unstable pull_request_target: jobs: diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index 759e7bd0..50a4d2ec 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -2,11 +2,10 @@ name: build-dev on: pull_request: - branches-ignore: - - master push: branches: - - unstable + - master + - "*.*.z" jobs: dev: @@ -23,7 +22,7 @@ jobs: run: npm run ropm - name: Build app run: npm run build - - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 + - uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4 with: name: Jellyfin-Roku-dev-${{ github.sha }} path: ${{ github.workspace }}/build/staging diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index b380a151..1f73cd51 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -3,7 +3,7 @@ name: build-docs on: push: branches: - - unstable + - master jobs: docs: diff --git a/.github/workflows/build-prod.yml b/.github/workflows/build-prod.yml index 87222600..4b42ae9b 100644 --- a/.github/workflows/build-prod.yml +++ b/.github/workflows/build-prod.yml @@ -1,64 +1,15 @@ +# Builds the production version of the app name: build-prod on: - pull_request: - branches: - - master push: branches: - master + - "*.*.z" jobs: - version-check: - runs-on: ubuntu-latest - steps: - - name: Checkout master (the latest release) - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - with: - ref: master - - name: Install jq to parse json - uses: awalsh128/cache-apt-pkgs-action@latest - with: - packages: jq - - name: Save old package.json version - run: echo "oldPackVersion=$(jq -r ".version" package.json)" >> $GITHUB_ENV - - name: Find and save old major_version from manifest - run: awk 'BEGIN { FS="=" } /^major_version/ { print "oldMajor="$2; }' manifest >> $GITHUB_ENV - - name: Find and save old minor_version from manifest - run: awk 'BEGIN { FS="=" } /^minor_version/ { print "oldMinor="$2; }' manifest >> $GITHUB_ENV - - name: Find and save old build_version from manifest - run: awk 'BEGIN { FS="=" } /^build_version/ { print "oldBuild="$2; }' manifest >> $GITHUB_ENV - - name: Save old manifest version - run: echo "oldManVersion=${{ env.oldMajor }}.${{ env.oldMinor }}.${{ env.oldBuild }}" >> $GITHUB_ENV - - name: Save old Makefile version - run: awk 'BEGIN { FS=" = " } /^VERSION/ { print "oldMakeVersion="$2; }' Makefile >> $GITHUB_ENV - - name: Checkout PR branch - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - - name: Save new package.json version - run: echo "newPackVersion=$(jq -r ".version" package.json)" >> $GITHUB_ENV - - name: package.json version must be updated - if: env.oldPackVersion == env.newPackVersion - run: exit 1 - - name: Find and save new major_version from manifest - run: awk 'BEGIN { FS="=" } /^major_version/ { print "newMajor="$2; }' manifest >> $GITHUB_ENV - - name: Find and save new minor_version from manifest - run: awk 'BEGIN { FS="=" } /^minor_version/ { print "newMinor="$2; }' manifest >> $GITHUB_ENV - - name: Find and save new build_version from manifest - run: awk 'BEGIN { FS="=" } /^build_version/ { print "newBuild="$2; }' manifest >> $GITHUB_ENV - - name: Save new manifest version - run: echo "newManVersion=${{ env.newMajor }}.${{ env.newMinor }}.${{ env.newBuild }}" >> $GITHUB_ENV - - name: Manifest version must be updated - if: env.oldManVersion == env.newManVersion - run: exit 1 - - name: Save new Makefile version - run: awk 'BEGIN { FS=" = " } /^VERSION/ { print "newMakeVersion="$2; }' Makefile >> $GITHUB_ENV - - name: Makefile version must be updated - if: env.oldMakeVersion == env.newMakeVersion - run: exit 1 - - name: All new versions must match - if: (env.newManVersion != env.newPackVersion) || (env.newManVersion != env.newMakeVersion) - run: exit 1 prod: + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'release-prep') }} runs-on: ubuntu-latest steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 @@ -72,7 +23,7 @@ jobs: run: npm run ropm - name: Build app for production run: npm run build-prod - - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 + - uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4 with: name: Jellyfin-Roku-v${{ env.newManVersion }}-${{ github.sha }} path: ${{ github.workspace }}/build/staging diff --git a/.github/workflows/deploy-api-docs.yml b/.github/workflows/deploy-api-docs.yml index 92b7eb9b..6a6a1ba0 100644 --- a/.github/workflows/deploy-api-docs.yml +++ b/.github/workflows/deploy-api-docs.yml @@ -3,7 +3,7 @@ name: deploy-api-docs on: push: - branches: ["unstable"] + branches: ["master"] paths: ["docs/**"] # only run if the docs are updated # Allows you to run this workflow manually from the Actions tab @@ -32,12 +32,12 @@ jobs: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - name: Setup Pages - uses: actions/configure-pages@f156874f8191504dae5b037505266ed5dda6c382 # v3 + uses: actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d # v4 - name: Upload artifact - uses: actions/upload-pages-artifact@a753861a5debcf57bf8b404356158c8e1e33150c # v2 + uses: actions/upload-pages-artifact@0252fc4ba7626f0298f0cf00902a25c6afc77fa8 # v3 with: # Only upload the api docs folder path: "docs/api" - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@9dbe3824824f8a1377b8e298bafde1a50ede43e5 # v2 + uses: actions/deploy-pages@7a9bd943aa5e5175aeb8502edcc6c1c02d398e10 # v4 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 349ee30a..1eebdf85 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,7 +2,6 @@ name: lint on: pull_request: - jobs: brightscript: runs-on: ubuntu-latest @@ -79,4 +78,4 @@ jobs: - name: Install roku package dependencies run: npx ropm install - name: Check markdown files for spelling errors - run: npm run lint-spelling \ No newline at end of file + run: npm run lint-spelling diff --git a/.github/workflows/release-prep.yml b/.github/workflows/release-prep.yml new file mode 100644 index 00000000..d6a892d9 --- /dev/null +++ b/.github/workflows/release-prep.yml @@ -0,0 +1,80 @@ +# All of the jobs in this workflow will only run if the PR that triggered it has a 'release-prep' label +name: release-prep + +on: + pull_request: + types: [labeled, opened, reopened, synchronize] + +jobs: + version-check: + if: ${{ contains(github.event.pull_request.labels.*.name, 'release-prep') }} + runs-on: ubuntu-latest + steps: + - name: DEBUG ${{ github.event.pull_request.base.ref }} + run: echo ${{ github.event.pull_request.base.ref }} + - name: Checkout the branch this PR wants to update + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + with: + ref: ${{ github.event.pull_request.base.ref }} + - name: Install jq to parse json + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: jq + - name: Save old package.json version + run: echo "oldPackVersion=$(jq -r ".version" package.json)" >> $GITHUB_ENV + - name: Find and save old major_version from manifest + run: awk 'BEGIN { FS="=" } /^major_version/ { print "oldMajor="$2; }' manifest >> $GITHUB_ENV + - name: Find and save old minor_version from manifest + run: awk 'BEGIN { FS="=" } /^minor_version/ { print "oldMinor="$2; }' manifest >> $GITHUB_ENV + - name: Find and save old build_version from manifest + run: awk 'BEGIN { FS="=" } /^build_version/ { print "oldBuild="$2; }' manifest >> $GITHUB_ENV + - name: Save old manifest version + run: echo "oldManVersion=${{ env.oldMajor }}.${{ env.oldMinor }}.${{ env.oldBuild }}" >> $GITHUB_ENV + - name: Save old Makefile version + run: awk 'BEGIN { FS=" := " } /^VERSION/ { print "oldMakeVersion="$2; }' Makefile >> $GITHUB_ENV + - name: Checkout PR branch + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + - name: Save new package.json version + run: echo "newPackVersion=$(jq -r ".version" package.json)" >> $GITHUB_ENV + - name: package.json version must be updated + if: env.oldPackVersion == env.newPackVersion + run: exit 1 + - name: Find and save new major_version from manifest + run: awk 'BEGIN { FS="=" } /^major_version/ { print "newMajor="$2; }' manifest >> $GITHUB_ENV + - name: Find and save new minor_version from manifest + run: awk 'BEGIN { FS="=" } /^minor_version/ { print "newMinor="$2; }' manifest >> $GITHUB_ENV + - name: Find and save new build_version from manifest + run: awk 'BEGIN { FS="=" } /^build_version/ { print "newBuild="$2; }' manifest >> $GITHUB_ENV + - name: Save new manifest version + run: echo "newManVersion=${{ env.newMajor }}.${{ env.newMinor }}.${{ env.newBuild }}" >> $GITHUB_ENV + - name: Manifest version must be updated + if: env.oldManVersion == env.newManVersion + run: exit 1 + - name: Save new Makefile version + run: awk 'BEGIN { FS=" := " } /^VERSION/ { print "newMakeVersion="$2; }' Makefile >> $GITHUB_ENV + - name: Makefile version must be updated + if: env.oldMakeVersion == env.newMakeVersion + run: exit 1 + - name: All new versions must match + if: (env.newManVersion != env.newPackVersion) || (env.newManVersion != env.newMakeVersion) + run: exit 1 + build-prod: + if: ${{ contains(github.event.pull_request.labels.*.name, 'release-prep') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4 + with: + node-version: "lts/*" + cache: "npm" + - name: NPM install + run: npm ci + - name: Install roku module dependencies + run: npm run ropm + - name: Build app for production + run: npm run build-prod + - uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4 + with: + name: Jellyfin-Roku-v${{ env.newManVersion }}-${{ github.sha }} + path: ${{ github.workspace }}/build/staging + if-no-files-found: error diff --git a/.github/workflows/roku-analysis.yml b/.github/workflows/roku-analysis.yml index 97a19d53..d83efb9f 100644 --- a/.github/workflows/roku-analysis.yml +++ b/.github/workflows/roku-analysis.yml @@ -27,7 +27,7 @@ jobs: if: env.BRANCH_NAME == 'master' run: npm run build-prod - name: Use Java 17 - uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3 + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4 with: distribution: "temurin" java-version: "17" diff --git a/.vscode/settings.json b/.vscode/settings.json index a005ef42..746c772b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,4 +18,4 @@ "docs/api/**": true }, "brightscriptcomment.addExtraAtStartAndEnd": false -} +} \ No newline at end of file diff --git a/Makefile b/Makefile index 46d7285d..ef0eade6 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # If you want to get_images, you'll also need convert from ImageMagick ########################################################################## -VERSION := 1.6.6 +VERSION := 2.0.1 ## usage diff --git a/components/Clock.bs b/components/Clock.bs index 2137a11c..4233643d 100644 --- a/components/Clock.bs +++ b/components/Clock.bs @@ -1,8 +1,16 @@ import "pkg:/source/utils/misc.bs" +' @fileoverview Clock component to display current time formatted based on user's chosen 12 or 24 hour setting + +' Possible clock formats +enum ClockFormat + h12 = "12h" + h24 = "24h" +end enum + sub init() - ' If hideclick setting is checked, exit without setting any variables + ' If hideclick setting is enabled, exit without setting any variables if m.global.session.user.settings["ui.design.hideclock"] return end if @@ -16,11 +24,11 @@ sub init() m.currentTimeTimer.control = "start" ' Default to 12 hour clock - m.format = "short-h12" + m.format = ClockFormat.h12 ' If user has selected a 24 hour clock, update date display format - if LCase(m.global.device.clockFormat) = "24h" - m.format = "short-h24" + if LCase(m.global.device.clockFormat) = ClockFormat.h24 + m.format = ClockFormat.h24 end if end sub @@ -34,6 +42,64 @@ sub onCurrentTimeTimerFire() ' Convert to local time zone m.dateTimeObject.ToLocalTime() - ' Format time as requested - m.clockTime.text = m.dateTimeObject.asTimeStringLoc(m.format) + ' Format time for display - based on 12h/24h setting + formattedTime = formatTimeAsString() + + ' Display time + m.clockTime.text = formattedTime end sub + +' formatTimeAsString: Returns a string with the current time formatted for either a 12 or 24 hour clock +' +' @return {string} current time formatted for either a 12 hour or 24 hour clock +function formatTimeAsString() as string + return m.format = ClockFormat.h12 ? format12HourTime() : format24HourTime() +end function + +' format12HourTime: Returns a string with the current time formatted for a 12 hour clock +' +' @return {string} current time formatted for a 12 hour clock +function format12HourTime() as string + currentHour = m.dateTimeObject.GetHours() + currentMinute = m.dateTimeObject.GetMinutes() + + displayedHour = StrI(currentHour).trim() + displayedMinute = StrI(currentMinute).trim() + meridian = currentHour < 12 ? "am" : "pm" + + if currentHour = 0 + displayedHour = "12" + end if + + if currentHour > 12 + correctedHour = currentHour - 12 + displayedHour = StrI(correctedHour).trim() + end if + + if currentMinute < 10 + displayedMinute = `0${displayedMinute}` + end if + + return `${displayedHour}:${displayedMinute} ${meridian}` +end function + +' format24HourTime: Returns a string with the current time formatted for a 24 hour clock +' +' @return {string} current time formatted for a 24 hour clock +function format24HourTime() as string + currentHour = m.dateTimeObject.GetHours() + currentMinute = m.dateTimeObject.GetMinutes() + + displayedHour = StrI(currentHour).trim() + displayedMinute = StrI(currentMinute).trim() + + if currentHour < 10 + displayedHour = `0${displayedHour}` + end if + + if currentMinute < 10 + displayedMinute = `0${displayedMinute}` + end if + + return `${displayedHour}:${displayedMinute}` +end function diff --git a/components/ItemGrid/GridItem.bs b/components/ItemGrid/GridItem.bs index 0015a8ea..e20e27cc 100644 --- a/components/ItemGrid/GridItem.bs +++ b/components/ItemGrid/GridItem.bs @@ -15,6 +15,10 @@ sub init() m.unplayedCount = m.top.findNode("unplayedCount") m.unplayedEpisodeCount = m.top.findNode("unplayedEpisodeCount") + m.playedIndicator = m.top.findNode("playedIndicator") + m.checkmark = m.top.findNode("checkmark") + m.checkmark.width = 90 + m.checkmark.height = 60 m.itemText.translation = [0, m.itemPoster.height + 7] @@ -44,6 +48,10 @@ sub itemContentChanged() if itemData = invalid then return if itemData.type = "Movie" + if isValid(itemData.json) and isValid(itemData.json.UserData) and isValid(itemData.json.UserData.Played) and itemData.json.UserData.Played + m.playedIndicator.visible = true + end if + m.itemPoster.uri = itemData.PosterUrl m.itemIcon.uri = itemData.iconUrl m.itemText.text = itemData.Title @@ -59,6 +67,9 @@ sub itemContentChanged() end if end if end if + if isValid(itemData.json) and isValid(itemData.json.UserData) and isValid(itemData.json.UserData.Played) and itemData.json.UserData.Played = true + m.playedIndicator.visible = true + end if m.itemPoster.uri = itemData.PosterUrl m.itemIcon.uri = itemData.iconUrl diff --git a/components/ItemGrid/GridItem.xml b/components/ItemGrid/GridItem.xml index 2bd177c8..06575753 100644 --- a/components/ItemGrid/GridItem.xml +++ b/components/ItemGrid/GridItem.xml @@ -4,9 +4,10 @@ - + +