mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-01-11 20:10:25 +00:00
some fixes
This commit is contained in:
parent
1683c915b9
commit
e41e6cfb46
3 changed files with 47 additions and 4 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 4584f97614bc10382bd5f37edb762ee73dc7bc1c
|
||||
Subproject commit 14cf821b7b126a418c7fb671719f151037948140
|
||||
|
|
@ -150,6 +150,10 @@ const createStyles = (colors: any) => StyleSheet.create({
|
|||
fontSize: 12,
|
||||
color: colors.mediumGray,
|
||||
},
|
||||
scraperLanguage: {
|
||||
fontSize: 12,
|
||||
color: colors.mediumGray,
|
||||
},
|
||||
settingRow: {
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
|
|
@ -646,6 +650,14 @@ const ScraperSettingsScreen: React.FC = () => {
|
|||
<Text style={[styles.scraperTypes, !settings.enableLocalScrapers && styles.disabledText]}>
|
||||
{scraper.supportedTypes.join(', ')}
|
||||
</Text>
|
||||
{scraper.contentLanguage && Array.isArray(scraper.contentLanguage) && scraper.contentLanguage.length > 0 && (
|
||||
<>
|
||||
<Text style={[styles.scraperDot, !settings.enableLocalScrapers && styles.disabledText]}>•</Text>
|
||||
<Text style={[styles.scraperLanguage, !settings.enableLocalScrapers && styles.disabledText]}>
|
||||
{scraper.contentLanguage.map(lang => lang.toUpperCase()).join(', ')}
|
||||
</Text>
|
||||
</>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
<Switch
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ export interface ScraperInfo {
|
|||
supportedTypes: ('movie' | 'tv')[];
|
||||
enabled: boolean;
|
||||
logo?: string;
|
||||
contentLanguage?: string[];
|
||||
}
|
||||
|
||||
export interface LocalScraperResult {
|
||||
|
|
@ -78,6 +79,12 @@ class LocalScraperService {
|
|||
if (storedScrapers) {
|
||||
const scrapers: ScraperInfo[] = JSON.parse(storedScrapers);
|
||||
scrapers.forEach(scraper => {
|
||||
// Ensure contentLanguage is an array (migration for older scrapers)
|
||||
if (!scraper.contentLanguage) {
|
||||
scraper.contentLanguage = ['en']; // Default to English
|
||||
} else if (typeof scraper.contentLanguage === 'string') {
|
||||
scraper.contentLanguage = [scraper.contentLanguage]; // Convert string to array
|
||||
}
|
||||
this.installedScrapers.set(scraper.id, scraper);
|
||||
});
|
||||
}
|
||||
|
|
@ -85,6 +92,17 @@ class LocalScraperService {
|
|||
// Load scraper code from cache
|
||||
await this.loadScraperCode();
|
||||
|
||||
// Auto-refresh repository on app startup if URL is configured
|
||||
if (this.repositoryUrl) {
|
||||
try {
|
||||
logger.log('[LocalScraperService] Auto-refreshing repository on startup');
|
||||
await this.performRepositoryRefresh();
|
||||
} catch (error) {
|
||||
logger.error('[LocalScraperService] Auto-refresh failed on startup:', error);
|
||||
// Don't fail initialization if auto-refresh fails
|
||||
}
|
||||
}
|
||||
|
||||
this.initialized = true;
|
||||
logger.log('[LocalScraperService] Initialized with', this.installedScrapers.size, 'scrapers');
|
||||
} catch (error) {
|
||||
|
|
@ -115,7 +133,11 @@ class LocalScraperService {
|
|||
// Fetch and install scrapers from repository
|
||||
async refreshRepository(): Promise<void> {
|
||||
await this.ensureInitialized();
|
||||
|
||||
await this.performRepositoryRefresh();
|
||||
}
|
||||
|
||||
// Internal method to refresh repository without initialization check
|
||||
private async performRepositoryRefresh(): Promise<void> {
|
||||
if (!this.repositoryUrl) {
|
||||
throw new Error('No repository URL configured');
|
||||
}
|
||||
|
|
@ -160,10 +182,19 @@ class LocalScraperService {
|
|||
const scraperCode = response.data;
|
||||
|
||||
// Store scraper info and code
|
||||
this.installedScrapers.set(scraperInfo.id, {
|
||||
const updatedScraperInfo = {
|
||||
...scraperInfo,
|
||||
enabled: this.installedScrapers.get(scraperInfo.id)?.enabled ?? true // Preserve enabled state
|
||||
});
|
||||
};
|
||||
|
||||
// Ensure contentLanguage is an array (migration for older scrapers)
|
||||
if (!updatedScraperInfo.contentLanguage) {
|
||||
updatedScraperInfo.contentLanguage = ['en']; // Default to English
|
||||
} else if (typeof updatedScraperInfo.contentLanguage === 'string') {
|
||||
updatedScraperInfo.contentLanguage = [updatedScraperInfo.contentLanguage]; // Convert string to array
|
||||
}
|
||||
|
||||
this.installedScrapers.set(scraperInfo.id, updatedScraperInfo);
|
||||
|
||||
this.scraperCode.set(scraperInfo.id, scraperCode);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue