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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -52,10 +52,14 @@ 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
- m3u_events.append(line)
 
 
56
  else:
57
- m3u_24_7.append(line)
58
- m3u_events.append(line)
 
 
59
 
60
  log_lines = []
61
 
@@ -82,7 +86,6 @@ def process_playlist(m3u_content):
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,7 +94,7 @@ def process_playlist(m3u_content):
91
  if 'tvg-id="test"' in line:
92
  new_tvg_id = 'Info.Guide.Dummy.us'
93
 
94
- # Remove test group-title from Events lines
95
  if is_event:
96
  line = re.sub(r'group-title="[^"]*"', '', line)
97
 
@@ -133,4 +136,4 @@ demo = gr.Interface(
133
  description="Paste the M3U8 playlist content. Updates 24/7 and Events channels tvg-id using channels_fixed.json with smart Events matching."
134
  )
135
 
136
- demo.launch()
 
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
  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
  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
 
 
136
  description="Paste the M3U8 playlist content. Updates 24/7 and Events channels tvg-id using channels_fixed.json with smart Events matching."
137
  )
138
 
139
+ demo.launch()