diff --git a/media.db b/media.db index fbd3112..6e59859 100644 Binary files a/media.db and b/media.db differ diff --git a/src/app/api/files/route.ts b/src/app/api/files/route.ts index fd15f9b..9092650 100644 --- a/src/app/api/files/route.ts +++ b/src/app/api/files/route.ts @@ -20,10 +20,10 @@ export async function GET(request: Request) { // Get media files from database for this path const mediaFiles = db.prepare(` - SELECT id, path, type, thumbnail + SELECT id, path, type, thumbnail, avg_rating, star_count FROM media WHERE path LIKE ? - `).all(`${dirPath}%`) as Array<{id: number, path: string, type: string, thumbnail: string | null}>; + `).all(`${dirPath}%`) as Array<{id: number, path: string, type: string, thumbnail: string | null, avg_rating: number, star_count: number}>; const result = files.map((file) => { const filePath = path.join(dirPath, file); @@ -48,6 +48,8 @@ export async function GET(request: Request) { type: mediaFile?.type || type, thumbnail: mediaFile?.thumbnail, id: mediaFile?.id, + avg_rating: mediaFile?.avg_rating || 0, + star_count: mediaFile?.star_count || 0, }; }); diff --git a/src/app/folder-viewer/page.tsx b/src/app/folder-viewer/page.tsx index d3f9204..5b6fce2 100644 --- a/src/app/folder-viewer/page.tsx +++ b/src/app/folder-viewer/page.tsx @@ -3,7 +3,8 @@ import { useState, useEffect, Suspense } from "react"; import { useSearchParams, useRouter } from "next/navigation"; -import { Folder, File, Image, Film, Play, ChevronLeft, Home } from "lucide-react"; +import { Folder, File, Image, Film, Play, ChevronLeft, Home, Star } from "lucide-react"; +import { StarRating } from "@/components/star-rating"; import Link from "next/link"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import PhotoViewer from "@/components/photo-viewer"; @@ -18,6 +19,8 @@ interface FileSystemItem { thumbnail?: string; type?: string; id?: number; + avg_rating?: number; + star_count?: number; } interface BreadcrumbItem { @@ -364,6 +367,19 @@ const FolderViewerPage = () => {
{item.name}
+ + {/* Star Rating for media files */} + {isMediaFile(item) && (item.avg_rating || 0) > 0 && ( +{formatFileSize(item.size)}
{!item.isDirectory && ( diff --git a/src/app/videos/page.tsx b/src/app/videos/page.tsx index fa8e0bd..96f2d9f 100644 --- a/src/app/videos/page.tsx +++ b/src/app/videos/page.tsx @@ -2,11 +2,12 @@ import { useState, useEffect } from "react"; import Link from "next/link"; -import { Film, Play, Clock, HardDrive, Search, Filter } from "lucide-react"; +import { Film, Play, Clock, HardDrive, Search, Filter, Star } from "lucide-react"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import VideoViewer from "@/components/video-viewer"; +import { StarRating } from "@/components/star-rating"; interface Video { id: number; @@ -225,6 +226,19 @@ const VideosPage = () => {