StreamingCommunity 3.0.7__py3-none-any.whl → 3.0.8__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.

Potentially problematic release.


This version of StreamingCommunity might be problematic. Click here for more details.

@@ -31,7 +31,8 @@ class ScrapSerie:
31
31
  self.client = httpx.Client(
32
32
  cookies={"sessionId": self.session_id},
33
33
  headers={"User-Agent": get_userAgent(), "csrf-token": self.csrf_token},
34
- base_url=full_url
34
+ base_url=full_url,
35
+ verify=False
35
36
  )
36
37
 
37
38
  try:
@@ -21,7 +21,7 @@ from .film import download_film
21
21
  # Variable
22
22
  indice = 5
23
23
  _useFor = "Film_&_Serie"
24
- _priority = 1 # NOTE: Site search need the use of tmbd obj
24
+ _priority = 0
25
25
  _engineDownload = "hls"
26
26
  _deprecate = False
27
27
 
@@ -1,9 +1,5 @@
1
1
  # 21.05.24
2
2
 
3
- import threading
4
- import queue
5
-
6
-
7
3
  # External libraries
8
4
  import httpx
9
5
  from rich.console import Console
@@ -13,12 +9,9 @@ from rich.console import Console
13
9
  from StreamingCommunity.Util.config_json import config_manager
14
10
  from StreamingCommunity.Util.headers import get_userAgent
15
11
  from StreamingCommunity.Util.table import TVShowManager
16
- from StreamingCommunity.Lib.TMBD.tmdb import tmdb
17
-
18
-
19
- # Logic class
20
12
  from StreamingCommunity.Api.Template.config_loader import site_constant
21
13
  from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
14
+ from .util.ScrapeSerie import GetSerieInfo
22
15
 
23
16
 
24
17
  # Variable
@@ -26,76 +19,33 @@ console = Console()
26
19
  media_search_manager = MediaManager()
27
20
  table_show_manager = TVShowManager()
28
21
  max_timeout = config_manager.get_int("REQUESTS", "timeout")
29
- MAX_THREADS = 12
30
22
 
31
23
 
32
- def determine_media_type(title):
24
+ def determine_media_type(item):
33
25
  """
34
- Use TMDB to determine if a title is a movie or TV show.
26
+ Determine if the item is a film or TV series by checking actual seasons count
27
+ using GetSerieInfo.
35
28
  """
36
29
  try:
37
- # First search as a movie
38
- movie_results = tmdb._make_request("search/movie", {"query": title})
39
- movie_count = len(movie_results.get("results", []))
40
-
41
- # Then search as a TV show
42
- tv_results = tmdb._make_request("search/tv", {"query": title})
43
- tv_count = len(tv_results.get("results", []))
44
-
45
- # If results found in only one category, use that
46
- if movie_count > 0 and tv_count == 0:
30
+ # Extract program name from path_id
31
+ program_name = None
32
+ if item.get('path_id'):
33
+ parts = item['path_id'].strip('/').split('/')
34
+ if len(parts) >= 2:
35
+ program_name = parts[-1].split('.')[0]
36
+
37
+ if not program_name:
47
38
  return "film"
48
- elif tv_count > 0 and movie_count == 0:
49
- return "tv"
50
-
51
- # If both have results, compare popularity
52
- if movie_count > 0 and tv_count > 0:
53
- top_movie = movie_results["results"][0]
54
- top_tv = tv_results["results"][0]
55
-
56
- return "film" if top_movie.get("popularity", 0) > top_tv.get("popularity", 0) else "tv"
57
39
 
58
- return "film"
40
+ scraper = GetSerieInfo(program_name)
41
+ scraper.collect_info_title()
42
+ return "tv" if scraper.getNumberSeason() > 0 else "film"
59
43
 
60
44
  except Exception as e:
61
- console.log(f"Error determining media type with TMDB: {e}")
45
+ console.print(f"[red]Error determining media type: {e}[/red]")
62
46
  return "film"
63
47
 
64
48
 
65
- def worker_determine_type(work_queue, result_dict, worker_id):
66
- """
67
- Worker function to process items from queue and determine media types.
68
-
69
- Parameters:
70
- - work_queue: Queue containing items to process
71
- - result_dict: Dictionary to store results
72
- - worker_id: ID of the worker thread
73
- """
74
- while not work_queue.empty():
75
- try:
76
- index, item = work_queue.get(block=False)
77
- title = item.get('titolo', '')
78
- media_type = determine_media_type(title)
79
-
80
- result_dict[index] = {
81
- 'id': item.get('id', ''),
82
- 'name': title,
83
- 'type': media_type,
84
- 'path_id': item.get('path_id', ''),
85
- 'url': f"https://www.raiplay.it{item.get('url', '')}",
86
- 'image': f"https://www.raiplay.it{item.get('immagine', '')}",
87
- }
88
-
89
- work_queue.task_done()
90
-
91
- except queue.Empty:
92
- break
93
-
94
- except Exception as e:
95
- console.log(f"Worker {worker_id} error: {e}")
96
- work_queue.task_done()
97
-
98
-
99
49
  def title_search(query: str) -> int:
100
50
  """
101
51
  Search for titles based on a search query.
@@ -141,33 +91,15 @@ def title_search(query: str) -> int:
141
91
  data = response.json().get('agg').get('titoli').get('cards')
142
92
  data = data[:15] if len(data) > 15 else data
143
93
 
144
- # Use multithreading to determine media types in parallel
145
- work_queue = queue.Queue()
146
- result_dict = {}
147
-
148
- # Add items to the work queue
149
- for i, item in enumerate(data):
150
- work_queue.put((i, item))
151
-
152
- # Create and start worker threads
153
- threads = []
154
- for i in range(min(MAX_THREADS, len(data))):
155
- thread = threading.Thread(
156
- target=worker_determine_type,
157
- args=(work_queue, result_dict, i),
158
- daemon=True
159
- )
160
- threads.append(thread)
161
- thread.start()
162
-
163
- # Wait for all threads to complete
164
- for thread in threads:
165
- thread.join()
166
-
167
- # Add all results to media manager in correct order
168
- for i in range(len(data)):
169
- if i in result_dict:
170
- media_search_manager.add_media(result_dict[i])
94
+ # Process each item and add to media manager
95
+ for item in data:
96
+ media_search_manager.add_media({
97
+ 'id': item.get('id', ''),
98
+ 'name': item.get('titolo', ''),
99
+ 'type': determine_media_type(item),
100
+ 'path_id': item.get('path_id', ''),
101
+ 'url': f"https://www.raiplay.it{item.get('url', '')}",
102
+ 'image': f"https://www.raiplay.it{item.get('immagine', '')}",
103
+ })
171
104
 
172
- # Return the number of titles found
173
105
  return media_search_manager.get_length()
@@ -30,28 +30,48 @@ class GetSerieInfo:
30
30
  try:
31
31
  program_url = f"{self.base_url}/programmi/{self.program_name}.json"
32
32
  response = httpx.get(url=program_url, headers=get_headers(), timeout=max_timeout)
33
+
34
+ # If 404, content is not yet available
35
+ if response.status_code == 404:
36
+ logging.info(f"Content not yet available: {self.program_name}")
37
+ return
38
+
33
39
  response.raise_for_status()
34
-
35
40
  json_data = response.json()
36
41
 
37
42
  # Look for seasons in the 'blocks' property
38
- for block in json_data.get('blocks'):
39
- if block.get('type') == 'RaiPlay Multimedia Block' and block.get('name', '').lower() == 'episodi':
40
- self.publishing_block_id = block.get('id')
41
-
42
- # Extract seasons from sets array
43
- for season_set in block.get('sets', []):
44
- if 'stagione' in season_set.get('name', '').lower():
45
- self.seasons_manager.add_season({
46
- 'id': season_set.get('id', ''),
47
- 'number': len(self.seasons_manager.seasons) + 1,
48
- 'name': season_set.get('name', ''),
49
- 'path': season_set.get('path_id', ''),
50
- 'episodes_count': season_set.get('episode_size', {}).get('number', 0)
51
- })
52
-
53
- except Exception as e:
43
+ for block in json_data.get('blocks', []):
44
+
45
+ # Check if block is a season block or episodi block
46
+ if block.get('type') == 'RaiPlay Multimedia Block':
47
+ if block.get('name', '').lower() == 'episodi':
48
+ self.publishing_block_id = block.get('id')
49
+
50
+ # Extract seasons from sets array
51
+ for season_set in block.get('sets', []):
52
+ if 'stagione' in season_set.get('name', '').lower():
53
+ self._add_season(season_set, block.get('id'))
54
+
55
+ elif 'stagione' in block.get('name', '').lower():
56
+ self.publishing_block_id = block.get('id')
57
+
58
+ # Extract season directly from block's sets
59
+ for season_set in block.get('sets', []):
60
+ self._add_season(season_set, block.get('id'))
61
+
62
+ except httpx.HTTPError as e:
54
63
  logging.error(f"Error collecting series info: {e}")
64
+ except Exception as e:
65
+ logging.error(f"Unexpected error collecting series info: {e}")
66
+
67
+ def _add_season(self, season_set: dict, block_id: str):
68
+ self.seasons_manager.add_season({
69
+ 'id': season_set.get('id', ''),
70
+ 'number': len(self.seasons_manager.seasons) + 1,
71
+ 'name': season_set.get('name', ''),
72
+ 'path': season_set.get('path_id', ''),
73
+ 'episodes_count': season_set.get('episode_size', {}).get('number', 0)
74
+ })
55
75
 
56
76
  def collect_info_season(self, number_season: int) -> None:
57
77
  """Get episodes for a specific season."""
@@ -121,14 +121,16 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
121
121
  if site_constant.TELEGRAM_BOT:
122
122
  bot = get_bot_instance()
123
123
 
124
+ # Check proxy if not already set
125
+ finder = ProxyFinder(site_constant.FULL_URL)
126
+ proxy = finder.find_fast_proxy()
127
+
124
128
  if direct_item:
125
129
  select_title_obj = MediaItem(**direct_item)
126
130
  process_search_result(select_title_obj, selections, proxy)
127
131
  return
128
132
 
129
- # Check proxy if not already set
130
- finder = ProxyFinder(site_constant.FULL_URL)
131
- proxy = finder.find_fast_proxy()
133
+
132
134
 
133
135
  actual_search_query = get_user_input(string_to_search)
134
136
 
@@ -142,7 +144,7 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
142
144
  # Perform search on the database using the obtained query
143
145
  finder = ProxyFinder(site_constant.FULL_URL)
144
146
  proxy = finder.find_fast_proxy()
145
- len_database = title_search(string_to_search, proxy)
147
+ len_database = title_search(actual_search_query, proxy)
146
148
 
147
149
  # If only the database object (media_search_manager populated by title_search) is needed
148
150
  if get_onlyDatabase:
@@ -1,5 +1,5 @@
1
1
  __title__ = 'StreamingCommunity'
2
- __version__ = '3.0.7'
2
+ __version__ = '3.0.8'
3
3
  __author__ = 'Arrowar'
4
4
  __description__ = 'A command-line program to download film'
5
5
  __copyright__ = 'Copyright 2024'
@@ -39,9 +39,6 @@ class ConfigManager:
39
39
 
40
40
  # Get the actual path of the module file
41
41
  current_file_path = os.path.abspath(__file__)
42
- # Navigate upwards to find the project root
43
- # Assuming this file is in a package structure like StreamingCommunity/Util/config_json.py
44
- # We need to go up 2 levels to reach the project root
45
42
  base_path = os.path.dirname(os.path.dirname(os.path.dirname(current_file_path)))
46
43
 
47
44
  # Initialize file paths
@@ -562,7 +559,6 @@ class ConfigManager:
562
559
  return section in config_source
563
560
 
564
561
 
565
- # Helper function to check the platform
566
562
  def get_use_large_bar():
567
563
  """
568
564
  Determine if the large bar feature should be enabled.
@@ -296,12 +296,6 @@ class InternManager():
296
296
  "Google": ["8.8.8.8", "8.8.4.4"],
297
297
  "OpenDNS": ["208.67.222.222", "208.67.220.220"],
298
298
  "Quad9": ["9.9.9.9", "149.112.112.112"],
299
- "AdGuard": ["94.140.14.14", "94.140.15.15"],
300
- "Comodo": ["8.26.56.26", "8.20.247.20"],
301
- "Level3": ["209.244.0.3", "209.244.0.4"],
302
- "Norton": ["199.85.126.10", "199.85.127.10"],
303
- "CleanBrowsing": ["185.228.168.9", "185.228.169.9"],
304
- "Yandex": ["77.88.8.8", "77.88.8.1"]
305
299
  }
306
300
 
307
301
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: StreamingCommunity
3
- Version: 3.0.7
3
+ Version: 3.0.8
4
4
  Home-page: https://github.com/Lovi-0/StreamingCommunity
5
5
  Author: Lovi-0
6
6
  Project-URL: Bug Reports, https://github.com/Lovi-0/StreamingCommunity/issues
@@ -35,7 +35,7 @@ Dynamic: requires-dist
35
35
  Dynamic: requires-python
36
36
 
37
37
  <p align="center">
38
- <img src="https://i.ibb.co/v6RnT0wY/s2.jpg" alt="Project Logo" width="600"/>
38
+ <img src="https://i.ibb.co/v6RnT0wY/s2.jpg" alt="Project Logo" width="450"/>
39
39
  </p>
40
40
 
41
41
  <p align="center">
@@ -28,7 +28,7 @@ StreamingCommunity/Api/Site/animeworld/__init__.py,sha256=fjStJyOl6VBVDgoi6wr2yA
28
28
  StreamingCommunity/Api/Site/animeworld/film.py,sha256=W9KOS9Wvx3Mlqx5WojR-NgnF9WX8mI79JZPS7UwG-dc,1763
29
29
  StreamingCommunity/Api/Site/animeworld/serie.py,sha256=MXyV1fK05jPW4iV9NWrRKW-R4ect-TSN78-2APayniU,3516
30
30
  StreamingCommunity/Api/Site/animeworld/site.py,sha256=HBUAYiOa-UPGAO4lyTL1qIqqpDNVhWRHZ-nyLFltl7I,3702
31
- StreamingCommunity/Api/Site/animeworld/util/ScrapeSerie.py,sha256=CBTCH_wnTXUK_MKwq9a1k_XdvOlUrMpbUmpkD5fXVQ0,3589
31
+ StreamingCommunity/Api/Site/animeworld/util/ScrapeSerie.py,sha256=EDTouftxigb4ojTEGWC0sOgOLCNjE1-1GFEMrK-qzRQ,3615
32
32
  StreamingCommunity/Api/Site/cb01new/__init__.py,sha256=95M3DiNbLbZ6v1oFkPuAPEVJWf12W2JzJvxZKjZs_V8,2071
33
33
  StreamingCommunity/Api/Site/cb01new/film.py,sha256=vjd1ftm4LhxxG0TTKEwlOXtx0AYgxBbV5ZlQH8aSxGU,1695
34
34
  StreamingCommunity/Api/Site/cb01new/site.py,sha256=82GPxjOyY7Dlj1WbA0YNovgbKhuF3Vmca07IVXGh6lE,2139
@@ -36,12 +36,12 @@ StreamingCommunity/Api/Site/guardaserie/__init__.py,sha256=vnbt1DVG6nmHaLSUOO_2N
36
36
  StreamingCommunity/Api/Site/guardaserie/series.py,sha256=U9rMZCjRqHLFjo468vikxl-2RqO6DCJjebB-G8Y6LDg,6492
37
37
  StreamingCommunity/Api/Site/guardaserie/site.py,sha256=6PPp6qykuKZ3Sa2uY7E1xTwh1-8vHINsEpokGnathmw,2326
38
38
  StreamingCommunity/Api/Site/guardaserie/util/ScrapeSerie.py,sha256=_aXU-YcUtSwbC2b6QpNnWDZR8m6vp9xzBEx_zdu5tgI,4196
39
- StreamingCommunity/Api/Site/raiplay/__init__.py,sha256=RItEFpC6_sMNJFRiZuVsQdzMuqW7VZifenTMT1I1p_o,3166
39
+ StreamingCommunity/Api/Site/raiplay/__init__.py,sha256=6Hjkc_C0du_stc9cOKJIyWjW-YQPMmJLoLXZpiwX1S8,3106
40
40
  StreamingCommunity/Api/Site/raiplay/film.py,sha256=wBv5kQXx7-aCKhAZ5LABZ8zUzu_jPGdXOl9OM2p8dpY,1982
41
41
  StreamingCommunity/Api/Site/raiplay/series.py,sha256=uQVbeA_g3Z1Ciqeq99gsY2F8mC5DssH3ueGbCW8gd9Q,6161
42
- StreamingCommunity/Api/Site/raiplay/site.py,sha256=0s1yHhEIA-JJVb2uVe_SZKILx7TIisadZmov7ZhG28s,5160
43
- StreamingCommunity/Api/Site/raiplay/util/ScrapeSerie.py,sha256=5F6abToCTtsvW8iIACbChZ0fPlymJiCSF_y8FRsDu7M,5002
44
- StreamingCommunity/Api/Site/streamingcommunity/__init__.py,sha256=xH-rznnpJd-mNniYt1SAGBymhZRxT05S5UxdSGvRPW4,5968
42
+ StreamingCommunity/Api/Site/raiplay/site.py,sha256=kWo2YPcUOPgsThJU_RahnDwJP4QpkmgzdzRqtoubR5U,3166
43
+ StreamingCommunity/Api/Site/raiplay/util/ScrapeSerie.py,sha256=V7fFP9KLuMXitRsHtInxUJBcGClfSk_tOUNWFC8pG5A,5807
44
+ StreamingCommunity/Api/Site/streamingcommunity/__init__.py,sha256=Qgy8nNtC05uwpSF6e0EE0WvsZkLKSKuqjWD1kligaPg,5977
45
45
  StreamingCommunity/Api/Site/streamingcommunity/film.py,sha256=HMfDve_4xuxeYbenDt9H5MEf1FwQBZNAkpcJEbiMRqA,2609
46
46
  StreamingCommunity/Api/Site/streamingcommunity/series.py,sha256=W1KHSrF_rVl757dtLugvqVm7HCjovCHaHZXoGSRjOoI,8903
47
47
  StreamingCommunity/Api/Site/streamingcommunity/site.py,sha256=cqaVM4cNXVqN_5ImeS_c7FI6go3TZPKkDi3XbD93MSQ,4019
@@ -79,18 +79,18 @@ StreamingCommunity/TelegramHelp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
79
79
  StreamingCommunity/TelegramHelp/config.json,sha256=x1rtclDIrlnFcmiAmCQnV3WpnlTl5ds1LRRqECIF7xk,1581
80
80
  StreamingCommunity/TelegramHelp/telegram_bot.py,sha256=zCqj7xBofh9FYfEYl55mgT945jqtKo7qJhn-SMLvAvA,26455
81
81
  StreamingCommunity/Upload/update.py,sha256=Tp7PdU49rk1bga76_DiaghrbE7Fb3p4iq5S4CqZZy2A,3462
82
- StreamingCommunity/Upload/version.py,sha256=pQQWmD4WVRPFe3lUF2cLbFWjyLHAb-Lmrhe7-7h4omQ,171
82
+ StreamingCommunity/Upload/version.py,sha256=pv7LAMw9I6WYR7HXQzKw8PBByU3jr_Bx4FlaZB2Lsxs,171
83
83
  StreamingCommunity/Util/color.py,sha256=NvD0Eni-25oOOkY-szCEoc0lGvzQxyL7xhM0RE4EvUM,458
84
- StreamingCommunity/Util/config_json.py,sha256=KTbOhFOyXqqgmGZcjQsIuHsh-aUGAMXoSeZgXQ25Vy8,24867
84
+ StreamingCommunity/Util/config_json.py,sha256=yeVXqAtmwQQasdnD97OoNId2MGSdx6bCKHs7AKEGbqA,24602
85
85
  StreamingCommunity/Util/ffmpeg_installer.py,sha256=yRVIPwbh05tZ-duZmXkH0qasLNxaQCAT_E4cTP79Z3c,14890
86
86
  StreamingCommunity/Util/headers.py,sha256=TItkaFMx1GqsVNEIS3Tr0BGU5EHyF-HkZVliHORT3P8,308
87
87
  StreamingCommunity/Util/logger.py,sha256=9kGD6GmWj2pM8ADpJc85o7jm8DD0c5Aguqnq-9kmxos,3314
88
88
  StreamingCommunity/Util/message.py,sha256=SJaIPLvWeQqsIODVUKw3TgYRmBChovmlbcF6OUxqMI8,1425
89
- StreamingCommunity/Util/os.py,sha256=Q1t8K7jUR27RGEZghfN1Xmvw8BGzK0npF1cFUf1OloQ,16381
89
+ StreamingCommunity/Util/os.py,sha256=tYLOGqqmR4hPvJo1kPpKTs7Go0ILii4ye5QFBBn9fYQ,16045
90
90
  StreamingCommunity/Util/table.py,sha256=Nw5PlsvfEIOQZWy5VhsU5OK3heuBXGwsqmLl0k8yQzc,9813
91
- streamingcommunity-3.0.7.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
92
- streamingcommunity-3.0.7.dist-info/METADATA,sha256=_2-Z-kYQsSoj2zp73prdTVcawMzQU0UMmx3nKTvJnyM,24958
93
- streamingcommunity-3.0.7.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
94
- streamingcommunity-3.0.7.dist-info/entry_points.txt,sha256=Qph9XYfDC8n4LfDLOSl6gJGlkb9eFb5f-JOr_Wb_5rk,67
95
- streamingcommunity-3.0.7.dist-info/top_level.txt,sha256=YsOcxKP-WOhWpIWgBlh0coll9XUx7aqmRPT7kmt3fH0,19
96
- streamingcommunity-3.0.7.dist-info/RECORD,,
91
+ streamingcommunity-3.0.8.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
92
+ streamingcommunity-3.0.8.dist-info/METADATA,sha256=cy1f5rd0Na_xPYoDmIDK3JuaPM5cOZtwE9nTBsw68r4,24958
93
+ streamingcommunity-3.0.8.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
94
+ streamingcommunity-3.0.8.dist-info/entry_points.txt,sha256=Qph9XYfDC8n4LfDLOSl6gJGlkb9eFb5f-JOr_Wb_5rk,67
95
+ streamingcommunity-3.0.8.dist-info/top_level.txt,sha256=YsOcxKP-WOhWpIWgBlh0coll9XUx7aqmRPT7kmt3fH0,19
96
+ streamingcommunity-3.0.8.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.7.1)
2
+ Generator: setuptools (80.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5