Compare commits
1
Commits
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { Ionicons } from "@expo/vector-icons"
|
||||
import { SongSwipeRow } from "@/components/song-swipe-row"
|
||||
import {
|
||||
useSwipeRowGroup,
|
||||
@@ -231,11 +232,10 @@ export default function AlbumScreen() {
|
||||
}
|
||||
>
|
||||
<Pressable hitSlop={8}>
|
||||
<PaletteIcon
|
||||
tone="foreground"
|
||||
<Ionicons
|
||||
name="ellipsis-horizontal"
|
||||
size={22}
|
||||
color={palette.isDark ? "#fff" : "#000"}
|
||||
color={colors.foreground}
|
||||
/>
|
||||
</Pressable>
|
||||
</MediaActionMenu>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Ionicons } from "@expo/vector-icons"
|
||||
import {
|
||||
CollectionHero,
|
||||
useCollectionHeroLayout,
|
||||
@@ -179,6 +180,7 @@ function PlaylistContent({
|
||||
}) {
|
||||
const router = useRouter()
|
||||
const isFocused = useIsFocused()
|
||||
const colors = useThemeColors()
|
||||
const { playPlaylist, playPlaylistShuffled, playFromSong } =
|
||||
usePlaybackActions()
|
||||
const { isSongFavorite } = useFavorites()
|
||||
@@ -299,11 +301,10 @@ function PlaylistContent({
|
||||
onAction={handlePlaylistMenuAction}
|
||||
>
|
||||
<Pressable hitSlop={8}>
|
||||
<PaletteIcon
|
||||
tone="foreground"
|
||||
<Ionicons
|
||||
name="ellipsis-horizontal"
|
||||
size={22}
|
||||
color={palette.isDark ? "#fff" : "#000"}
|
||||
color={colors.foreground}
|
||||
/>
|
||||
</Pressable>
|
||||
</MediaActionMenu>
|
||||
@@ -311,6 +312,7 @@ function PlaylistContent({
|
||||
}
|
||||
}, [
|
||||
canEdit,
|
||||
colors.foreground,
|
||||
deletePlaylist,
|
||||
handlePlaylistDetailAction,
|
||||
palette.foreground,
|
||||
|
||||
@@ -68,21 +68,6 @@ async function coverPathIfExists(path: string): Promise<string | null> {
|
||||
.catch(() => null)
|
||||
}
|
||||
|
||||
async function shouldReplaceCover(dbCover: string | null) {
|
||||
return dbCover === null || (await coverPathIfExists(dbCover)) === null
|
||||
}
|
||||
|
||||
function isCodecPath(filePath: string, codec: string) {
|
||||
return filePath.startsWith(`${DATA_DIR}/${codec}/`)
|
||||
}
|
||||
|
||||
function releaseDate(common: music.ICommonTagsResult) {
|
||||
if (common.date) {
|
||||
return common.date
|
||||
}
|
||||
return common.year ? `01-01-${common.year}` : ""
|
||||
}
|
||||
|
||||
async function syncArtistCover(
|
||||
ctx: ActionCtx,
|
||||
codec: string,
|
||||
@@ -92,13 +77,13 @@ async function syncArtistCover(
|
||||
) {
|
||||
const onDisk = await coverPathIfExists(diskPath)
|
||||
if (onDisk !== null) {
|
||||
if (await shouldReplaceCover(dbCover)) {
|
||||
if (dbCover !== onDisk) {
|
||||
await ctx.runMutation(internal.library.updateArtistCover, {
|
||||
id,
|
||||
cover: onDisk,
|
||||
})
|
||||
}
|
||||
} else if (dbCover !== null && isCodecPath(dbCover, codec)) {
|
||||
} else if (dbCover !== null && dbCover.includes(codec)) {
|
||||
await ctx.runMutation(internal.library.updateArtistCover, {
|
||||
id,
|
||||
cover: null,
|
||||
@@ -115,13 +100,13 @@ async function syncAlbumCover(
|
||||
) {
|
||||
const onDisk = await coverPathIfExists(diskPath)
|
||||
if (onDisk !== null) {
|
||||
if (await shouldReplaceCover(dbCover)) {
|
||||
if (dbCover !== onDisk) {
|
||||
await ctx.runMutation(internal.library.updateAlbumCover, {
|
||||
id,
|
||||
cover: onDisk,
|
||||
})
|
||||
}
|
||||
} else if (dbCover !== null && isCodecPath(dbCover, codec)) {
|
||||
} else if (dbCover !== null && dbCover.includes(codec)) {
|
||||
await ctx.runMutation(internal.library.updateAlbumCover, {
|
||||
id,
|
||||
cover: null,
|
||||
@@ -417,8 +402,9 @@ export const scheduledUpdateLibrary = internalAction({
|
||||
name: metadata.common.album || potentialAlbum,
|
||||
folder: potentialAlbum,
|
||||
cover,
|
||||
year: metadata.common.year || 0,
|
||||
date: releaseDate(metadata.common),
|
||||
year: metadata.common.year || 2026,
|
||||
date:
|
||||
metadata.common.date || `01-01-${metadata.common.year || 2026}`,
|
||||
artist: dbArtist._id,
|
||||
})
|
||||
} catch {}
|
||||
@@ -508,14 +494,11 @@ export const scheduledUpdateLibrary = internalAction({
|
||||
)
|
||||
|
||||
if (existingSong) {
|
||||
// A tracked path that still exists is a different file with the
|
||||
// same title; replacing it would flip-flop between scans.
|
||||
const trackedPath = existingSong.files[codec]
|
||||
if (
|
||||
trackedPath === undefined ||
|
||||
!fsSync.existsSync(trackedPath)
|
||||
!(codec in existingSong.files) ||
|
||||
existingSong.files[codec] !== path
|
||||
) {
|
||||
const update = { ...existingSong.files, [codec]: path }
|
||||
const update = { [codec]: path, ...existingSong.files }
|
||||
updateSongs.push({
|
||||
id: existingSong._id,
|
||||
files: update,
|
||||
@@ -567,8 +550,10 @@ export const scheduledUpdateLibrary = internalAction({
|
||||
? null
|
||||
: metadata.common.disk.no,
|
||||
track: metadata.common.track.no || 0,
|
||||
year: metadata.common.year || 0,
|
||||
date: releaseDate(metadata.common),
|
||||
year: metadata.common.year || 2026,
|
||||
date:
|
||||
metadata.common.date ||
|
||||
`01-01-${metadata.common.year || 2026}`,
|
||||
genres: metadata.common.genre || [],
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user