shvchenko commited on
Commit
e042ee3
·
verified ·
1 Parent(s): 797a623

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -52,14 +52,10 @@ def process_playlist(m3u_content):
52
  elif current_section == 'events':
53
  # Remove 24/7 group-title if mistakenly present
54
  line = re.sub(r'group-title="24/7 CHANNELS[^"]*"', '', line)
55
- # Only append Events lines (exclude 24/7 channels)
56
- if 'group-title="24/7 CHANNELS' not in line:
57
- m3u_events.append(line)
58
  else:
59
- # Keep non-EXTINF lines (comments, etc.) in both playlists
60
- if not line.startswith('#EXTINF'):
61
- m3u_24_7.append(line)
62
- m3u_events.append(line)
63
 
64
  log_lines = []
65
 
@@ -86,6 +82,7 @@ def process_playlist(m3u_content):
86
  break
87
 
88
  new_tvg_id = channels_ref[match_key]['tvg_id'] if match_key else 'Live.Event.us'
 
89
  if 'tvg-id="test"' in line:
90
  new_tvg_id = 'Live.Event.us'
91
  else:
@@ -94,10 +91,6 @@ def process_playlist(m3u_content):
94
  if 'tvg-id="test"' in line:
95
  new_tvg_id = 'Info.Guide.Dummy.us'
96
 
97
- # Remove group-title in Events lines
98
- if is_event:
99
- line = re.sub(r'group-title="[^"]*"', '', line)
100
-
101
  if 'tvg-id=' in line:
102
  line = re.sub(r'tvg-id=".*?"', f'tvg-id="{new_tvg_id}"', line)
103
  else:
 
52
  elif current_section == 'events':
53
  # Remove 24/7 group-title if mistakenly present
54
  line = re.sub(r'group-title="24/7 CHANNELS[^"]*"', '', line)
55
+ m3u_events.append(line)
 
 
56
  else:
57
+ m3u_24_7.append(line)
58
+ m3u_events.append(line)
 
 
59
 
60
  log_lines = []
61
 
 
82
  break
83
 
84
  new_tvg_id = channels_ref[match_key]['tvg_id'] if match_key else 'Live.Event.us'
85
+ # Replace any tvg-id="test" with Live.Event.us
86
  if 'tvg-id="test"' in line:
87
  new_tvg_id = 'Live.Event.us'
88
  else:
 
91
  if 'tvg-id="test"' in line:
92
  new_tvg_id = 'Info.Guide.Dummy.us'
93
 
 
 
 
 
94
  if 'tvg-id=' in line:
95
  line = re.sub(r'tvg-id=".*?"', f'tvg-id="{new_tvg_id}"', line)
96
  else: