|
15 | 15 | ENCODING_UTF8, |
16 | 16 | apply_filters, |
17 | 17 | download_file, |
| 18 | + export_playlist, |
18 | 19 | get_filter_pool, |
19 | 20 | get_lines, |
20 | 21 | load_filters, |
21 | | - save_pl, |
22 | 22 | save_pl_to_path, |
23 | 23 | ) |
24 | 24 | from pliptv.models.streams import M3u, Stream |
@@ -139,24 +139,28 @@ def main(auto: bool, export: bool, is_generation_vod_enabled: bool, is_cache_ena |
139 | 139 | [res.get() for res in tqdm(multiple_results, desc="Live Tv processing")], |
140 | 140 | ) |
141 | 141 |
|
142 | | - log(f"Saving {m3u.name.capitalize()}", "white") |
143 | | - file_result = save_pl_to_path(m3u, str(pl_info.get("playlist_output_path"))) |
| 142 | + channels_list = M3u(m3u.name, list(filter(lambda x: not x.meta.is_vod and not x.meta.hidden, m3u))) |
| 143 | + log(f"Saving {m3u.name.capitalize()} with {len(channels_list.streams)} channels", "yellow") |
| 144 | + file_result = save_pl_to_path(channels_list, str(pl_info.get("playlist_output_path"))) |
| 145 | + |
144 | 146 | log(f"Generated playlist for {m3u.name.capitalize()}: {file_result}", "white") |
145 | 147 |
|
146 | 148 | if is_cache_enabled: |
147 | 149 | cache_playlist_generation(m3u) |
148 | 150 |
|
149 | 151 | if export: |
150 | | - url: str = save_pl(m3u) |
| 152 | + url: str = export_playlist(channels_list) |
151 | 153 | LOG.debug(f"Playlist Exported to: {url}", "white") |
152 | 154 |
|
153 | | - created_streams = vod_processing(is_generation_vod_enabled, pl_info, playlist_config, m3u) |
| 155 | + vod_created_streams = vod_processing(is_generation_vod_enabled, pl_info, playlist_config, m3u) |
| 156 | + if vod_created_streams: |
| 157 | + log(f"Processed {m3u.name.capitalize()} with {len(vod_created_streams)} channels", "yellow") |
154 | 158 |
|
155 | 159 | if is_cache_enabled: |
156 | 160 | cache_playlist_generation(m3u, "_final") |
157 | 161 |
|
158 | | - if created_streams: |
159 | | - cleanup(created_streams, str(pl_info.get("strm_output_path"))) |
| 162 | + if vod_created_streams: |
| 163 | + cleanup(vod_created_streams, str(pl_info.get("strm_output_path"))) |
160 | 164 |
|
161 | 165 | # Display report |
162 | 166 | # get_report(m3u) |
@@ -199,7 +203,7 @@ def vod_processing(vod: bool, pl_info: dict[str, Any], playlist_config: Playlist |
199 | 203 |
|
200 | 204 | accepted_cultures = AcceptedFilter(playlist_config).filter_config.language |
201 | 205 | vod_list: list[Stream] = list( |
202 | | - filter(lambda x: x.meta.isVod and not x.meta.hidden and str.lower(x.meta.culture) in accepted_cultures, m3u.streams) |
| 206 | + filter(lambda x: x.meta.is_vod and not x.meta.hidden and str.lower(x.meta.culture) in accepted_cultures, m3u.streams) |
203 | 207 | ) |
204 | 208 |
|
205 | 209 | created_streams: list[str] = [] |
|
0 commit comments