mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
Set size to int
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- The `size` column on the `Song` table would be dropped and recreated. This will lead to data loss if there is data in the column.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Song" DROP COLUMN "size",
|
||||||
|
ADD COLUMN "size" INTEGER;
|
||||||
@@ -390,7 +390,7 @@ model Song {
|
|||||||
releaseDate DateTime?
|
releaseDate DateTime?
|
||||||
releaseYear Int?
|
releaseYear Int?
|
||||||
duration Float
|
duration Float
|
||||||
size String?
|
size Int?
|
||||||
lyrics String?
|
lyrics String?
|
||||||
bitRate Int
|
bitRate Int
|
||||||
container String
|
container String
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ const insertSongGroup = async (
|
|||||||
artists: { connect: artistsConnect },
|
artists: { connect: artistsConnect },
|
||||||
bitRate: Math.floor(song.MediaSources[0].Bitrate / 1e3),
|
bitRate: Math.floor(song.MediaSources[0].Bitrate / 1e3),
|
||||||
container: song.MediaSources[0].Container,
|
container: song.MediaSources[0].Container,
|
||||||
|
deleted: false,
|
||||||
discNumber: song.ParentIndexNumber,
|
discNumber: song.ParentIndexNumber,
|
||||||
duration: Math.floor(song.MediaSources[0].RunTimeTicks / 1e7),
|
duration: Math.floor(song.MediaSources[0].RunTimeTicks / 1e7),
|
||||||
externals: { connect: externalsConnect },
|
externals: { connect: externalsConnect },
|
||||||
@@ -179,7 +180,7 @@ const insertSongGroup = async (
|
|||||||
remoteId: song.Id,
|
remoteId: song.Id,
|
||||||
serverFolders: { connect: { id: serverFolder.id } },
|
serverFolders: { connect: { id: serverFolder.id } },
|
||||||
serverId: server.id,
|
serverId: server.id,
|
||||||
size: String(song.MediaSources[0].Size),
|
size: song.MediaSources[0].Size,
|
||||||
sortName: song.Name,
|
sortName: song.Name,
|
||||||
trackNumber: song.IndexNumber,
|
trackNumber: song.IndexNumber,
|
||||||
},
|
},
|
||||||
@@ -187,6 +188,7 @@ const insertSongGroup = async (
|
|||||||
artists: { connect: artistsConnect },
|
artists: { connect: artistsConnect },
|
||||||
bitRate: Math.floor(song.MediaSources[0].Bitrate / 1e3),
|
bitRate: Math.floor(song.MediaSources[0].Bitrate / 1e3),
|
||||||
container: song.MediaSources[0].Container,
|
container: song.MediaSources[0].Container,
|
||||||
|
deleted: false,
|
||||||
discNumber: song.ParentIndexNumber,
|
discNumber: song.ParentIndexNumber,
|
||||||
duration: Math.floor(song.MediaSources[0].RunTimeTicks / 1e7),
|
duration: Math.floor(song.MediaSources[0].RunTimeTicks / 1e7),
|
||||||
externals: { connect: externalsConnect },
|
externals: { connect: externalsConnect },
|
||||||
@@ -204,6 +206,7 @@ const insertSongGroup = async (
|
|||||||
remoteId: song.Id,
|
remoteId: song.Id,
|
||||||
serverFolders: { connect: { id: serverFolder.id } },
|
serverFolders: { connect: { id: serverFolder.id } },
|
||||||
serverId: server.id,
|
serverId: server.id,
|
||||||
|
size: song.MediaSources[0].Size,
|
||||||
sortName: song.Name,
|
sortName: song.Name,
|
||||||
trackNumber: song.IndexNumber,
|
trackNumber: song.IndexNumber,
|
||||||
},
|
},
|
||||||
@@ -216,33 +219,6 @@ const insertSongGroup = async (
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// const artists = uniqBy(
|
|
||||||
// songs.flatMap((song) => {
|
|
||||||
// return song.ArtistItems.map((artist) => ({
|
|
||||||
// deleted: false,
|
|
||||||
// name: artist.Name,
|
|
||||||
// remoteId: artist.Id,
|
|
||||||
// serverFolders: { connect: { id: serverFolder.id } },
|
|
||||||
// serverId: server.id,
|
|
||||||
// sortName: '',
|
|
||||||
// }));
|
|
||||||
// }),
|
|
||||||
// 'remoteId'
|
|
||||||
// );
|
|
||||||
|
|
||||||
// for (const artist of artists) {
|
|
||||||
// await prisma.artist.upsert({
|
|
||||||
// create: artist,
|
|
||||||
// update: artist,
|
|
||||||
// where: {
|
|
||||||
// uniqueArtistId: {
|
|
||||||
// remoteId: artist.remoteId,
|
|
||||||
// serverId: server.id,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
const uniqueArtistIds = songs
|
const uniqueArtistIds = songs
|
||||||
.flatMap((song) => song.ArtistItems.flatMap((artist) => artist.Id))
|
.flatMap((song) => song.ArtistItems.flatMap((artist) => artist.Id))
|
||||||
.filter(uniqueArray);
|
.filter(uniqueArray);
|
||||||
|
|||||||
Reference in New Issue
Block a user