Fix github counter

This commit is contained in:
Ghost 2024-05-27 18:44:49 +02:00
parent 5076317897
commit ae0b5bb577
4 changed files with 52 additions and 37 deletions

View File

@ -53,38 +53,48 @@ python3 run.py
You can change some behaviors by tweaking the configuration file.
### Options (DEFAULT)
<details>
<summary><strong>DEFAULT</strong></summary>
* root_path: Path where the script will add movies and TV series folders (see [Path Examples](#Path-examples)).
- Default Value: media/streamingcommunity
* **root_path**: Path where the script will add movies and TV series folders (see [Path Examples](#Path-examples)).
- **Default Value**: `media/streamingcommunity`
* not_close: This option, when activated, prevents the script from closing after its initial execution, allowing it to restart automatically after completing the first run.
- Default Value: false
* **not_close**: When activated, prevents the script from closing after its initial execution, allowing it to restart automatically after completing the first run.
- **Default Value**: `false`
* map_episode_name: Mapping to choose the name of all episodes of TV Shows (see [Episode Name Usage](#Episode-name-usage)).
- Default Value: %(episode_name)
- Example Value: %(tv_name) [S%(season)] [E%(episode)] %(episode_name)
* **map_episode_name**: Mapping to choose the name of all episodes of TV Shows (see [Episode Name Usage](#Episode-name-usage)).
- **Default Value**: `%(episode_name)`
- **Example Value**: `%(tv_name) [S%(season)] [E%(episode)] %(episode_name)`
</details>
### Options (M3U8_DOWNLOAD)
<details>
<summary><strong>M3U8_DOWNLOAD</strong></summary>
* tdqm_workers: The number of workers that will cooperate to download .ts files. **A high value may slow down your PC**
- Default Value: 20
* **tdqm_workers**: The number of workers that will cooperate to download .ts files. **A high value may slow down your PC**
- **Default Value**: `20`
* tqdm_show_progress: Whether to show progress during downloads or not.
- Default Value: true
* **tqdm_show_progress**: Whether to show progress during downloads or not.
- **Default Value**: `true`
* create_report: When enabled, this option saves the name of the series or movie being downloaded along with the date and file size in a CSV file, providing a log of downloaded content.
- Default Value: false
* **create_report**: When enabled, saves the name of the series or movie being downloaded along with the date and file size in a CSV file, providing a log of downloaded content.
- **Default Value**: `false`
</details>
### Options (M3U8_FILTER)
<details>
<summary><strong>M3U8_FILTER</strong></summary>
* cleanup_tmp_folder: Upon final conversion, this option ensures the removal of all unformatted audio, video tracks, and subtitles from the temporary folder, thereby maintaining cleanliness and efficiency.
- Default Value: true
* **cleanup_tmp_folder**: Upon final conversion, ensures the removal of all unformatted audio, video tracks, and subtitles from the temporary folder, thereby maintaining cleanliness and efficiency.
- **Default Value**: `true`
* specific_list_audio: A list of specific audio languages to download.
- Example Value: ['ara', 'baq', 'cat', 'chi', 'cze', 'dan', 'dut', 'eng', 'fil', 'fin', 'forced-ita', 'fre', 'ger', 'glg', 'gre', 'heb', 'hin', 'hun', 'ind', 'ita', 'jpn', 'kan', 'kor', 'mal', 'may', 'nob', 'nor', 'pol', 'por', 'rum', 'rus', 'spa', 'swe', 'tam', 'tel', 'tha', 'tur', 'ukr', 'vie']
* **specific_list_audio**: A list of specific audio languages to download.
- **Example Value**: `['ara', 'baq', 'cat', 'chi', 'cze', 'dan', 'dut', 'eng', 'fil', 'fin', 'forced-ita', 'fre', 'ger', 'glg', 'gre', 'heb', 'hin', 'hun', 'ind', 'ita', 'jpn', 'kan', 'kor', 'mal', 'may', 'nob', 'nor', 'pol', 'por', 'rum', 'rus', 'spa', 'swe', 'tam', 'tel', 'tha', 'tur', 'ukr', 'vie']`
* **check_output_conversion**: Verify if the conversion run by ffmpeg is free from corruption.
- **Default Value**: `false`
</details>
> [!IMPORTANT]

View File

@ -3,8 +3,6 @@
import csv
import logging
from typing import List
# Internal utilities
from Src.Util._jsonConfig import config_manager

View File

@ -275,6 +275,7 @@ def join_video(video_path: str, out_path: str, vcodec: str = None, acodec: str =
"""
if not check_file_existence(video_path):
logging.error("Missing input video for ffmpeg conversion.")
sys.exit(0)
# Start command
@ -340,6 +341,7 @@ def join_audios(video_path: str, audio_tracks: List[Dict[str, str]], out_path: s
"""
if not check_file_existence(video_path):
logging.error("Missing input video for ffmpeg conversion.")
sys.exit(0)
# Start command
@ -389,6 +391,7 @@ def join_subtitle(video_path: str, subtitles_list: List[Dict[str, str]], out_pat
"""
if not check_file_existence(video_path):
logging.error("Missing input video for ffmpeg conversion.")
sys.exit(0)

View File

@ -31,29 +31,33 @@ def update():
console.print(f"[red]Error accessing GitHub API: {e}")
return
# Get start of the reposity
stargazers_count = response_reposity['stargazers_count']
# Get stargazers count from the repository
stargazers_count = response_reposity.get('stargazers_count', 0)
# Find info about latest versione deploy and the donwload count
last_version = response_releases[0]['name']
down_count = response_releases[0]['assets'][0]['download_count']
# Calculate total download count from all releases
total_download_count = sum(asset['download_count'] for release in response_releases for asset in release.get('assets', []))
# Calculate percentual of start base on download count
if down_count > 0 and stargazers_count > 0:
percentual_stars = round(stargazers_count / down_count * 100, 2)
# Get latest version name
if response_releases:
last_version = response_releases[0].get('name', 'Unknown')
else:
last_version = 'Unknown'
# Calculate percentual of stars based on download count
if total_download_count > 0 and stargazers_count > 0:
percentual_stars = round(stargazers_count / total_download_count * 100, 2)
else:
percentual_stars = 0
# Check installed version
if __version__ != last_version:
console.print(f"[red]Version: [yellow]{last_version}")
console.print(f"[red]New version available: [yellow]{last_version}")
else:
console.print(f"[red]Everything up to date")
console.print(f"[green]Everything is up to date")
print("\n")
console.print(f"[red]{repo_name} was downloaded [yellow]{down_count} [red]times, but only [yellow]{percentual_stars}% [red]of You(!!) have starred it.\n\
[cyan]Help the repository grow today, by leaving a [yellow]star [cyan]and [yellow]sharing [cyan]it to others online!")
console.print("\n")
console.print(f"[red]{repo_name} has been downloaded [yellow]{total_download_count} [red]times, but only [yellow]{percentual_stars}% [red]of users have starred it.\n\
[cyan]Help the repository grow today by leaving a [yellow]star [cyan]and [yellow]sharing [cyan]it with others online!")
time.sleep(1)
print("\n")
console.print("\n")