StreamingCommunity 1.7.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.

Potentially problematic release.


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

Files changed (97) hide show
  1. StreamingCommunity/Src/Api/Player/Helper/Vixcloud/js_parser.py +140 -0
  2. StreamingCommunity/Src/Api/Player/Helper/Vixcloud/util.py +166 -0
  3. StreamingCommunity/Src/Api/Player/ddl.py +89 -0
  4. StreamingCommunity/Src/Api/Player/maxstream.py +151 -0
  5. StreamingCommunity/Src/Api/Player/supervideo.py +194 -0
  6. StreamingCommunity/Src/Api/Player/vixcloud.py +212 -0
  7. StreamingCommunity/Src/Api/Site/1337xx/__init__.py +50 -0
  8. StreamingCommunity/Src/Api/Site/1337xx/costant.py +15 -0
  9. StreamingCommunity/Src/Api/Site/1337xx/site.py +84 -0
  10. StreamingCommunity/Src/Api/Site/1337xx/title.py +66 -0
  11. StreamingCommunity/Src/Api/Site/altadefinizione/__init__.py +50 -0
  12. StreamingCommunity/Src/Api/Site/altadefinizione/costant.py +15 -0
  13. StreamingCommunity/Src/Api/Site/altadefinizione/film.py +69 -0
  14. StreamingCommunity/Src/Api/Site/altadefinizione/site.py +86 -0
  15. StreamingCommunity/Src/Api/Site/animeunity/__init__.py +50 -0
  16. StreamingCommunity/Src/Api/Site/animeunity/anime.py +126 -0
  17. StreamingCommunity/Src/Api/Site/animeunity/costant.py +15 -0
  18. StreamingCommunity/Src/Api/Site/animeunity/film_serie.py +131 -0
  19. StreamingCommunity/Src/Api/Site/animeunity/site.py +165 -0
  20. StreamingCommunity/Src/Api/Site/animeunity/util/ScrapeSerie.py +97 -0
  21. StreamingCommunity/Src/Api/Site/bitsearch/__init__.py +51 -0
  22. StreamingCommunity/Src/Api/Site/bitsearch/costant.py +15 -0
  23. StreamingCommunity/Src/Api/Site/bitsearch/site.py +84 -0
  24. StreamingCommunity/Src/Api/Site/bitsearch/title.py +47 -0
  25. StreamingCommunity/Src/Api/Site/cb01new/__init__.py +51 -0
  26. StreamingCommunity/Src/Api/Site/cb01new/costant.py +15 -0
  27. StreamingCommunity/Src/Api/Site/cb01new/film.py +69 -0
  28. StreamingCommunity/Src/Api/Site/cb01new/site.py +74 -0
  29. StreamingCommunity/Src/Api/Site/ddlstreamitaly/Player/ScrapeSerie.py +83 -0
  30. StreamingCommunity/Src/Api/Site/ddlstreamitaly/__init__.py +57 -0
  31. StreamingCommunity/Src/Api/Site/ddlstreamitaly/costant.py +16 -0
  32. StreamingCommunity/Src/Api/Site/ddlstreamitaly/series.py +142 -0
  33. StreamingCommunity/Src/Api/Site/ddlstreamitaly/site.py +93 -0
  34. StreamingCommunity/Src/Api/Site/ddlstreamitaly/util/ScrapeSerie.py +83 -0
  35. StreamingCommunity/Src/Api/Site/guardaserie/Player/ScrapeSerie.py +110 -0
  36. StreamingCommunity/Src/Api/Site/guardaserie/__init__.py +52 -0
  37. StreamingCommunity/Src/Api/Site/guardaserie/costant.py +15 -0
  38. StreamingCommunity/Src/Api/Site/guardaserie/series.py +195 -0
  39. StreamingCommunity/Src/Api/Site/guardaserie/site.py +84 -0
  40. StreamingCommunity/Src/Api/Site/guardaserie/util/ScrapeSerie.py +110 -0
  41. StreamingCommunity/Src/Api/Site/mostraguarda/__init__.py +48 -0
  42. StreamingCommunity/Src/Api/Site/mostraguarda/costant.py +15 -0
  43. StreamingCommunity/Src/Api/Site/mostraguarda/film.py +94 -0
  44. StreamingCommunity/Src/Api/Site/piratebays/__init__.py +50 -0
  45. StreamingCommunity/Src/Api/Site/piratebays/costant.py +15 -0
  46. StreamingCommunity/Src/Api/Site/piratebays/site.py +89 -0
  47. StreamingCommunity/Src/Api/Site/piratebays/title.py +45 -0
  48. StreamingCommunity/Src/Api/Site/streamingcommunity/__init__.py +55 -0
  49. StreamingCommunity/Src/Api/Site/streamingcommunity/costant.py +15 -0
  50. StreamingCommunity/Src/Api/Site/streamingcommunity/film.py +70 -0
  51. StreamingCommunity/Src/Api/Site/streamingcommunity/series.py +203 -0
  52. StreamingCommunity/Src/Api/Site/streamingcommunity/site.py +126 -0
  53. StreamingCommunity/Src/Api/Site/streamingcommunity/util/ScrapeSerie.py +113 -0
  54. StreamingCommunity/Src/Api/Template/Class/SearchType.py +101 -0
  55. StreamingCommunity/Src/Api/Template/Util/__init__.py +5 -0
  56. StreamingCommunity/Src/Api/Template/Util/get_domain.py +137 -0
  57. StreamingCommunity/Src/Api/Template/Util/manage_ep.py +153 -0
  58. StreamingCommunity/Src/Api/Template/Util/recall_search.py +37 -0
  59. StreamingCommunity/Src/Api/Template/__init__.py +3 -0
  60. StreamingCommunity/Src/Api/Template/site.py +87 -0
  61. StreamingCommunity/Src/Lib/Downloader/HLS/downloader.py +968 -0
  62. StreamingCommunity/Src/Lib/Downloader/HLS/proxyes.py +110 -0
  63. StreamingCommunity/Src/Lib/Downloader/HLS/segments.py +540 -0
  64. StreamingCommunity/Src/Lib/Downloader/MP4/downloader.py +156 -0
  65. StreamingCommunity/Src/Lib/Downloader/TOR/downloader.py +222 -0
  66. StreamingCommunity/Src/Lib/Downloader/__init__.py +5 -0
  67. StreamingCommunity/Src/Lib/Driver/driver_1.py +76 -0
  68. StreamingCommunity/Src/Lib/FFmpeg/__init__.py +4 -0
  69. StreamingCommunity/Src/Lib/FFmpeg/capture.py +170 -0
  70. StreamingCommunity/Src/Lib/FFmpeg/command.py +292 -0
  71. StreamingCommunity/Src/Lib/FFmpeg/util.py +242 -0
  72. StreamingCommunity/Src/Lib/M3U8/__init__.py +6 -0
  73. StreamingCommunity/Src/Lib/M3U8/decryptor.py +129 -0
  74. StreamingCommunity/Src/Lib/M3U8/estimator.py +173 -0
  75. StreamingCommunity/Src/Lib/M3U8/parser.py +666 -0
  76. StreamingCommunity/Src/Lib/M3U8/url_fixer.py +52 -0
  77. StreamingCommunity/Src/Lib/TMBD/__init__.py +2 -0
  78. StreamingCommunity/Src/Lib/TMBD/obj_tmbd.py +39 -0
  79. StreamingCommunity/Src/Lib/TMBD/tmdb.py +346 -0
  80. StreamingCommunity/Src/Upload/update.py +64 -0
  81. StreamingCommunity/Src/Upload/version.py +5 -0
  82. StreamingCommunity/Src/Util/_jsonConfig.py +204 -0
  83. StreamingCommunity/Src/Util/call_stack.py +42 -0
  84. StreamingCommunity/Src/Util/color.py +20 -0
  85. StreamingCommunity/Src/Util/console.py +12 -0
  86. StreamingCommunity/Src/Util/headers.py +147 -0
  87. StreamingCommunity/Src/Util/logger.py +53 -0
  88. StreamingCommunity/Src/Util/message.py +46 -0
  89. StreamingCommunity/Src/Util/os.py +417 -0
  90. StreamingCommunity/Src/Util/table.py +163 -0
  91. StreamingCommunity/run.py +196 -0
  92. StreamingCommunity-1.7.6.dist-info/LICENSE +674 -0
  93. StreamingCommunity-1.7.6.dist-info/METADATA +348 -0
  94. StreamingCommunity-1.7.6.dist-info/RECORD +97 -0
  95. StreamingCommunity-1.7.6.dist-info/WHEEL +5 -0
  96. StreamingCommunity-1.7.6.dist-info/entry_points.txt +2 -0
  97. StreamingCommunity-1.7.6.dist-info/top_level.txt +1 -0
@@ -0,0 +1,173 @@
1
+ # 20.02.24
2
+
3
+ import os
4
+ import time
5
+ import logging
6
+ import threading
7
+ from collections import deque
8
+
9
+
10
+ # External libraries
11
+ import psutil
12
+ from tqdm import tqdm
13
+
14
+
15
+ # Internal utilities
16
+ from StreamingCommunity.Src.Util.color import Colors
17
+ from StreamingCommunity.Src.Util.os import internet_manager
18
+ from StreamingCommunity.Src.Util._jsonConfig import config_manager
19
+
20
+
21
+ # Variable
22
+ TQDM_USE_LARGE_BAR = config_manager.get_int('M3U8_DOWNLOAD', 'tqdm_use_large_bar')
23
+
24
+
25
+ class M3U8_Ts_Estimator:
26
+ def __init__(self, total_segments: int):
27
+ """
28
+ Initialize the M3U8_Ts_Estimator object.
29
+
30
+ Parameters:
31
+ - total_segments (int): Length of total segments to download.
32
+ """
33
+ self.ts_file_sizes = []
34
+ self.now_downloaded_size = 0
35
+ self.total_segments = total_segments
36
+ self.lock = threading.Lock()
37
+ self.speed = {"upload": "N/A", "download": "N/A"} # Default to N/A
38
+ self.speed_thread = threading.Thread(target=self.capture_speed)
39
+ self.speed_thread.daemon = True
40
+ self.speed_thread.start()
41
+
42
+ def add_ts_file(self, size: int, size_download: int, duration: float):
43
+ """
44
+ Add a file size to the list of file sizes.
45
+
46
+ Parameters:
47
+ - size (int): The size of the ts file to be added.
48
+ - size_download (int): Single size of the ts file.
49
+ - duration (float): Time to download segment file.
50
+ """
51
+ if size <= 0 or size_download <= 0 or duration <= 0:
52
+ logging.error("Invalid input values: size=%d, size_download=%d, duration=%f", size, size_download, duration)
53
+ return
54
+
55
+ # Add total size bytes
56
+ self.ts_file_sizes.append(size)
57
+ self.now_downloaded_size += size_download
58
+
59
+ def capture_speed(self, interval: float = 1):
60
+ """
61
+ Capture the internet speed periodically and store the values.
62
+ """
63
+ def get_network_io():
64
+ """Get network I/O counters, handle missing psutil gracefully."""
65
+ try:
66
+ io_counters = psutil.net_io_counters()
67
+ return io_counters
68
+ except Exception as e:
69
+ logging.warning(f"Unable to access network I/O counters: {e}")
70
+ return None
71
+
72
+ while True:
73
+ old_value = get_network_io()
74
+ if old_value is None: # If psutil is not available, continue with default values
75
+ time.sleep(interval)
76
+ continue
77
+
78
+ time.sleep(interval)
79
+ new_value = get_network_io()
80
+ if new_value is None: # Handle again if psutil fails in the next call
81
+ time.sleep(interval)
82
+ continue
83
+
84
+ with self.lock:
85
+ upload_speed = (new_value.bytes_sent - old_value.bytes_sent) / interval
86
+ download_speed = (new_value.bytes_recv - old_value.bytes_recv) / interval
87
+
88
+ self.speed = {
89
+ "upload": internet_manager.format_transfer_speed(upload_speed),
90
+ "download": internet_manager.format_transfer_speed(download_speed)
91
+ }
92
+
93
+ def get_average_speed(self) -> float:
94
+ """
95
+ Calculate the average internet speed.
96
+
97
+ Returns:
98
+ float: The average internet speed in Mbps.
99
+ """
100
+ with self.lock:
101
+ return self.speed['download'].split(" ")
102
+
103
+ def calculate_total_size(self) -> str:
104
+ """
105
+ Calculate the total size of the files.
106
+
107
+ Returns:
108
+ str: The mean size of the files in a human-readable format.
109
+ """
110
+ try:
111
+ if len(self.ts_file_sizes) == 0:
112
+ raise ValueError("No file sizes available to calculate total size.")
113
+
114
+ total_size = sum(self.ts_file_sizes)
115
+ mean_size = total_size / len(self.ts_file_sizes)
116
+
117
+ # Return formatted mean size
118
+ return internet_manager.format_file_size(mean_size)
119
+
120
+ except ZeroDivisionError as e:
121
+ logging.error("Division by zero error occurred: %s", e)
122
+ return "0B"
123
+
124
+ except Exception as e:
125
+ logging.error("An unexpected error occurred: %s", e)
126
+ return "Error"
127
+
128
+ def get_downloaded_size(self) -> str:
129
+ """
130
+ Get the total downloaded size formatted as a human-readable string.
131
+
132
+ Returns:
133
+ str: The total downloaded size as a human-readable string.
134
+ """
135
+ return internet_manager.format_file_size(self.now_downloaded_size)
136
+
137
+ def update_progress_bar(self, total_downloaded: int, duration: float, progress_counter: tqdm) -> None:
138
+ """
139
+ Updates the progress bar with information about the TS segment download.
140
+
141
+ Parameters:
142
+ total_downloaded (int): The length of the content of the downloaded TS segment.
143
+ duration (float): The duration of the segment download in seconds.
144
+ progress_counter (tqdm): The tqdm object representing the progress bar.
145
+ """
146
+ # Add the size of the downloaded segment to the estimator
147
+ self.add_ts_file(total_downloaded * self.total_segments, total_downloaded, duration)
148
+
149
+ # Get downloaded size and total estimated size
150
+ downloaded_file_size_str = self.get_downloaded_size()
151
+ file_total_size = self.calculate_total_size()
152
+
153
+ # Fix parameter for prefix
154
+ number_file_downloaded = downloaded_file_size_str.split(' ')[0]
155
+ number_file_total_size = file_total_size.split(' ')[0]
156
+ units_file_downloaded = downloaded_file_size_str.split(' ')[1]
157
+ units_file_total_size = file_total_size.split(' ')[1]
158
+
159
+ average_internet_speed = self.get_average_speed()[0]
160
+ average_internet_unit = self.get_average_speed()[1]
161
+
162
+ # Update the progress bar's postfix
163
+ if TQDM_USE_LARGE_BAR:
164
+ progress_counter.set_postfix_str(
165
+ f"{Colors.WHITE}[ {Colors.GREEN}{number_file_downloaded} {Colors.WHITE}< {Colors.GREEN}{number_file_total_size} {Colors.RED}{units_file_total_size} "
166
+ f"{Colors.WHITE}| {Colors.CYAN}{average_internet_speed} {Colors.RED}{average_internet_unit}"
167
+ )
168
+ else:
169
+ progress_counter.set_postfix_str(
170
+ f"{Colors.WHITE}[ {Colors.GREEN}{number_file_downloaded}{Colors.RED} {units_file_downloaded} "
171
+ f"{Colors.WHITE}| {Colors.CYAN}{average_internet_speed} {Colors.RED}{average_internet_unit}"
172
+ )
173
+