Skip to content

Feat: add gui #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d6d8f42
add base run script and fix path for raspberry
FrancescoGrazioso Feb 22, 2025
5d5204c
Add support for passing search terms to functions
FrancescoGrazioso Feb 22, 2025
f644051
Merge branch 'Arrowar:main' into main
FrancescoGrazioso Feb 22, 2025
b3a89b1
Merge branch 'Arrowar:main' into main
FrancescoGrazioso Feb 25, 2025
4e2d6ca
Add GUI for script execution using PyQt5 and update dependencies
FrancescoGrazioso Feb 25, 2025
462aed6
Refactor code formatting and standardize string usage.
FrancescoGrazioso Feb 25, 2025
abd5753
Refactor comments and docstrings for clarity and consistency
FrancescoGrazioso Feb 25, 2025
0d8cb8a
Refactor comments and docstrings for clarity and consistency
FrancescoGrazioso Feb 25, 2025
6269466
Enhance GUI with input controls for user interaction
FrancescoGrazioso Feb 25, 2025
b933c34
reset config
FrancescoGrazioso Feb 25, 2025
7685b4e
Update README with GUI setup and execution instructions
FrancescoGrazioso Feb 25, 2025
5d515e4
Enhance GUI with results table and console toggle features
FrancescoGrazioso Feb 25, 2025
8b574f4
Refactor GUI code and modularize components
FrancescoGrazioso Feb 25, 2025
3053993
add windows compatibility
FrancescoGrazioso Feb 26, 2025
afe9138
enhance console show
FrancescoGrazioso Feb 26, 2025
e47fb71
fix
FrancescoGrazioso Mar 25, 2025
721f007
Merge branch 'main' into feat/gui
FrancescoGrazioso May 30, 2025
b60e1e2
Workflow: Add amend strategy.
Arrowar Jun 10, 2025
b5a22ae
Merge branch 'main' into feat/gui
FrancescoGrazioso Jun 12, 2025
c08de1b
Enhance command-line interface: add site specification and search ter…
FrancescoGrazioso Jun 12, 2025
1dae778
Refactor GUI logic: improve episode handling and results table visibi…
FrancescoGrazioso Jun 13, 2025
a35421c
Add GUI tests and test runner for StreamingCommunity application
FrancescoGrazioso Jun 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/.domain/domains.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"time_change": "2025-03-19 12:20:19"
},
"cb01new": {
"domain": "digital",
"full_url": "https://cb01net.digital/",
"old_domain": "life",
"time_change": "2025-06-07 07:18:34"
"domain": "live",
"full_url": "https://cb01net.live/",
"old_domain": "digital",
"time_change": "2025-06-11 07:20:30"
},
"animeunity": {
"domain": "so",
Expand All @@ -25,9 +25,9 @@
},
"guardaserie": {
"domain": "meme",
"full_url": "http://guardaserie.meme/",
"full_url": "https://guardaserie.meme/",
"old_domain": "meme",
"time_change": "2025-06-10 10:23:05"
"time_change": "2025-06-11 07:20:36"
},
"ddlstreamitaly": {
"domain": "co",
Expand All @@ -54,9 +54,9 @@
"time_change": "2025-06-10 10:23:11"
},
"altadefinizionegratis": {
"domain": "cc",
"full_url": "https://altadefinizionegratis.cc/",
"old_domain": "icu",
"time_change": "2025-06-02 10:35:25"
"domain": "club",
"full_url": "https://altadefinizionegratis.club/",
"old_domain": "cc",
"time_change": "2025-06-11 07:20:42"
}
}
34 changes: 21 additions & 13 deletions .github/workflows/update_domain.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Update domains

name: Update domains (Amend Strategy)
on:
schedule:
- cron: "0 7-21 * * *"
Expand All @@ -8,22 +7,25 @@ on:
jobs:
update-domains:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4

with:
fetch-depth: 0 # Serve per l'amend
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.12'

- name: Install dependencies
run: |
pip install httpx tldextract ua-generator dnspython

pip install --upgrade pip setuptools wheel

- name: Configure DNS
Expand All @@ -33,18 +35,24 @@ jobs:

- name: Execute domain update script
run: python .github/.domain/domain_update.py

- name: Commit and push changes (if any)
- name: Always amend last commit
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'

# Check if domains.json was modified
if ! git diff --quiet .github/.domain/domains.json; then
echo "📝 Changes detected - amending last commit"
git add .github/.domain/domains.json
git commit -m "Automatic domain update [skip ci]"
echo "Changes committed. Attempting to push..."
git push
git commit --amend --no-edit
git push --force-with-lease origin main
else
echo "No changes to .github/.domain/domains.json to commit."
echo "No changes to domains.json"
fi

- name: Verify repository state
if: failure()
run: |
echo "❌ Something went wrong. Repository state:"
git log --oneline -5
git status
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,7 @@ cmd.txt
bot_config.json
scripts.json
active_requests.json
working_proxies.json
domains.json
working_proxies.json
.vscode/
.idea/
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ pip install --upgrade StreamingCommunity

Create a simple script (`run_streaming.py`) to launch the main application:

```python
from StreamingCommunity.run import main
Install requirements:

if __name__ == "__main__":
main()
```bash
pip install -r requirements.txt
```

Run the script:


```bash
python run_streaming.py
python streaming_gui.py
```

## Modules
Expand Down Expand Up @@ -814,9 +814,6 @@ Addon per Stremio che consente lo streaming HTTPS di film, serie, anime e TV in
### 🧩 [streamingcommunity-unofficialapi](https://github.com/Blu-Tiger/streamingcommunity-unofficialapi)
API non ufficiale per accedere ai contenuti del sito italiano StreamingCommunity.

### 🎥 [stream-buddy](https://github.com/Bbalduzz/stream-buddy)
Tool per guardare o scaricare film dalla piattaforma StreamingCommunity.

# Disclaimer

This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.
27 changes: 23 additions & 4 deletions StreamingCommunity/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ def main(script_id = 0):
)

parser.add_argument("script_id", nargs="?", default="unknown", help="ID dello script")
parser.add_argument('-s', '--search', default=None, help='Search terms')
parser.add_argument('--site', type=str, help='Specify site to search (e.g., streamingcommunity, eurostreaming)')

# Add arguments for the main configuration parameters
parser.add_argument(
Expand Down Expand Up @@ -271,13 +273,11 @@ def main(script_id = 0):
'--global', action='store_true', help='Perform a global search across multiple sites.'
)

# Add arguments for search functions
parser.add_argument('-s', '--search', default=None, help='Search terms')

# Parse command-line arguments
args = parser.parse_args()

search_terms = args.search
specified_site = args.site

# Map command-line arguments to the config values
config_updates = {}

Expand Down Expand Up @@ -306,6 +306,25 @@ def main(script_id = 0):
global_search(search_terms)
return

# Modify the site selection logic:
if specified_site:
# Look for the specified site in the loaded functions
site_found = False
for alias, (func, use_for) in search_functions.items():
module_name = alias.split("_")[0]
if module_name.lower() == specified_site.lower():
run_function(func, search_terms=search_terms)
site_found = True
break

if not site_found:
console.print(f"[red]Error: Site '{specified_site}' not found or not supported.")
if NOT_CLOSE_CONSOLE:
restart_script()
else:
force_exit()
return

# Create mappings using module indice
input_to_function = {}
choice_labels = {}
Expand Down
92 changes: 92 additions & 0 deletions Test/GUI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# GUI Tests

This directory contains tests for the GUI components of the StreamingCommunity application.

## Test Files

- `test_main_window.py`: Tests for the main window class (`StreamingGUI`)
- `test_run_tab.py`: Tests for the run tab component (`RunTab`)
- `test_results_table.py`: Tests for the results table widget (`ResultsTable`)
- `test_stream_redirect.py`: Tests for the stdout redirection utility (`Stream`)
- `test_site_manager.py`: Tests for the site manager utility
- `test_integration.py`: Integration tests for all GUI components working together

## Running the Tests

### Using the Test Runner

The easiest way to run the tests is to use the included test runner script:

```bash
# Run all tests
cd Test/GUI
python run_tests.py

# Run specific test files
python run_tests.py test_main_window.py test_run_tab.py

# Run with different verbosity level (1-3)
python run_tests.py -v 3
```

### Using unittest Directly

You can also run the tests using the standard unittest module:

```bash
# Run all GUI tests
python -m unittest discover -s Test/GUI

# Run individual test files
python -m unittest Test/GUI/test_main_window.py
python -m unittest Test/GUI/test_run_tab.py
python -m unittest Test/GUI/test_results_table.py
python -m unittest Test/GUI/test_stream_redirect.py
python -m unittest Test/GUI/test_site_manager.py
python -m unittest Test/GUI/test_integration.py
```

## Test Coverage

The tests cover the following aspects of the GUI:

1. **Basic Initialization**
- Proper initialization of all GUI components
- Correct parent-child relationships
- Default states of widgets

2. **UI Creation**
- Correct creation of all UI elements
- Proper layout of widgets
- Initial visibility states

3. **Widget Interactions**
- Button clicks
- Checkbox toggles
- Table updates

4. **Process Execution**
- Script execution
- Process termination
- Status updates

5. **Integration**
- Components working together correctly
- Signal-slot connections
- Data flow between components

## Adding New Tests

When adding new GUI components, please add corresponding tests following the same pattern as the existing tests. Each test file should:

1. Import the necessary modules
2. Create a test class that inherits from `unittest.TestCase`
3. Include setup and teardown methods
4. Test all aspects of the component's functionality
5. Include a main block to run the tests when the file is executed directly

## Notes

- The tests use `unittest.mock` to mock external dependencies like `QProcess`
- A `QApplication` instance is created in the `setUpClass` method to ensure that PyQt widgets can be created
- The tests clean up resources in the `tearDown` method to prevent memory leaks
61 changes: 61 additions & 0 deletions Test/GUI/run_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env python3

# Fix import
import sys
import os
src_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
sys.path.append(src_path)

# Import
import unittest
import argparse

def run_tests(verbosity=2, test_names=None):
"""Run the GUI tests with the specified verbosity level."""
# Create a test loader
loader = unittest.TestLoader()

# If specific test names are provided, run only those tests
if test_names:
suite = unittest.TestSuite()
for test_name in test_names:
# Try to load the test module
try:
if test_name.endswith('.py'):
test_name = test_name[:-3] # Remove .py extension

# If the test name is a module name, load all tests from that module
if test_name.startswith('test_'):
module = __import__(test_name)
suite.addTests(loader.loadTestsFromModule(module))
else:
# Otherwise, assume it's a test class or method name
suite.addTests(loader.loadTestsFromName(test_name))
except (ImportError, AttributeError) as e:
print(f"Error loading test {test_name}: {e}")
return False
else:
# Otherwise, discover all tests in the current directory
suite = loader.discover('.', pattern='test_*.py')

# Run the tests
runner = unittest.TextTestRunner(verbosity=verbosity)
result = runner.run(suite)

# Return True if all tests passed, False otherwise
return result.wasSuccessful()

if __name__ == '__main__':
# Parse command line arguments
parser = argparse.ArgumentParser(description='Run GUI tests for StreamingCommunity')
parser.add_argument('-v', '--verbosity', type=int, default=2,
help='Verbosity level (1-3, default: 2)')
parser.add_argument('test_names', nargs='*',
help='Specific test modules, classes, or methods to run')
args = parser.parse_args()

# Run the tests
success = run_tests(args.verbosity, args.test_names)

# Exit with appropriate status code
sys.exit(0 if success else 1)
Loading