KekikStream 0.3.4__py3-none-any.whl → 0.3.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
KekikStream/__init__.py CHANGED
@@ -7,250 +7,238 @@ from asyncio import run
7
7
 
8
8
  class KekikStream:
9
9
  def __init__(self):
10
- self.plugin_manager = PluginManager()
11
- self.extractor_manager = ExtractorManager()
12
- self.ui_manager = UIManager()
13
- self.media_manager = MediaManager()
14
- self.current_plugin:PluginBase = None
15
-
16
- async def run(self):
17
- self.ui_manager.clear_console()
10
+ self.eklentiler_yonetici = PluginManager()
11
+ self.cikaricilar_yonetici = ExtractorManager()
12
+ self.arayuz_yonetici = UIManager()
13
+ self.medya_yonetici = MediaManager()
14
+ self.suanki_eklenti: PluginBase = None
15
+
16
+ async def baslat(self):
17
+ self.arayuz_yonetici.clear_console()
18
18
  konsol.rule("[bold cyan]KekikStream Başlatılıyor[/bold cyan]")
19
- if not self.plugin_manager.get_plugin_names():
20
- konsol.print("[bold red]Hiçbir eklenti bulunamadı![/bold red]")
21
- return
19
+ if not self.eklentiler_yonetici.get_plugin_names():
20
+ return konsol.print("[bold red]Hiçbir eklenti bulunamadı![/bold red]")
22
21
 
23
22
  try:
24
- await self.select_plugin()
23
+ await self.eklenti_secimi()
25
24
  finally:
26
- await self.plugin_manager.close_plugins()
25
+ await self.eklentiler_yonetici.close_plugins()
27
26
 
28
- async def handle_no_results(self):
29
- action = await self.ui_manager.select_from_list(
27
+ async def sonuc_bulunamadi(self):
28
+ secim = await self.arayuz_yonetici.select_from_list(
30
29
  message = "Ne yapmak istersiniz?",
31
30
  choices = ["Tüm Eklentilerde Ara", "Ana Menü", "Çıkış"]
32
31
  )
33
32
 
34
- match action:
33
+ match secim:
35
34
  case "Tüm Eklentilerde Ara":
36
- await self.search_all()
35
+ await self.tum_eklentilerde_arama()
37
36
  case "Ana Menü":
38
- await self.run()
37
+ await self.baslat()
39
38
  case "Çıkış":
40
39
  cikis_yap(False)
41
40
 
42
- async def select_plugin(self):
43
- plugin_name = await self.ui_manager.select_from_fuzzy(
41
+ async def eklenti_secimi(self):
42
+ eklenti_adi = await self.arayuz_yonetici.select_from_fuzzy(
44
43
  message = "Arama yapılacak eklentiyi seçin:",
45
- choices = ["Tüm Eklentilerde Ara", *self.plugin_manager.get_plugin_names()]
44
+ choices = ["Tüm Eklentilerde Ara", *self.eklentiler_yonetici.get_plugin_names()]
46
45
  )
47
46
 
48
- if plugin_name == "Tüm Eklentilerde Ara":
49
- await self.search_all()
47
+ if eklenti_adi == "Tüm Eklentilerde Ara":
48
+ await self.tum_eklentilerde_arama()
50
49
  else:
51
- self.current_plugin = self.plugin_manager.select_plugin(plugin_name)
52
- await self.search_single_plugin()
50
+ self.suanki_eklenti = self.eklentiler_yonetici.select_plugin(eklenti_adi)
51
+ await self.eklenti_ile_arama()
53
52
 
54
- async def search_single_plugin(self):
55
- self.ui_manager.clear_console()
56
- konsol.rule(f"[bold cyan]{self.current_plugin.name} Eklentisinde Arama Yapın[/bold cyan]")
53
+ async def eklenti_ile_arama(self):
54
+ self.arayuz_yonetici.clear_console()
55
+ konsol.rule(f"[bold cyan]{self.suanki_eklenti.name} Eklentisinde Arama Yapın[/bold cyan]")
57
56
 
58
- query = await self.ui_manager.prompt_text("Arama sorgusu girin:")
59
- results = await self.current_plugin.search(query)
57
+ sorgu = await self.arayuz_yonetici.prompt_text("Arama sorgusu girin:")
58
+ sonuclar = await self.suanki_eklenti.search(sorgu)
60
59
 
61
- if not results:
60
+ if not sonuclar:
62
61
  konsol.print("[bold red]Arama sonucu bulunamadı![/bold red]")
63
- return await self.handle_no_results()
64
-
65
- selected_result = await self.select_result(results)
62
+ return await self.sonuc_bulunamadi()
66
63
 
67
- if selected_result:
68
- await self.show_details({"plugin": self.current_plugin.name, "url": selected_result})
64
+ if secilen_sonuc := await self.sonuc_secimi(sonuclar):
65
+ await self.sonuc_detaylari_goster({"plugin": self.suanki_eklenti.name, "url": secilen_sonuc})
69
66
 
70
- async def search_all(self):
71
- self.ui_manager.clear_console()
67
+ async def tum_eklentilerde_arama(self):
68
+ self.arayuz_yonetici.clear_console()
72
69
  konsol.rule("[bold cyan]Tüm Eklentilerde Arama Yapın[/bold cyan]")
73
70
 
74
- query = await self.ui_manager.prompt_text("Arama sorgusu girin:")
75
- results = await self.search_all_plugins(query)
71
+ sorgu = await self.arayuz_yonetici.prompt_text("Arama sorgusu girin:")
72
+ sonuclar = await self.tum_eklentilerde_arama_sorgula(sorgu)
76
73
 
77
- if not results:
78
- return await self.handle_no_results()
74
+ if not sonuclar:
75
+ return await self.sonuc_bulunamadi()
79
76
 
80
- selected_result = await self.select_from_all_results(results)
77
+ secilen_sonuc = await self.tum_sonuc_secimi(sonuclar)
81
78
 
82
- if selected_result:
83
- await self.show_details(selected_result)
79
+ if secilen_sonuc:
80
+ await self.sonuc_detaylari_goster(secilen_sonuc)
84
81
 
85
- async def select_result(self, results):
86
- selected_url = await self.ui_manager.select_from_fuzzy(
82
+ async def sonuc_secimi(self, sonuclar):
83
+ return await self.arayuz_yonetici.select_from_fuzzy(
87
84
  message = "İçerik sonuçlarından birini seçin:",
88
- choices = [{"name": res.title, "value": res.url} for res in results]
85
+ choices = [{"name": sonuc.title, "value": sonuc.url} for sonuc in sonuclar]
89
86
  )
90
87
 
91
- if selected_url:
92
- return selected_url
88
+ async def tum_eklentilerde_arama_sorgula(self, sorgu: str):
89
+ tum_sonuclar = []
90
+
91
+ for eklenti_adi, eklenti in self.eklentiler_yonetici.plugins.items():
92
+ if not isinstance(eklenti, PluginBase):
93
+ konsol.print(f"[yellow][!] {eklenti_adi} geçerli bir PluginBase değil, atlanıyor...[/yellow]")
94
+ continue
95
+
96
+ konsol.log(f"[yellow][~] {eklenti_adi:<19} aranıyor...[/]")
97
+ try:
98
+ sonuclar = await eklenti.search(sorgu)
99
+ if sonuclar:
100
+ tum_sonuclar.extend(
101
+ [{"plugin": eklenti_adi, "title": sonuc.title, "url": sonuc.url, "poster": sonuc.poster} for sonuc in sonuclar]
102
+ )
103
+ except Exception as hata:
104
+ konsol.print(f"[bold red]{eklenti_adi} » hata oluştu: {hata}[/bold red]")
105
+
106
+ if not tum_sonuclar:
107
+ konsol.print("[bold red]Hiçbir sonuç bulunamadı![/bold red]")
108
+ await self.sonuc_bulunamadi()
109
+ return []
110
+
111
+ return tum_sonuclar
112
+
113
+ async def tum_sonuc_secimi(self, sonuclar):
114
+ secenekler = [
115
+ {"name": f"{f'[{sonuc["plugin"]}]':<21} » {sonuc['title']}", "value": sonuc}
116
+ for sonuc in sonuclar
117
+ ]
118
+
119
+ return await self.arayuz_yonetici.select_from_fuzzy(
120
+ message = "Arama sonuçlarından bir içerik seçin:",
121
+ choices = secenekler
122
+ )
93
123
 
94
- async def show_details(self, selected_result):
124
+ async def sonuc_detaylari_goster(self, secilen_sonuc):
95
125
  try:
96
- if isinstance(selected_result, dict) and "plugin" in selected_result:
97
- plugin_name = selected_result["plugin"]
98
- url = selected_result["url"]
126
+ if isinstance(secilen_sonuc, dict) and "plugin" in secilen_sonuc:
127
+ eklenti_adi = secilen_sonuc["plugin"]
128
+ url = secilen_sonuc["url"]
99
129
 
100
- self.current_plugin = self.plugin_manager.select_plugin(plugin_name)
130
+ self.suanki_eklenti = self.eklentiler_yonetici.select_plugin(eklenti_adi)
101
131
  else:
102
- url = selected_result
132
+ url = secilen_sonuc
103
133
 
104
- media_info = await self.current_plugin.load_item(url)
134
+ medya_bilgi = await self.suanki_eklenti.load_item(url)
105
135
  except Exception as hata:
106
- konsol.log(selected_result)
107
- hata_yakala(hata)
108
- return
136
+ konsol.log(secilen_sonuc)
137
+ return hata_yakala(hata)
109
138
 
110
- self.media_manager.set_title(f"{self.current_plugin.name} | {media_info.title}")
139
+ self.medya_yonetici.set_title(f"{self.suanki_eklenti.name} | {medya_bilgi.title}")
140
+ self.arayuz_yonetici.display_media_info(f"{self.suanki_eklenti.name} | {medya_bilgi.title}", medya_bilgi)
111
141
 
112
- self.ui_manager.display_media_info(f"{self.current_plugin.name} | {media_info.title}", media_info)
113
-
114
- if isinstance(media_info, SeriesInfo):
115
- selected_episode = await self.ui_manager.select_from_fuzzy(
142
+ if isinstance(medya_bilgi, SeriesInfo):
143
+ secilen_bolum = await self.arayuz_yonetici.select_from_fuzzy(
116
144
  message = "İzlemek istediğiniz bölümü seçin:",
117
145
  choices = [
118
- {"name": f"{episode.season}. Sezon {episode.episode}. Bölüm - {episode.title}", "value": episode.url}
119
- for episode in media_info.episodes
146
+ {"name": f"{bolum.season}. Sezon {bolum.episode}. Bölüm - {bolum.title}", "value": bolum.url}
147
+ for bolum in medya_bilgi.episodes
120
148
  ]
121
149
  )
122
- if selected_episode:
123
- links = await self.current_plugin.load_links(selected_episode)
124
- await self.show_options(links)
150
+ if secilen_bolum:
151
+ baglantilar = await self.suanki_eklenti.load_links(secilen_bolum)
152
+ await self.baglanti_secenekleri_goster(baglantilar)
125
153
  else:
126
- links = await self.current_plugin.load_links(media_info.url)
127
- await self.show_options(links)
154
+ baglantilar = await self.suanki_eklenti.load_links(medya_bilgi.url)
155
+ await self.baglanti_secenekleri_goster(baglantilar)
128
156
 
129
- async def show_options(self, links):
130
- if not links:
157
+ async def baglanti_secenekleri_goster(self, baglantilar):
158
+ if not baglantilar:
131
159
  konsol.print("[bold red]Hiçbir bağlantı bulunamadı![/bold red]")
132
- return await self.handle_no_results()
160
+ return await self.sonuc_bulunamadi()
133
161
 
134
- mapping = self.extractor_manager.map_links_to_extractors(links)
135
- has_play_method = hasattr(self.current_plugin, "play") and callable(getattr(self.current_plugin, "play", None))
162
+ haritalama = self.cikaricilar_yonetici.map_links_to_extractors(baglantilar)
163
+ play_fonksiyonu_var = hasattr(self.suanki_eklenti, "play") and callable(getattr(self.suanki_eklenti, "play", None))
136
164
  # ! DEBUG
137
- # konsol.print(links)
138
- if not mapping and not has_play_method:
165
+ # konsol.print(baglantilar)
166
+ if not haritalama and not play_fonksiyonu_var:
139
167
  konsol.print("[bold red]Hiçbir Extractor bulunamadı![/bold red]")
140
- konsol.print(links)
141
- return await self.handle_no_results()
168
+ konsol.print(baglantilar)
169
+ return await self.sonuc_bulunamadi()
142
170
 
143
- if not mapping:
144
- selected_link = await self.ui_manager.select_from_list(
171
+ if not haritalama:
172
+ secilen_link = await self.arayuz_yonetici.select_from_list(
145
173
  message = "Doğrudan oynatmak için bir bağlantı seçin:",
146
- choices = [{"name": self.current_plugin.name, "value": link} for link in links]
174
+ choices = [{"name": self.suanki_eklenti.name, "value": link} for link in baglantilar]
147
175
  )
148
- if selected_link:
149
- await self.play_media(selected_link)
176
+ if secilen_link:
177
+ await self.medya_oynat(secilen_link)
150
178
  return
151
179
 
152
- action = await self.ui_manager.select_from_list(
180
+ secim = await self.arayuz_yonetici.select_from_list(
153
181
  message = "Ne yapmak istersiniz?",
154
- choices = ["İzle", "Geri Git", "Ana Menü"]
182
+ choices = ["İzle", "Tüm Eklentilerde Ara", "Ana Menü"]
155
183
  )
156
184
 
157
- match action:
185
+ match secim:
158
186
  case "İzle":
159
- selected_link = await self.ui_manager.select_from_list(
160
- message = "İzlemek için bir bağlantı seçin:",
161
- choices = [{"name": extractor_name, "value": link} for link, extractor_name in mapping.items()]
187
+ secilen_link = await self.arayuz_yonetici.select_from_list(
188
+ message = "İzlemek için bir bağlantı seçin:",
189
+ choices = [{"name": cikarici_adi, "value": link} for link, cikarici_adi in haritalama.items()]
162
190
  )
163
- if selected_link:
164
- await self.play_media(selected_link)
191
+ if secilen_link:
192
+ await self.medya_oynat(secilen_link)
165
193
 
166
- case "Geri Git":
167
- await self.search_all()
194
+ case "Tüm Eklentilerde Ara":
195
+ await self.tum_eklentilerde_arama()
168
196
 
169
197
  case _:
170
- await self.run()
171
-
172
- async def play_media(self, selected_link):
173
- if hasattr(self.current_plugin, "play") and callable(self.current_plugin.play):
174
- konsol.log(f"[yellow][»] Oynatılıyor : {selected_link}")
175
- await self.current_plugin.play(
176
- name = self.current_plugin._data[selected_link]["name"],
177
- url = selected_link,
178
- referer = self.current_plugin._data[selected_link]["referer"],
179
- subtitles = self.current_plugin._data[selected_link]["subtitles"]
198
+ await self.baslat()
199
+
200
+ async def medya_oynat(self, secilen_link):
201
+ if hasattr(self.suanki_eklenti, "play") and callable(self.suanki_eklenti.play):
202
+ konsol.log(f"[yellow][»] Oynatılıyor : {secilen_link}")
203
+ return await self.suanki_eklenti.play(
204
+ name = self.suanki_eklenti._data[secilen_link]["name"],
205
+ url = secilen_link,
206
+ referer = self.suanki_eklenti._data[secilen_link]["referer"],
207
+ subtitles = self.suanki_eklenti._data[secilen_link]["subtitles"]
180
208
  )
181
- return
182
209
 
183
- extractor: ExtractorBase = self.extractor_manager.find_extractor(selected_link)
184
- if not extractor:
185
- konsol.print("[bold red]Uygun Extractor bulunamadı.[/bold red]")
186
- return
210
+ cikarici: ExtractorBase = self.cikaricilar_yonetici.find_extractor(secilen_link)
211
+ if not cikarici:
212
+ return konsol.print("[bold red]Uygun Extractor bulunamadı.[/bold red]")
187
213
 
188
214
  try:
189
- extract_data = await extractor.extract(selected_link, referer=self.current_plugin.main_url)
215
+ extract_data = await cikarici.extract(secilen_link, referer=self.suanki_eklenti.main_url)
190
216
  except Exception as hata:
191
- konsol.print(f"[bold red]{extractor.name} » hata oluştu: {hata}[/bold red]")
192
- await self.handle_no_results()
193
- return
217
+ konsol.print(f"[bold red]{cikarici.name} » hata oluştu: {hata}[/bold red]")
218
+ return await self.sonuc_bulunamadi()
194
219
 
195
220
  if isinstance(extract_data, list):
196
- selected_data = await self.ui_manager.select_from_list(
221
+ secilen_data = await self.arayuz_yonetici.select_from_list(
197
222
  message = "Birden fazla bağlantı bulundu, lütfen birini seçin:",
198
223
  choices = [{"name": data.name, "value": data} for data in extract_data]
199
224
  )
200
225
  else:
201
- selected_data = extract_data
202
-
203
- if selected_data.headers.get("Cookie"):
204
- self.media_manager.set_headers({"Cookie": selected_data.headers.get("Cookie")})
205
-
206
- self.media_manager.set_title(f"{self.media_manager.get_title()} | {selected_data.name}")
207
- self.media_manager.set_headers({"Referer": selected_data.referer})
208
- konsol.log(f"[yellow][»] Oynatılıyor : {selected_data.url}")
209
- self.media_manager.play_media(selected_data)
210
-
211
- async def search_all_plugins(self, query: str):
212
- all_results = []
213
-
214
- for plugin_name, plugin in self.plugin_manager.plugins.items():
215
- if not isinstance(plugin, PluginBase):
216
- konsol.print(f"[yellow][!] {plugin_name} geçerli bir PluginBase değil, atlanıyor...[/yellow]")
217
- continue
218
-
219
- konsol.log(f"[yellow][~] {plugin_name:<19} aranıyor...[/]")
220
- try:
221
- results = await plugin.search(query)
222
- if results:
223
- all_results.extend(
224
- [{"plugin": plugin_name, "title": result.title, "url": result.url, "poster": result.poster} for result in results]
225
- )
226
- except Exception as hata:
227
- konsol.print(f"[bold red]{plugin_name} » hata oluştu: {hata}[/bold red]")
228
-
229
- if not all_results:
230
- konsol.print("[bold red]Hiçbir sonuç bulunamadı![/bold red]")
231
- await self.handle_no_results()
232
- return []
226
+ secilen_data = extract_data
233
227
 
234
- return all_results
235
-
236
- async def select_from_all_results(self, results):
237
- choices = [
238
- {"name": f"{f'[{res["plugin"]}]':<21} » {res['title']}", "value": res}
239
- for res in results
240
- ]
241
-
242
- return await self.ui_manager.select_from_fuzzy(
243
- message = "Arama sonuçlarından bir içerik seçin:",
244
- choices = choices
245
- )
228
+ if secilen_data.headers.get("Cookie"):
229
+ self.medya_yonetici.set_headers({"Cookie": secilen_data.headers.get("Cookie")})
246
230
 
231
+ self.medya_yonetici.set_title(f"{self.medya_yonetici.get_title()} | {secilen_data.name}")
232
+ self.medya_yonetici.set_headers({"Referer": secilen_data.referer})
233
+ konsol.log(f"[yellow][»] Oynatılıyor : {secilen_data.url}")
234
+ self.medya_yonetici.play_media(secilen_data)
247
235
 
248
236
  def basla():
249
237
  try:
250
238
  pypi_kontrol_guncelle("KekikStream")
251
239
 
252
240
  app = KekikStream()
253
- run(app.run())
241
+ run(app.baslat())
254
242
  cikis_yap(False)
255
243
  except KeyboardInterrupt:
256
244
  cikis_yap(True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: KekikStream
3
- Version: 0.3.4
3
+ Version: 0.3.6
4
4
  Summary: terminal üzerinden medya içeriği aramanızı ve VLC/MPV gibi popüler medya oynatıcılar aracılığıyla doğrudan izlemenizi sağlayan modüler ve genişletilebilir bir bıdı bıdı
5
5
  Home-page: https://github.com/keyiflerolsun/KekikStream
6
6
  Author: keyiflerolsun
@@ -1,4 +1,4 @@
1
- KekikStream/__init__.py,sha256=pJHtYOA6scyErUitzWhmXjANoFx0Qs33U4eeUbh9lV4,10285
1
+ KekikStream/__init__.py,sha256=2eeeKoB1PVLyD23grIko7YDx2jbRJPk6YzSK4-LIE8k,10458
2
2
  KekikStream/__main__.py,sha256=4U-NO1f0Mts5Mf_QnWhWqRbTsRBy2y2VPlpHyaqG9_I,137
3
3
  KekikStream/requirements.txt,sha256=gS_TUUQx5A7FUmRGxj2dQedxheD7qA6AswdUb2y_Ub8,70
4
4
  KekikStream/CLI/__init__.py,sha256=U6oLq_O7u5y2eHhBnmfhZNns_EqHHJXJmzl8jvZFUNY,230
@@ -48,9 +48,9 @@ KekikStream/Plugins/JetFilmizle.py,sha256=DPdvTEns8r2MI9pHY8d9EEsUZmlQU7N2C9yr8o
48
48
  KekikStream/Plugins/SezonlukDizi.py,sha256=5BZVzQ2eQtymHxO0bzjA2ho4FFNahPFQly4hoHuH8lo,4441
49
49
  KekikStream/Plugins/SineWix.py,sha256=ZtcIwPW0ONGkSjT7Ye8b71RWdHZMUZefX-JTWu6uGSs,4854
50
50
  KekikStream/Plugins/UgurFilm.py,sha256=yYXee5uxwNnPqFJZ6s6cRkmUyqS3Vv8x-iesPalc4j4,2930
51
- KekikStream-0.3.4.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
52
- KekikStream-0.3.4.dist-info/METADATA,sha256=VogZzlECQ2r9uzo5aXlpVfsVh3vsx-7fFSE4zq_c2Ok,3987
53
- KekikStream-0.3.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
54
- KekikStream-0.3.4.dist-info/entry_points.txt,sha256=dFwdiTx8djyehI0Gsz-rZwjAfZzUzoBSrmzRu9ubjJc,50
55
- KekikStream-0.3.4.dist-info/top_level.txt,sha256=DNmGJDXl27Drdfobrak8KYLmocW_uznVYFJOzcjUgmY,12
56
- KekikStream-0.3.4.dist-info/RECORD,,
51
+ KekikStream-0.3.6.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
52
+ KekikStream-0.3.6.dist-info/METADATA,sha256=bEpxnxF4AbzzSAwo8BWWo1xQ2AV9Ubk1QDefzNImYbg,3987
53
+ KekikStream-0.3.6.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
54
+ KekikStream-0.3.6.dist-info/entry_points.txt,sha256=dFwdiTx8djyehI0Gsz-rZwjAfZzUzoBSrmzRu9ubjJc,50
55
+ KekikStream-0.3.6.dist-info/top_level.txt,sha256=DNmGJDXl27Drdfobrak8KYLmocW_uznVYFJOzcjUgmY,12
56
+ KekikStream-0.3.6.dist-info/RECORD,,