From cbd37ac8d882a05939db7b4ac3660423afb74a97 Mon Sep 17 00:00:00 2001 From: tapframe Date: Mon, 15 Sep 2025 17:53:23 +0530 Subject: [PATCH] repo cleanup --- .env.sentry-build-plugin | 1 - NOTIFICATION_INTEGRATION_SUMMARY.md | 232 ---------------------------- local-scrapers-repo | 1 - plan.md | 83 ---------- test-trailer-integration.js | 54 ------- xavia-ota | 1 - 6 files changed, 372 deletions(-) delete mode 100644 .env.sentry-build-plugin delete mode 100644 NOTIFICATION_INTEGRATION_SUMMARY.md delete mode 160000 local-scrapers-repo delete mode 100644 plan.md delete mode 100644 test-trailer-integration.js delete mode 160000 xavia-ota diff --git a/.env.sentry-build-plugin b/.env.sentry-build-plugin deleted file mode 100644 index 9ef4f71..0000000 --- a/.env.sentry-build-plugin +++ /dev/null @@ -1 +0,0 @@ -SENTRY_ALLOW_FAILURE=true \ No newline at end of file diff --git a/NOTIFICATION_INTEGRATION_SUMMARY.md b/NOTIFICATION_INTEGRATION_SUMMARY.md deleted file mode 100644 index cb96d94..0000000 --- a/NOTIFICATION_INTEGRATION_SUMMARY.md +++ /dev/null @@ -1,232 +0,0 @@ -# ๐Ÿ”” Comprehensive Notification Integration - Implementation Summary - -## โœ… **What Was Implemented** - -I've successfully integrated notifications with your library and Trakt system, adding automatic background notifications for all saved shows. Here's what's now working: - ---- - -## ๐Ÿš€ **1. Library Auto-Integration** - -### **Automatic Notification Setup** -- **When adding series to library**: Notifications are automatically scheduled for upcoming episodes -- **When removing series from library**: All related notifications are automatically cancelled -- **Real-time sync**: Changes to library immediately trigger notification updates - -### **Implementation Details:** -```typescript -// In catalogService.ts - Auto-setup when adding to library -public async addToLibrary(content: StreamingContent): Promise { - // ... existing code ... - - // Auto-setup notifications for series when added to library - if (content.type === 'series') { - await notificationService.updateNotificationsForSeries(content.id); - } -} -``` - ---- - -## ๐ŸŽฌ **2. Trakt Integration** - -### **Comprehensive Trakt Support** -- **Trakt Watchlist**: Automatically syncs notifications for shows in your Trakt watchlist -- **Trakt Collection**: Syncs notifications for shows in your Trakt collection -- **Background Sync**: Periodically checks Trakt for new shows and updates notifications -- **Authentication Handling**: Automatically detects when Trakt is connected/disconnected - -### **What Gets Synced:** -- All series from your Trakt watchlist -- All series from your Trakt collection -- Automatic deduplication with local library -- IMDB ID mapping for accurate show identification - ---- - -## โฐ **3. Background Notifications** - -### **Automatic Background Processing** -- **6-hour sync cycle**: Automatically syncs all notifications every 6 hours -- **App foreground sync**: Syncs when app comes to foreground -- **Library change sync**: Immediate sync when library changes -- **Trakt change detection**: Syncs when Trakt data changes - -### **Smart Episode Detection:** -- **4-week window**: Finds episodes airing in the next 4 weeks -- **Multiple data sources**: Uses Stremio first, falls back to TMDB -- **Duplicate prevention**: Won't schedule same episode twice -- **Automatic cleanup**: Removes old/expired notifications - ---- - -## ๐Ÿ“ฑ **4. Enhanced Settings Screen** - -### **New Features Added:** -- **Notification Stats Display**: Shows upcoming, this week, and total notifications -- **Manual Sync Button**: "Sync Library & Trakt" button for immediate sync -- **Real-time Stats**: Stats update automatically after sync -- **Visual Feedback**: Loading states and success messages - -### **Stats Dashboard:** -``` -๐Ÿ“… Upcoming: 12 ๐Ÿ“† This Week: 3 ๐Ÿ”” Total: 15 -``` - ---- - -## ๐Ÿ”ง **5. Technical Implementation** - -### **Enhanced NotificationService Features:** - -#### **Library Integration:** -```typescript -private setupLibraryIntegration(): void { - // Subscribe to library updates from catalog service - this.librarySubscription = catalogService.subscribeToLibraryUpdates(async (libraryItems) => { - await this.syncNotificationsForLibrary(libraryItems); - }); -} -``` - -#### **Trakt Integration:** -```typescript -private async syncTraktNotifications(): Promise { - // Get Trakt watchlist and collection shows - const [watchlistShows, collectionShows] = await Promise.all([ - traktService.getWatchlistShows(), - traktService.getCollectionShows() - ]); - // Sync notifications for each show -} -``` - -#### **Background Sync:** -```typescript -private setupBackgroundSync(): void { - // Sync notifications every 6 hours - this.backgroundSyncInterval = setInterval(async () => { - await this.performBackgroundSync(); - }, 6 * 60 * 60 * 1000); -} -``` - ---- - -## ๐Ÿ“Š **6. Data Sources & Fallbacks** - -### **Multi-Source Episode Detection:** -1. **Primary**: Stremio addon metadata -2. **Fallback**: TMDB API for episode air dates -3. **Smart Mapping**: Handles both IMDB IDs and TMDB IDs -4. **Season Detection**: Checks current and upcoming seasons - -### **Notification Content:** -``` -Title: "New Episode: Breaking Bad" -Body: "S5:E14 - Ozymandias is airing soon!" -Data: { seriesId: "tt0903747", episodeId: "..." } -``` - ---- - -## ๐ŸŽฏ **7. User Experience Improvements** - -### **Seamless Integration:** -- **Zero manual setup**: Works automatically when you add shows -- **Cross-platform sync**: Trakt integration keeps notifications in sync across devices -- **Smart timing**: Respects user's preferred notification timing (1h, 6h, 12h, 24h) -- **Battery optimized**: Efficient background processing - -### **Visual Feedback:** -- **Stats dashboard**: See exactly how many notifications are scheduled -- **Sync status**: Clear feedback when syncing completes -- **Error handling**: Graceful handling of API failures - ---- - -## ๐Ÿ”„ **8. Automatic Workflows** - -### **When You Add a Show to Library:** -1. Show is added to local library -2. Notification service automatically triggered -3. Upcoming episodes detected (next 4 weeks) -4. Notifications scheduled based on your timing preference -5. Stats updated in settings screen - -### **When You Add a Show to Trakt:** -1. Background sync detects new Trakt show (within 6 hours or on app open) -2. Show metadata fetched -3. Notifications scheduled automatically -4. No manual intervention required - -### **When Episodes Air:** -1. Notification delivered at your preferred time -2. Old notifications automatically cleaned up -3. Stats updated to reflect current state - ---- - -## ๐Ÿ“ˆ **9. Performance Optimizations** - -### **Efficient Processing:** -- **Batch operations**: Processes multiple shows efficiently -- **API rate limiting**: Includes delays to prevent overwhelming APIs -- **Memory management**: Cleans up old notifications automatically -- **Error resilience**: Continues processing even if individual shows fail - -### **Background Processing:** -- **Non-blocking**: Doesn't interfere with app performance -- **Intelligent scheduling**: Only syncs when necessary -- **Resource conscious**: Optimized for battery life - ---- - -## ๐ŸŽ‰ **10. What This Means for Users** - -### **Before:** -- Manual notification setup required -- No integration with library or Trakt -- Limited to manually added shows -- No background updates - -### **After:** -- โœ… **Automatic**: Add any show to library โ†’ notifications work automatically -- โœ… **Trakt Sync**: Your Trakt watchlist/collection โ†’ automatic notifications -- โœ… **Background**: Always up-to-date without manual intervention -- โœ… **Smart**: Finds episodes from multiple sources -- โœ… **Visual**: Clear stats and sync controls - ---- - -## ๐Ÿ”ง **11. How to Use** - -### **For Library Shows:** -1. Add any series to your library (heart icon) -2. Notifications automatically scheduled -3. Check stats in Settings โ†’ Notification Settings - -### **For Trakt Shows:** -1. Connect your Trakt account -2. Add shows to Trakt watchlist or collection -3. Notifications sync automatically (within 6 hours or on app open) -4. Use "Sync Library & Trakt" button for immediate sync - -### **Manual Control:** -- Go to Settings โ†’ Notification Settings -- View notification stats -- Use "Sync Library & Trakt" for immediate sync -- Adjust timing preferences (1h, 6h, 12h, 24h before airing) - ---- - -## ๐Ÿš€ **Result** - -Your notification system now provides a **Netflix-like experience** where: -- Adding shows automatically sets up notifications -- Trakt integration keeps everything in sync -- Background processing ensures you never miss episodes -- Smart episode detection works across multiple data sources -- Visual feedback shows exactly what's scheduled - -The system is now **fully automated** and **user-friendly**, requiring zero manual setup while providing comprehensive coverage of all your shows from both local library and Trakt integration. \ No newline at end of file diff --git a/local-scrapers-repo b/local-scrapers-repo deleted file mode 160000 index c2435eb..0000000 --- a/local-scrapers-repo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c2435eb4a7467fc13eb232526ab6fea867062c22 diff --git a/plan.md b/plan.md deleted file mode 100644 index f82ed14..0000000 --- a/plan.md +++ /dev/null @@ -1,83 +0,0 @@ -# HomeScreen Analysis and Improvement Plan - -This document outlines the analysis of the `HomeScreen.tsx` component and suggests potential improvements. - -## Analysis - -**Strengths:** - -1. **Component Structure:** Good use of breaking down UI into smaller, reusable components (`ContentItem`, `DropUpMenu`, `SkeletonCatalog`, `SkeletonFeatured`, `ThisWeekSection`, `ContinueWatchingSection`). -2. **Performance Optimizations:** - * Uses `FlatList` for horizontal catalogs with optimizations (`initialNumToRender`, `maxToRenderPerBatch`, `windowSize`, `removeClippedSubviews`, `getItemLayout`). - * Uses `expo-image` for optimized image loading, caching, and prefetching (`ExpoImage.prefetch`). Includes loading/error states per image. - * Leverages `useCallback` to memoize event handlers and functions. - * Uses `react-native-reanimated` and `react-native-gesture-handler` for performant animations/gestures. - * Parallel initial data loading (`Promise.all`). - * Uses `AbortController` to cancel stale fetch requests. -3. **User Experience:** - * Skeleton loaders (`SkeletonFeatured`, `SkeletonCatalog`). - * Pull-to-refresh (`RefreshControl`). - * Interactive `DropUpMenu` with smooth animations and gesture dismissal. - * Haptics feedback (`Haptics.impactAsync`). - * Reactive library status updates (`catalogService.subscribeToLibraryUpdates`). - * Screen focus events refresh "Continue Watching". - * Graceful handling of empty catalog states. -4. **Code Quality:** - * Uses TypeScript with interfaces. - * Separation of concerns via services (`catalogService`, `tmdbService`, `storageService`, `logger`). - * Basic error handling and logging. - -## Areas for Potential Improvement & Suggestions - -1. **Component Complexity (`HomeScreen`):** - * The main component is large and manages significant state/effects. - * **Suggestion:** Extract data fetching and related state into custom hooks (e.g., `useFeaturedContent`, `useHomeCatalogs`) to simplify `HomeScreen`. - * *Example Hook Structure:* - ```typescript - // hooks/useHomeCatalogs.ts - function useHomeCatalogs() { - const [catalogs, setCatalogs] = useState([]); - const [loading, setLoading] = useState(true); - // ... fetch logic from loadCatalogs ... - return { catalogs, loading, reloadCatalogs: loadCatalogs }; - } - ``` - -2. **Outer `FlatList` for Catalogs:** - * Using `FlatList` with `scrollEnabled={false}` disables its virtualization benefits. - * **Suggestion:** If the number of catalogs can grow large, this might impact performance. For a small, fixed number of catalogs, rendering directly in the `ScrollView` using `.map()` might be simpler. If virtualization is needed for many catalogs, revisit the structure (potentially enabling scroll on the outer `FlatList`, which can be complex with nested scrolling). - -3. **Hardcoded Values:** - * `GENRE_MAP`: TMDB genres can change. - * **Suggestion:** Fetch genre lists from the TMDB API (`/genre/movie/list`, `/genre/tv/list`) periodically and cache them (e.g., in context or async storage). - * `SAMPLE_CATEGORIES`: Ensure replacement if dynamic categories are needed. - -4. **Image Preloading Strategy:** - * `preloadImages` currently tries to preload posters, banners, and logos for *all* fetched featured items. - * **Suggestion:** If the trending list is long, this is bandwidth-intensive. Consider preloading only for the *initially selected* `featuredContent` or the first few items in the `allFeaturedContent` array to optimize resource usage. - -5. **Error Handling & Retries:** - * The `maxRetries` variable is defined but not used. - * **Suggestion:** Implement retry logic (e.g., with exponential backoff) in `catch` blocks for `loadCatalogs` and `loadFeaturedContent`, or remove the unused variable. Enhance user feedback on errors beyond console logs (e.g., Toast messages). - -6. **Type Safety (`StyleSheet.create`):** - * Styles use `StyleSheet.create`. - * **Suggestion:** Define a specific interface for styles using `ViewStyle`, `TextStyle`, `ImageStyle` from `react-native` for better type safety and autocompletion. - ```typescript - import { ViewStyle, TextStyle, ImageStyle } from 'react-native'; - - interface Styles { - container: ViewStyle; - // ... other styles - } - - const styles = StyleSheet.create({ ... }); - ``` - -7. **Featured Content Interaction:** - * The "Info" button fetches `stremioId` asynchronously. - * **Suggestion:** Add a loading indicator (e.g., disable button + `ActivityIndicator`) during the `getStremioId` call for better UX feedback. - -8. **Featured Content Rotation:** - * Auto-rotation is fixed at 15 seconds. - * **Suggestion (Minor UX):** Consider adding visual indicators (e.g., dots) for featured items, allow manual swiping, and pause the auto-rotation timer on user interaction. \ No newline at end of file diff --git a/test-trailer-integration.js b/test-trailer-integration.js deleted file mode 100644 index 2433781..0000000 --- a/test-trailer-integration.js +++ /dev/null @@ -1,54 +0,0 @@ -// Quick test to verify TrailerService integration -// Run this from the main Nuvio directory - -const TrailerService = require('./src/services/trailerService.ts'); - -async function testTrailerIntegration() { - console.log('๐Ÿงช Testing TrailerService Integration...\n'); - - // Test 1: Check server status - console.log('1๏ธโƒฃ Server Status:'); - const status = TrailerService.getServerStatus(); - console.log('โœ… Using Local Server:', status.usingLocal); - console.log('๐Ÿ”— Local URL:', status.localUrl); - console.log('๐Ÿ”— XPrime URL:', status.xprimeUrl); - - console.log('\n'); - - // Test 2: Try to fetch a trailer - console.log('2๏ธโƒฃ Testing trailer fetch...'); - try { - const trailerUrl = await TrailerService.getTrailerUrl('Test Movie', 2023); - if (trailerUrl) { - console.log('โœ… Trailer URL fetched successfully!'); - console.log('๐Ÿ”— URL:', trailerUrl.substring(0, 80) + '...'); - } else { - console.log('โŒ No trailer URL returned'); - } - } catch (error) { - console.log('โŒ Error fetching trailer:', error.message); - } - - console.log('\n'); - - // Test 3: Test trailer data - console.log('3๏ธโƒฃ Testing trailer data...'); - try { - const trailerData = await TrailerService.getTrailerData('Test Movie', 2023); - if (trailerData) { - console.log('โœ… Trailer data fetched successfully!'); - console.log('๐Ÿ“น Title:', trailerData.title); - console.log('๐Ÿ“… Year:', trailerData.year); - console.log('๐Ÿ”— URL:', trailerData.url.substring(0, 80) + '...'); - } else { - console.log('โŒ No trailer data returned'); - } - } catch (error) { - console.log('โŒ Error fetching trailer data:', error.message); - } - - console.log('\n๐Ÿ Integration test complete!'); -} - -// Run the test -testTrailerIntegration().catch(console.error); diff --git a/xavia-ota b/xavia-ota deleted file mode 160000 index 32919f9..0000000 --- a/xavia-ota +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 32919f9cb06e4f2cfa77978bd8c1fb612ba9581f