mirror of
https://github.com/ksyasuda/dotfiles.git
synced 2025-12-05 02:53:38 -08:00
Compare commits
5 Commits
4b32fb704a
...
da08d72c7c
| Author | SHA1 | Date | |
|---|---|---|---|
|
da08d72c7c
|
|||
|
e36124537c
|
|||
|
b3a468c129
|
|||
|
11338e64c6
|
|||
|
0ffeef12aa
|
@@ -12,7 +12,7 @@
|
||||
"control-center-margin-left": 0,
|
||||
|
||||
"notification-2fa-action": true,
|
||||
"notification-inline-replies": false,
|
||||
"notification-inline-replies": true,
|
||||
"notification-window-width": 500,
|
||||
"notification-icon-size": 64,
|
||||
"notification-body-image-height": 400,
|
||||
@@ -63,6 +63,18 @@
|
||||
"image-size": 96,
|
||||
"image-radius": 12
|
||||
},
|
||||
"volume": {
|
||||
"label": "",
|
||||
"show-per-app": true,
|
||||
"show-per-app-icon": true,
|
||||
"show-per-app-label": true,
|
||||
"empty-list-label": "No applications using audio",
|
||||
"expand-button-label": "",
|
||||
"collapse-button-label": "ﬔ",
|
||||
"icon-size": 24,
|
||||
"animation-type": "slide_down",
|
||||
"animation-duration": 250
|
||||
},
|
||||
"label": {
|
||||
"max-lines": 1,
|
||||
"text": ""
|
||||
|
||||
@@ -11,18 +11,18 @@ source ~/.environment
|
||||
source <(fzf --zsh)
|
||||
|
||||
eval $(thefuck --alias)
|
||||
HISTFILE=~/.zsh_history
|
||||
HISTSIZE=10000
|
||||
HISTFILESIZE=2000
|
||||
HISTCONTROL=ignoreboth
|
||||
# as soon as you hit enter, append to $HISTFILE
|
||||
setopt INC_APPEND_HISTORY
|
||||
# merge history from all running shells
|
||||
setopt SHARE_HISTORY
|
||||
# ignore duplicates and trivial commands
|
||||
setopt HIST_IGNORE_DUPS
|
||||
setopt HIST_IGNORE_SPACE
|
||||
|
||||
HISTFILE=~/.zsh_history
|
||||
HISTCONTROL=ignoreboth
|
||||
HISTSIZE=10000 # max lines kept in memory
|
||||
SAVEHIST=10000 # max lines saved to $HISTFILE
|
||||
|
||||
# 2. Behavior flags
|
||||
setopt APPEND_HISTORY # append, don’t rewrite the entire file on exit
|
||||
setopt INC_APPEND_HISTORY # write each command as it’s entered
|
||||
setopt SHARE_HISTORY # merge history across all running zsh’s
|
||||
setopt HIST_IGNORE_ALL_DUPS # don’t record a command if it’s already in history
|
||||
setopt HIST_IGNORE_SPACE # don’t record commands that start with a space
|
||||
|
||||
# fpath=(/Users/sudacode/.docker/completions $fpath)
|
||||
FPATH="$HOME/.docker/completions:$FPATH"
|
||||
|
||||
2
projects/scripts/teppei/.gitignore
vendored
2
projects/scripts/teppei/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
env
|
||||
.git
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
EP="$1"
|
||||
DIR="/truenas/sudacode/japanese/nihongo-con-teppei/Nihongo-Con-Teppei-E$EP.mp3"
|
||||
export FONTCONFIG_FILE="$HOME/.config/mpv/mpv-fonts.conf"
|
||||
if mpv --profile=builtin-pseudo-gui --vid=1 --external-file=pod/cover.jpg "$DIR"; then
|
||||
echo "Finished playing Nihongo Con Teppei E$EP"
|
||||
else
|
||||
echo "Failed to play Nihongo Con Teppei E$EP"
|
||||
fi
|
||||
@@ -1,92 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
import logging
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from requests import get
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
AUDIO_BASE_URL = (
|
||||
"https://www.heypera.com/listen/nihongo-con-teppei-for-beginners/{}/next"
|
||||
)
|
||||
SUB_BASE_URL = "https://storage.googleapis.com/pera-transcripts/nihongo-con-teppei-for-beginners/transcripts/{}.vtt"
|
||||
|
||||
|
||||
def get_audio_url(episode_num: int):
|
||||
chrome_options = Options()
|
||||
chrome_options.add_argument("--headless")
|
||||
chrome_options.add_argument("--disable-gpu")
|
||||
chrome_options.add_argument("--no-sandbox")
|
||||
|
||||
driver = webdriver.Chrome(options=chrome_options)
|
||||
|
||||
try:
|
||||
driver.get(AUDIO_BASE_URL.format(episode_num))
|
||||
|
||||
# Wait for the audio element to be present
|
||||
audio_element = WebDriverWait(driver, 10).until(
|
||||
EC.presence_of_element_located((By.TAG_NAME, "audio"))
|
||||
)
|
||||
audio_url = audio_element.get_attribute("src")
|
||||
if audio_url:
|
||||
logger.info(f"Audio URL: {audio_url}")
|
||||
else:
|
||||
logger.error("No audio URL found")
|
||||
return audio_url
|
||||
except Exception as e:
|
||||
logger.error(f"Error: {e}")
|
||||
raise e
|
||||
finally:
|
||||
driver.quit()
|
||||
|
||||
|
||||
def get_sub_url(episode_num: int):
|
||||
return SUB_BASE_URL.format(episode_num)
|
||||
|
||||
|
||||
def download_file(url: str, filename: str):
|
||||
response = get(url, timeout=10)
|
||||
if response.status_code != 200:
|
||||
logger.error(f"Failed to download {filename}")
|
||||
return
|
||||
with open(filename, "wb") as file:
|
||||
file.write(response.content)
|
||||
logger.info(f"Downloaded {filename}")
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = ArgumentParser(description="Get the audio URL for a given episode number")
|
||||
parser.add_argument(
|
||||
"episode_num", type=int, help="The episode number to get the audio URL for"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-d", "--download", action="store_true", help="Download the audio file"
|
||||
)
|
||||
parser.add_argument("-o", "--output", help="Output directory name")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parse_args()
|
||||
if args.episode_num < 1:
|
||||
logger.error("Episode number must be greater than 0")
|
||||
episode = args.episode_num
|
||||
audio = get_audio_url(episode)
|
||||
sub = get_sub_url(episode)
|
||||
if args.download:
|
||||
if args.output:
|
||||
download_file(audio, f"{args.output}/Nihongo-Con-Teppei-E{episode:0>2}.mp3")
|
||||
download_file(sub, f"{args.output}/Nihongo-Con-Teppei-E{episode:0>2}.vtt")
|
||||
else:
|
||||
download_file(audio, f"Nihongo-Con-Teppei-E{episode:0>2}.mp3")
|
||||
download_file(sub, f"Nihongo-Con-Teppei-E{episode:0>2}.vtt")
|
||||
else:
|
||||
print(f"Audio URL: {audio}")
|
||||
print(f"Subtitle URL: {sub}")
|
||||
Reference in New Issue
Block a user