Skip to content

A self-hosted media server and file management system

chore: code smells

aminnausin4c3cbfb9661c
diff --git a/app/Jobs/Utility/Subtitles/ScanSubtitles.php b/app/Jobs/Utility/Subtitles/ScanSubtitles.php
index 62b96a1e..9554fcf7 100644
--- a/app/Jobs/Utility/Subtitles/ScanSubtitles.php
+++ b/app/Jobs/Utility/Subtitles/ScanSubtitles.php
@@ -109,7 +109,6 @@ class ScanSubtitles extends ManagedSubTask {
// absolute file path in storage
$filePath = VerifyFiles::getAbsoluteMediaPath($media);
$fileName = pathinfo($filePath, PATHINFO_FILENAME);
- // $folderPath = dirname($filePath);
// Embedded Subtitles - scanned only if file was updated
if ($fileUpdated) {
diff --git a/app/Jobs/VerifyFiles.php b/app/Jobs/VerifyFiles.php
index e6e46bfb..f0c3a3c9 100755
--- a/app/Jobs/VerifyFiles.php
+++ b/app/Jobs/VerifyFiles.php
@@ -23,7 +23,7 @@ class VerifyFiles extends ManagedSubTask {
protected $embedChain = [];
- protected $scannedDirectories = []; // TODO: this should really go in the indexer or a broken down part of the indexer
+ protected $scannedDirectories = []; // this could go in the indexer but realistically it is only scanning each directory once and caching the "result" to later batch actual subtitle indexing
protected $fileMetaData = [];
@@ -98,7 +98,6 @@ class VerifyFiles extends ManagedSubTask {
try {
foreach ($this->videos as $video) {
$baseName = basename($video->path);
- $fileName = pathinfo($video->path, PATHINFO_FILENAME);
$compositeId = $video->folder->path . '/' . $baseName;
// absolute file path in storage
@@ -216,12 +215,13 @@ class VerifyFiles extends ManagedSubTask {
$subtitleScanNeeded = ! $is_audio && (is_null($metadata->subtitles_scanned_at) || $fileUpdated || $dirUpdated);
if ($subtitleScanNeeded) {
- $changes['subtitles_scanned_at'] = null;
$this->scannedDirectories[$folderPath]['targets'][] = new SubtitleScanTarget(
uuid: $uuid,
- fileUpdated: $fileUpdated,
+ fileUpdated: $fileUpdated || is_null($metadata->subtitles_scanned_at), // If I dont check embedded by this null flag, "reset subtitles" no longer works so it needs to be authoritative?
);
+ $changes['subtitles_scanned_at'] = null;
+
if ($dirUpdated) {
$this->scannedDirectories[$folderPath]['dir_updated'] = true;
}
@@ -371,9 +371,7 @@ class VerifyFiles extends ManagedSubTask {
]
);
- $summary = 'Updated ' . count($metadataTransactions) . ' videos from id ' . ($metadataTransactions[0]['video_id']) . ' to ' . ($metadataTransactions[count($metadataTransactions) - 1]['video_id']);
-
- return $summary;
+ return 'Updated ' . count($metadataTransactions) . ' videos from id ' . ($metadataTransactions[0]['video_id']) . ' to ' . ($metadataTransactions[count($metadataTransactions) - 1]['video_id']);
} catch (\Throwable $th) {
$ids = array_column($metadataTransactions, 'id');
$this->handleError('Error inserting verified file metadata', $th, $ids, count($metadataTransactions));
diff --git a/resources/css/cedar-base.css b/resources/css/cedar-base.css
index 10740596..c220e99f 100644
--- a/resources/css/cedar-base.css
+++ b/resources/css/cedar-base.css
@@ -46,13 +46,12 @@
@layer utilities {
.scrollbar-hover {
- /* scrollbar-width: none; */
+ /* Instead of setting scrollbar-width to none, set opacity to 0 */
--scrollbar-opacity: 0;
}
.group:hover .scrollbar-hover,
.scrollbar-hover:hover {
- /* scrollbar-width: var(--width-scrollbar); */
--scrollbar-opacity: 1;
}
diff --git a/resources/css/theme.css b/resources/css/theme.css
index 3e232a54..e116b049 100644
--- a/resources/css/theme.css
+++ b/resources/css/theme.css
@@ -91,15 +91,12 @@
}
.scrollbar-minimal.scrollbar-hover::-webkit-scrollbar {
- /* width: 0rem; */
- /* height: 0rem; */
+ /* Instead of setting width and height to 0, set opacity to 0 */
--scrollbar-opacity: 0;
}
.group:hover .scrollbar-minimal.scrollbar-hover::-webkit-scrollbar,
.scrollbar-minimal.scrollbar-hover::-webkit-scrollbar:hover {
- /* width: var(--default-scrollbar-width); */
- /* height: var(--default-scrollbar-width); */
--scrollbar-opacity: 1;
}
}
diff --git a/resources/js/components/modals/ShareModal.vue b/resources/js/components/modals/ShareModal.vue
index ccf4d547..c8eccac4 100644
--- a/resources/js/components/modals/ShareModal.vue
+++ b/resources/js/components/modals/ShareModal.vue
@@ -28,7 +28,7 @@ const formatTimestamp = (value: string) => {
const parts = value
.split(':')
.reverse()
- .map((p) => parseInt(p) || 0);
+ .map((p) => Number.parseInt(p) || 0);
const multipliers = [1, 60, 3600];
const seconds = parts.reduce((total, part, i) => total + part * (multipliers[i] ?? 0), 0);