[Enhancement] Simple ratings from audible.com

This commit is contained in:
danny.rich 2025-11-03 13:46:51 -05:00
parent 0c7b738b7c
commit 831d50320c
13 changed files with 202 additions and 3 deletions

View file

@ -45,6 +45,11 @@
</p>
<p v-else class="mb-2 mt-0.5 text-gray-200 text-xl">by Unknown</p>
<div v-if="ratingValue > 0 && !isPodcast" class="flex items-center mb-2 mt-1">
<span v-for="i in 5" :key="i" class="material-symbols text-sm mr-0.5" :class="ratingValue >= i - 0.5 ? 'text-warning fill' : 'text-gray-500'">{{ ratingValue >= i ? 'star' : ratingValue >= i - 0.5 ? 'star_half' : 'star_border' }}</span>
<span class="ml-1 text-gray-300">{{ ratingValue.toFixed(1) }}</span>
</div>
<content-library-item-details :library-item="libraryItem" />
</div>
<div class="hidden md:block grow" />
@ -280,6 +285,17 @@ export default {
authors() {
return this.mediaMetadata.authors || []
},
asin() {
return this.mediaMetadata?.asin || null
},
rating() {
return this.mediaMetadata?.rating || null
},
ratingValue() {
if (!this.rating) return 0
const value = typeof this.rating === 'object' && this.rating.average ? this.rating.average : Number(this.rating)
return isNaN(value) || value <= 0 ? 0 : value
},
series() {
return this.mediaMetadata.series || []
},