Skip to content

Commit 5071cea

Browse files
committed
Fix cannot find cdm file on Linux.
1 parent 185b29c commit 5071cea

File tree

2 files changed

+25
-86
lines changed

2 files changed

+25
-86
lines changed

README.md

Lines changed: 7 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -40,43 +40,24 @@
4040

4141
## Manual Installation
4242

43-
<details>
44-
<summary>📝 Manual Installation & Update</summary>
45-
46-
<details>
47-
<summary>📋 Requirements</summary>
48-
49-
Prerequisites:
50-
* [Python](https://www.python.org/downloads/) > 3.8
51-
</details>
52-
53-
<details>
5443
<summary>⚙️ Python Dependencies</summary>
5544

56-
```bash
57-
pip install -r requirements.txt
58-
```
59-
</details>
60-
61-
<details>
62-
<summary>🚀 Usage</summary>
63-
6445
#### On Windows:
6546

6647
```powershell
67-
python test_run.py
48+
pip install -r requirements.txt
6849
```
6950

7051
#### On Linux/MacOS:
7152

7253
```bash
73-
python3 test_run.py
54+
pip3 install -r requirements.txt
55+
# or alternatively:
56+
python3 -m pip install -r requirements.txt
7457
```
75-
</details>
7658

77-
## Update
78-
79-
Keep your script up to date with the latest features by running:
59+
<detail>
60+
<summary> Update </summary>
8061

8162
### On Windows:
8263

@@ -90,8 +71,6 @@ python update.py
9071
python3 update.py
9172
```
9273

93-
</details>
94-
9574
---
9675

9776
## Quick Start
@@ -123,7 +102,6 @@ python3 test_run.py
123102

124103
## Downloaders
125104

126-
<details>
127105
<summary>📥 HLS</summary>
128106

129107
Download HTTP Live Streaming (HLS) content from m3u8 URLs.
@@ -140,9 +118,7 @@ downloader.download()
140118
```
141119

142120
See [HLS example](./Test/EasyDownload//HLS.py) for complete usage.
143-
</details>
144121

145-
<details>
146122
<summary>📽️ MP4</summary>
147123

148124
Direct MP4 file downloader with support for custom headers and referrer.
@@ -159,9 +135,7 @@ downloader.download()
159135
```
160136

161137
See [MP4 example](./Test/EasyDownload/MP4.py) for complete usage.
162-
</details>
163138

164-
<details>
165139
<summary>🧲 TOR</summary>
166140

167141
Download content via torrent magnet links.
@@ -177,9 +151,7 @@ client.start_download()
177151
```
178152

179153
See [Torrent example](./Test/EasyDownload/TOR.py) for complete usage.
180-
</details>
181154

182-
<details>
183155
<summary>🎞️ DASH</summary>
184156

185157
```python
@@ -201,19 +173,15 @@ dash_process.get_status()
201173
```
202174

203175
See [DASH example](./Test/EasyDownload/DASH.py) for complete usage.
204-
</details>
205176

206177
---
207178

208179
## Configuration
209180

210-
<details>
211181
<summary>⚙️ Overview</summary>
212182

213183
You can change some behaviors by tweaking the configuration file. The configuration file is divided into several main sections.
214-
</details>
215184

216-
<details>
217185
<summary>📁 OUT_FOLDER</summary>
218186

219187
```json
@@ -249,9 +217,7 @@ You can change some behaviors by tweaking the configuration file. The configurat
249217

250218
#### Additional Options
251219
- `add_siteName`: Appends site_name to root path (can be changed with `--add_siteName true/false`)
252-
</details>
253220

254-
<details>
255221
<summary>🔄 QBIT_CONFIG Settings</summary>
256222

257223
```json
@@ -266,9 +232,7 @@ You can change some behaviors by tweaking the configuration file. The configurat
266232
```
267233

268234
To enable qBittorrent integration, follow the setup guide [here](https://github.com/lgallard/qBittorrent-Controller/wiki/How-to-enable-the-qBittorrent-Web-UI).
269-
</details>
270235

271-
<details>
272236
<summary>📥 M3U8_DOWNLOAD Settings</summary>
273237

274238
```json
@@ -311,9 +275,7 @@ To enable qBittorrent integration, follow the setup guide [here](https://github.
311275

312276
#### Cleanup
313277
- `cleanup_tmp_folder`: Remove temporary .ts files after download
314-
</details>
315278

316-
<details>
317279
<summary>🔍 M3U8_PARSER Settings</summary>
318280

319281
```json
@@ -338,11 +300,9 @@ To enable qBittorrent integration, follow the setup guide [here](https://github.
338300
#### Link options
339301
- `get_only_link`: Return M3U8 playlist/index URL instead of downloading
340302

341-
</details>
342303

343304
## Update Domains
344305

345-
<details>
346306
<summary>🌐 Domain Configuration Methods</summary>
347307

348308
There are two ways to manage the domains for the supported websites:
@@ -398,7 +358,6 @@ If online fetching fails, the script will automatically attempt to use the local
398358
#### 💡 Adding a New Site
399359
If you want to request a new site to be added to the repository, message us on the Discord server!
400360

401-
</details>
402361

403362
---
404363

@@ -460,23 +419,18 @@ StreamingCommunity --site streamingcommunity --search "interstellar" --auto-firs
460419

461420
# Global Search
462421

463-
<details>
464422
<summary>🔍 Feature Overview</summary>
465423

466424
You can now search across multiple streaming sites at once using the Global Search feature. This allows you to find content more efficiently without having to search each site individually.
467-
</details>
468425

469-
<details>
470426
<summary>🎯 Search Options</summary>
471427

472428
When using Global Search, you have three ways to select which sites to search:
473429

474430
1. **Search all sites** - Searches across all available streaming sites
475431
2. **Search by category** - Group sites by their categories (movies, series, anime, etc.)
476432
3. **Select specific sites** - Choose individual sites to include in your search
477-
</details>
478433

479-
<details>
480434
<summary>📝 Navigation and Selection</summary>
481435

482436
After performing a search:
@@ -489,24 +443,20 @@ After performing a search:
489443
2. Select an item by number to view details or download
490444

491445
3. The system will automatically use the appropriate site's API to handle the download
492-
</details>
493446

494-
<details>
495447
<summary>⌨️ Command Line Arguments</summary>
496448

497449
The Global Search can be configured from the command line:
498450

499451
- `--global` - Perform a global search across multiple sites.
500452
- `-s`, `--search` - Specify the search terms.
501-
</details>
502453

503454
---
504455

505456
## 🧩 Advanced Features
506457

507458
## Hook/Plugin System
508459

509-
<details>
510460
<summary>🧩 Run custom scripts before/after the main execution</summary>
511461

512462
Define pre/post hooks in `config.json` under the `HOOKS` section. Supported types:
@@ -557,13 +507,11 @@ Notes:
557507

558508
Hooks are executed automatically by `run.py` before (`pre_run`) and after (`post_run`) the main execution.
559509

560-
</details>
561510

562511
---
563512

564513
# Docker
565514

566-
<details>
567515
<summary>🐳 Basic Setup</summary>
568516

569517
Build the image:
@@ -581,19 +529,15 @@ Tip CLI:
581529
```
582530
docker exec -it streaming-community python test_run.py
583531
```
584-
</details>
585532

586-
<details>
587533
<summary>💾 Custom Storage Location</summary>
588534

589535
By default the videos will be saved in `/app/Video` inside the container. To save them on your machine:
590536

591537
```
592538
docker run -it --dns 9.9.9.9 -p 8000:8000 -v /path/to/download:/app/Video streaming-community-api
593539
```
594-
</details>
595540

596-
<details>
597541
<summary>🛠️ Quick Setup with Make</summary>
598542

599543
Inside the Makefile (install `make`) are already configured two commands to build and run the container:
@@ -606,12 +550,10 @@ make LOCAL_DIR=/path/to/download run-container
606550
```
607551

608552
The `run-container` command mounts also the `config.json` file, so any change to the configuration file is reflected immediately without having to rebuild the image.
609-
</details>
610553

611554

612555
# Telegram Usage
613556

614-
<details>
615557
<summary>⚙️ Basic Configuration</summary>
616558

617559
The bot was created to replace terminal commands and allow interaction via Telegram. Each download runs within a screen session, enabling multiple downloads to run simultaneously.
@@ -641,9 +583,7 @@ TOKEN_TELEGRAM=IlTuo2131TOKEN$12D3Telegram
641583
AUTHORIZED_USER_ID=12345678
642584
DEBUG=False
643585
```
644-
</details>
645586

646-
<details>
647587
<summary>📥 Dependencies & Launch</summary>
648588

649589
Install dependencies:
@@ -654,8 +594,7 @@ pip install -r requirements.txt
654594
Start the bot (from /StreamingCommunity/TelegramHelp):
655595
```bash
656596
python3 telegram_bot.py
657-
```
658-
</details>d
597+
```d
659598
- 🔹 `/list` – Displays the status of active downloads, with options to:
660599
- Stop an incorrect download using `/stop <ID>`
661600
- View the real-time output of a download using `/screen <ID>`

StreamingCommunity/Util/os.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,23 @@ def init(self):
395395
self._display_binary_paths()
396396
time.sleep(0.25)
397397

398+
def extract_png_chunk(self, png_with_wvd, out_wvd_path):
399+
with open(png_with_wvd, "rb") as f:
400+
data = f.read()
401+
pos = 8
402+
403+
while pos < len(data):
404+
length = struct.unpack(">I", data[pos:pos+4])[0]
405+
chunk_type = data[pos+4:pos+8]
406+
chunk_data = data[pos+8:pos+8+length]
407+
408+
if chunk_type == b"stEg":
409+
with open(out_wvd_path, "wb") as f:
410+
f.write(chunk_data)
411+
return
412+
413+
pos += 12 + length
414+
398415
def get_wvd_path(self) -> str:
399416
"""
400417
Searches the system's binary folder and returns the path of the first file ending with 'wvd'.
@@ -414,7 +431,7 @@ def get_wvd_path(self) -> str:
414431

415432
if os.path.exists(png_path):
416433
try:
417-
extract_png_chunk(png_path, out_wvd_path)
434+
self.extract_png_chunk(png_path, out_wvd_path)
418435
if os.path.exists(out_wvd_path):
419436
return out_wvd_path
420437

@@ -451,23 +468,6 @@ def suppress_output():
451468
with contextlib.redirect_stdout(io.StringIO()):
452469
yield
453470

454-
def extract_png_chunk(png_with_wvd, out_wvd_path):
455-
with open(png_with_wvd, "rb") as f:
456-
data = f.read()
457-
pos = 8
458-
459-
while pos < len(data):
460-
length = struct.unpack(">I", data[pos:pos+4])[0]
461-
chunk_type = data[pos+4:pos+8]
462-
chunk_data = data[pos+8:pos+8+length]
463-
464-
if chunk_type == b"stEg":
465-
with open(out_wvd_path, "wb") as f:
466-
f.write(chunk_data)
467-
return
468-
469-
pos += 12 + length
470-
471471
def get_call_stack():
472472
"""Retrieves the current call stack with details about each call."""
473473
stack = inspect.stack()

0 commit comments

Comments
 (0)