A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
fix: code smells
aminnausinb301634b3eb7
diff --git a/app/Services/External/LrcLibService.php b/app/Services/External/LrcLibService.phpindex 943bf35d..b286b1eb 100644--- a/app/Services/External/LrcLibService.php+++ b/app/Services/External/LrcLibService.php@@ -16,7 +16,7 @@ class LrcLibService {'artist_name' => $metadata->artist ?? explode(' - ', $metadata->description)[0],'album_name' => $metadata->album,'duration' => $metadata->duration,- ], fn ($value) => $value !== null && $value !== '');+ ], fn($value) => $value !== null && $value !== '');$response = Http::get($url, $query);@@ -29,7 +29,7 @@ class LrcLibService {return ['lrclib' => $response->json(), 'payload' => $query];}- public function searchLyrics(Metadata $metadata, Request $request): array {+ public function searchLyrics(Metadata $_, Request $request): array {$url = 'https://lrclib.net/api/search';// This should not use the defaults so that the user can edit the search to blanks@@ -37,7 +37,7 @@ class LrcLibService {'track_name' => $request->query('track'), // ?? $metadata->title,'artist_name' => $request->query('artist'), // ?? $metadata->artist ?? explode(' - ', $metadata->description)[0],'album_name' => $request->query('album'), // ?? $metadata->album,- ], fn ($value) => $value !== null && $value !== '');+ ], fn($value) => $value !== null && $value !== '');$response = Http::get($url, $query);diff --git a/resources/js/components/forms/EditLyrics.vue b/resources/js/components/forms/EditLyrics.vueindex 8dc2d91a..b361d93f 100644--- a/resources/js/components/forms/EditLyrics.vue+++ b/resources/js/components/forms/EditLyrics.vue@@ -156,13 +156,13 @@ watch(/><ButtonText :disabled="isLoadingLyrics" @click="resetLyrics" class="*:text-center sm:px-3" text="Reset Lyrics" title="Reset Lyrics" />- <p class="xs:ml-auto min-w-fit text-center text-nowrap" v-show="hasSearchedForLyrics && searchResults.length">Results: {{ searchResults.length }}</p>+ <p class="xs:ml-auto min-w-fit text-center text-nowrap" v-show="hasSearchedForLyrics && searchResults?.length">Results: {{ searchResults?.length }}</p></div>- <div class="flex w-full flex-col gap-2" v-if="isLoadingLyrics || hasSearchedForLyrics || searchResults.length !== 0">+ <div class="flex w-full flex-col gap-2" v-if="isLoadingLyrics || hasSearchedForLyrics || searchResults?.length !== 0"><LrcLibCard v-for="result in searchResults" :key="result.id" :data="result" @preview="handlePreviewLyrics(result)" @select="handleSelectLyrics(result)" />- <TableLoadingSpinner v-if="isLoadingLyrics || (hasSearchedForLyrics && searchResults.length === 0)" :is-loading="isLoadingLyrics" class="text-sm" />+ <TableLoadingSpinner v-if="isLoadingLyrics || (hasSearchedForLyrics && searchResults?.length === 0)" :is-loading="isLoadingLyrics" class="text-sm" /></div><div class="text-danger-2 w-full text-center dark:text-rose-400" v-if="changedMetadata.isDirty">diff --git a/resources/js/components/video/VideoPlayer.vue b/resources/js/components/video/VideoPlayer.vueindex ca1fa773..492894de 100755--- a/resources/js/components/video/VideoPlayer.vue+++ b/resources/js/components/video/VideoPlayer.vue@@ -309,6 +309,7 @@ const videoPopoverItems = computed(() => {disabled: getScreenSize() !== 'default' || isAudio.value || stateFolder.value.is_majority_audio,action: () => {isShowingLyrics.value = !isShowingLyrics.value;+ //default url can be (for later) `/data/subtitles/${stateVideo.metadata.uuid}/2.vtt`},},{@@ -1137,7 +1138,7 @@ defineExpose({aria-describedby="Play/Pause"controlsList="nodownload">- <!-- <track v-if="stateVideo.metadata" kind="captions" label="English" srclang="en" :src="`/data/subtitles/${stateVideo.metadata.uuid}/2.vtt`" /> -->+ <track v-if="stateVideo.metadata" kind="captions" label="English" srclang="en" :src="''" />Your browser does not support the video tag.</video><sectiondiff --git a/resources/js/composables/useTable.ts b/resources/js/composables/useTable.tsindex 1345bca9..5ea757be 100644--- a/resources/js/composables/useTable.ts+++ b/resources/js/composables/useTable.ts@@ -1,4 +1,3 @@-// import type { UseTableOptions } from '@/types/types';import type { UseTableOptions } from '@aminnausin/cedar-ui';import { computed, ref, toRef, watch } from 'vue';diff --git a/resources/js/service/player/frameService.test.ts b/resources/js/service/player/frameService.test.tsindex 3869c1b5..802842d0 100644--- a/resources/js/service/player/frameService.test.ts+++ b/resources/js/service/player/frameService.test.ts@@ -49,13 +49,6 @@ describe('frameService', () => {describe('saveVideoFrame', () => {it('saves the frame and shows a success toast', async () => {- const aClick = vi.fn();- const mockAnchor = {- click: aClick,- set href(_: any) {},- set download(_: any) {},- };-const video = createMockVideo();await saveVideoFrame(video);diff --git a/sonar-project.properties b/sonar-project.propertiesindex 09b5ed60..4d856eb0 100644--- a/sonar-project.properties+++ b/sonar-project.properties@@ -1,7 +1,13 @@-sonar.exclusions=resources/js/components/pulse/**,resources/js/components/icons/**,resources/js/components/pulseCards/**,resources/js/components-archive/**+sonar.exclusions=\+resources/js/components/pulse/**,\+resources/js/components/icons/**,\+resources/js/components/pulseCards/**,\+resources/js/components-archive/**+sonar.projectBaseDir=.sonar.issue.ignore.multicriteria=e1sonar.issue.ignore.multicriteria.e1.ruleKey=typescript:S2686sonar.issue.ignore.multicriteria.e1.resourceKey=resources/js/**/*.tssonar.typescript.tsconfigPath=tsconfig.app.json+