nyxrobotics commited on
Commit
f1a4c9d
·
1 Parent(s): 12307d9

Add scripts

Browse files
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+
2
+ download/
modules/download_from_youtube.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Options
3
+ PLAYLIST_URL=https://youtube.com/playlist?list=PLwlIgd6_8FLJqgvIgtUye8Jz2jSKLrCAI
4
+ # ----- Start script -----
5
+ # get playlist name
6
+ PLAYLIST_NAME=$(yt-dlp --no-warnings --dump-single-json --playlist-end 1 $PLAYLIST_URL | jq -r '.title')
7
+ echo "Playlist Name:" $PLAYLIST_NAME
8
+ # get script dir
9
+ SCRIPT_DIR=$(cd $(dirname $0); pwd)
10
+ mkdir -p $SCRIPT_DIR/../download/youtube/$PLAYLIST_NAME
11
+ cd $SCRIPT_DIR/../download/youtube/$PLAYLIST_NAME
12
+ yt-dlp -f "bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4]" $PLAYLIST_URL
modules/mp4_rename_english.sh ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Options
3
+ PLAYLIST_URL=https://youtube.com/playlist?list=PLwlIgd6_8FLJqgvIgtUye8Jz2jSKLrCAI
4
+ # ----- Start script -----
5
+ # get playlist name
6
+ PLAYLIST_NAME=$(yt-dlp --no-warnings --dump-single-json --playlist-end 1 $PLAYLIST_URL | jq -r '.title')
7
+ echo "Playlist Name:" $PLAYLIST_NAME
8
+ # get script dir
9
+ SCRIPT_DIR=$(cd $(dirname $0); pwd)
10
+ cd $SCRIPT_DIR/../download/youtube/$PLAYLIST_NAME
11
+ FILES="./*.mp4"
12
+ for FILEPATH in $FILES; do
13
+ NAME=$(basename -- "$FILEPATH")
14
+ EXTENSION="${NAME##*.}"
15
+ NAME="${NAME%.*}"
16
+ if LANG=C grep -q -n -v '^[[:cntrl:][:print:]]*$' <<< "$NAME" ; then
17
+ name_format=$(echo "$NAME" | uconv -x "Fullwidth-Halfwidth")
18
+ name_en=$(echo $(trans -brief -no-warn -no-ansi ja:en "$name_format") | sed -e "s/\./ /g" | sed -e "s/^The *//" | sed -e "s/^ *//" | sed -e "s/ *$//" | sed -e "s/ / /" | sed -e "s/#//" )
19
+ echo -e "$NAME"
20
+ echo -e "$name_en"
21
+ echo "rename '$NAME' '$name_en' '$FILEPATH'"
22
+ echo "-----"
23
+ fi
24
+ done
modules/mp4_to_jpg.sh ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Options
3
+ PLAYLIST_URL=https://youtube.com/playlist?list=PLwlIgd6_8FLJqgvIgtUye8Jz2jSKLrCAI
4
+ # ----- Start script -----
5
+ # get playlist name
6
+ PLAYLIST_NAME=$(yt-dlp --no-warnings --dump-single-json --playlist-end 1 $PLAYLIST_URL | jq -r '.title')
7
+ echo "Playlist Name:" $PLAYLIST_NAME
8
+ # get script dir
9
+ SCRIPT_DIR=$(cd $(dirname $0); pwd)
10
+ cd $SCRIPT_DIR/../download/youtube/$PLAYLIST_NAME
11
+
setup/install_apt_packages.sh ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ #!/bin/bash
2
+ sudo apt install -y ffmpeg jq translate-shell nkf