Skip to content

Commit

Permalink
Change directory structure
Browse files Browse the repository at this point in the history
  • Loading branch information
fluffy-melli committed Dec 24, 2024
1 parent 4adb967 commit 76d1bfe
Show file tree
Hide file tree
Showing 32 changed files with 286 additions and 237 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ASCII 아트 기능이 포함된 Python 기반 YouTube 비디오 플레이어입

## 🌐 언어 | Language

[한국어](README.md) | [English](README.en.md)
[한국어](README.md) | [English](./docs/README.en.md)

## ⚙️ 요구사항

Expand Down Expand Up @@ -121,11 +121,11 @@ start.sh --with-play-server
- 방향키로 결과 탐색
- Enter로 선택 재생

## 자막 설정
## 💬 자막 설정

**설정 방법:**

1. Sclat 설치 폴더에서 `setting.json` 파일을 엽니다.
1. Sclat 설치 폴더에서 `setting/setting.json` 파일을 엽니다.
2. `"Subtitle-Lang": "~"` 값을 원하는 언어로 변경합니다:
- 이때 `none` 을 입력할시 자막 기능이 꺼져요

Expand All @@ -151,11 +151,11 @@ Discord RPC 기능을 사용하려면 컴퓨터에서 Discord 프로그램을

### Discord RPC 끄는 방법

Discord RPC 기능을 비활성화하려면 `setting.json` 파일에서 `discord_RPC` 값을 `false`로 변경하십시오. 기본값은 `true`입니다.
Discord RPC 기능을 비활성화하려면 `setting/setting.json` 파일에서 `discord_RPC` 값을 `false`로 변경하십시오. 기본값은 `true`입니다.

**설정 방법:**

1. Sclat 설치 폴더에서 `setting.json` 파일을 엽니다.
1. Sclat 설치 폴더에서 `setting/setting.json` 파일을 엽니다.
2. `"discord_RPC": true`를 `"discord_RPC": false`로 변경합니다:

```json
Expand Down
10 changes: 5 additions & 5 deletions README.en.md → docs/README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Python-based YouTube video player with ASCII art functionality.

## 🌐 언어 | Language

[한국어](README.md) | [English](README.en.md)
[한국어](README.md) | [English](./docs/README.en.md)

## ⚙️ Requirements

Expand Down Expand Up @@ -122,11 +122,11 @@ start.sh --with-play-server
- Navigate results with arrow keys
- Select and play with Enter

## ✨ 자막 설정
## 💬 Subtitle

**Steps to configure:**

1. Open the `setting.json` file in the Sclat installation folder.
1. Open the `setting/setting.json` file in the Sclat installation folder.
2. Change `"Subtitle-Lang": "~"` value to your desired language:
- At this time, if you enter `none`, the subtitle function will be turned off.

Expand All @@ -152,11 +152,11 @@ To use the Discord RPC feature, simply run the Discord program on your computer.

### How to Disable Discord RPC

To disable the Discord RPC feature, change the `discord_RPC` value to `false` in the `setting.json` file. The default value is `true`.
To disable the Discord RPC feature, change the `discord_RPC` value to `false` in the `setting/setting.json` file. The default value is `true`.

**Steps to configure:**

1. Open the `setting.json` file in the Sclat installation folder.
1. Open the `setting/setting.json` file in the Sclat installation folder.
2. Change `"discord_RPC": true` to `"discord_RPC": false`:

```json
Expand Down
File renamed without changes.
29 changes: 13 additions & 16 deletions src/utils/download.py → sclat/download/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
from pytubefix import YouTube,Search
from pytubefix.cli import on_progress
####################################
from src.utils import user_setting, subtitles
import xml.etree.ElementTree as ET
import src.utils
import src.utils.user_setting
import src.win.screen
from setting import setting as user_setting
import gui.screen

def convert_size(bytes):
for unit in ['Byte', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB']:
Expand All @@ -19,35 +16,35 @@ def progress_function(stream, chunk, bytes_remaining):
bytes_downloaded = total_size - bytes_remaining
percentage = (bytes_downloaded / total_size) * 100
on_progress(stream, chunk, bytes_remaining)
src.win.screen.load = 1
gui.screen.load = 1

width = stream.width if stream.width else 800
height = stream.height if stream.height else 600
width = width * 1.5
height = height * 1.5

src.win.screen.reset((width, height+5))
gui.screen.reset((width, height+5))
pygame.display.set_caption(f"Downloading: {convert_size(bytes_downloaded)} of {convert_size(total_size)} ({percentage:.2f}%)")
text_surface = src.win.screen.font.render(f"Downloading: {convert_size(bytes_downloaded)} of {convert_size(total_size)} ({percentage:.2f}%)", True, (255,255,255))
text_surface = gui.screen.font.render(f"Downloading: {convert_size(bytes_downloaded)} of {convert_size(total_size)} ({percentage:.2f}%)", True, (255,255,255))
text_rect = text_surface.get_rect(center=(int(width/2), int(height/2)))
src.win.screen.win.blit(text_surface, text_rect)
gui.screen.win.blit(text_surface, text_rect)
pygame.display.update()

def progress_hook(d):
try:
width = src.win.screen.win.get_size()[0]
height = src.win.screen.win.get_size()[1]
src.win.screen.win.fill((0,0,0))
width = gui.screen.win.get_size()[0]
height = gui.screen.win.get_size()[1]
gui.screen.win.fill((0,0,0))
pygame.display.set_caption(f"Downloading: {d['_percent_str']} of {d['_speed_str']} - ETA: {d['_eta_str']}")
text_surface = src.win.screen.font.render(f"Downloading: {d['_percent_str']} of {d['_speed_str']} - ETA: {d['_eta_str']}", True, (255,255,255))
text_surface = gui.screen.font.render(f"Downloading: {d['_percent_str']} of {d['_speed_str']} - ETA: {d['_eta_str']}", True, (255,255,255))
text_rect = text_surface.get_rect(center=(int(width/2), int(height/2)))
src.win.screen.win.blit(text_surface, text_rect)
gui.screen.win.blit(text_surface, text_rect)
pygame.display.update()
except Exception as e:
print(e)

def after(a,b):
src.win.screen.load = 2
gui.screen.load = 2

def search(q:str,result:int):
list = Search(query=q)
Expand Down Expand Up @@ -84,7 +81,7 @@ def install(url:str):
fn = f"{fns}/{yt.title}.mp4"
yt = yt.streams.filter(progressive=True, file_extension='mp4').get_highest_resolution()
yt.download(filename=fn)
sr = install_srt(url, fns, yt.title, src.utils.user_setting.SubTitle)
sr = install_srt(url, fns, yt.title, user_setting.SubTitle)
return fns, fn, sr

def install_nogui(url:str):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 76d1bfe

Please sign in to comment.