Fix: Always reload channels on preview/add actions to prevent stale data
Changes: - Modified preview_changes_action to always reload channels before previewing - Modified add_streams_to_channels_action to always reload channels before adding streams - Removed file existence check that prevented reload when data was stale - This ensures deleted channels (like ES DAZN 09/10) won't cause warnings The processed data file is now refreshed on every preview/add operation, ensuring users always work with current channel data from the Dispatcharr API.
This commit is contained in:
@@ -2421,9 +2421,8 @@ class Plugin:
|
|||||||
|
|
||||||
def preview_changes_action(self, settings, logger, context=None):
|
def preview_changes_action(self, settings, logger, context=None):
|
||||||
"""Preview which streams will be added to channels without making changes."""
|
"""Preview which streams will be added to channels without making changes."""
|
||||||
# Auto-load channels if not already loaded
|
# Always reload channels to ensure fresh data
|
||||||
if not os.path.exists(self.processed_data_file):
|
logger.info("[Stream-Mapparr] Loading fresh channel and stream data...")
|
||||||
logger.info("[Stream-Mapparr] No processed data found, loading channels automatically...")
|
|
||||||
self._send_progress_update("preview_changes", 'running', 0, 'Loading channels and streams...', context)
|
self._send_progress_update("preview_changes", 'running', 0, 'Loading channels and streams...', context)
|
||||||
load_result = self.load_process_channels_action(settings, logger, context)
|
load_result = self.load_process_channels_action(settings, logger, context)
|
||||||
if load_result.get('status') != 'success':
|
if load_result.get('status') != 'success':
|
||||||
@@ -2596,9 +2595,8 @@ class Plugin:
|
|||||||
|
|
||||||
def add_streams_to_channels_action(self, settings, logger, is_scheduled=False, context=None):
|
def add_streams_to_channels_action(self, settings, logger, is_scheduled=False, context=None):
|
||||||
"""Add matching streams to channels and replace existing stream assignments."""
|
"""Add matching streams to channels and replace existing stream assignments."""
|
||||||
# Auto-load channels if not already loaded
|
# Always reload channels to ensure fresh data
|
||||||
if not os.path.exists(self.processed_data_file):
|
logger.info("[Stream-Mapparr] Loading fresh channel and stream data...")
|
||||||
logger.info("[Stream-Mapparr] No processed data found, loading channels automatically...")
|
|
||||||
self._send_progress_update("add_streams_to_channels", 'running', 0, 'Loading channels and streams...', context)
|
self._send_progress_update("add_streams_to_channels", 'running', 0, 'Loading channels and streams...', context)
|
||||||
load_result = self.load_process_channels_action(settings, logger, context)
|
load_result = self.load_process_channels_action(settings, logger, context)
|
||||||
if load_result.get('status') != 'success':
|
if load_result.get('status') != 'success':
|
||||||
|
|||||||
Reference in New Issue
Block a user