Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::::::::::::::
- fforward.bash
- ::::::::::::::
- #!/bin/bash
- player_title="LosslessCut"
- function wait_for_window_to_activate() {
- # first parameter - window title or part of the window title
- window_title="$1"
- time_sec=900
- while [[ 0 -ne $time_sec ]]; do
- echo "$time_sec, waiting... to activate"
- time_sec=$[$time_sec-1]
- xdotool search --onlyvisible --name "$window_title" windowactivate
- window_name=$(xdotool getwindowfocus getwindowname)
- if echo $window_name | grep -q "$window_title" ; then
- echo "window active "$window_name
- break
- fi
- sleep 0.5
- done
- }
- function time_add_10s() {
- # time format 00:58:12.749
- IFS=':' read -ra my_array1 <<< "$1"
- hr=${my_array1[0]}
- min=${my_array1[1]}
- sec=${my_array1[2]%.*}
- msec=${my_array1[2]##*.}
- secs=$(date +%s --date="1970-03-24 $hr:$min:$sec")
- # add 10s
- d=$(date '+%d.%b.%Y %T' --date="@$((secs + 10))")
- t="${d##* }"".$msec"
- echo $t
- }
- function enter_timecode() {
- wait_for_window_to_activate "$player_title"
- echo -n "" | xclip -selection clipboard
- xdotool key g
- sleep 0.1
- xdotool key Ctrl+a
- sleep 0.1
- xdotool key Ctrl+c
- clip_read=$(xsel -b)
- mod_t=$(time_add_10s "$clip_read")
- echo -n "$mod_t" | xclip -selection clipboard
- xdotool key Ctrl+v
- xdotool key Return
- echo $clip_read
- }
- enter_timecode
- spd-say -t female2 n::::::::::::::
- fforward_s.bash
- ::::::::::::::
- #!/bin/bash
- player_title="LosslessCut"
- function wait_for_window_to_activate() {
- # first parameter - window title or part of the window title
- window_title="$1"
- time_sec=900
- while [[ 0 -ne $time_sec ]]; do
- echo "$time_sec, waiting... to activate"
- time_sec=$[$time_sec-1]
- xdotool search --onlyvisible --name "$window_title" windowactivate
- window_name=$(xdotool getwindowfocus getwindowname)
- if echo $window_name | grep -q "$window_title" ; then
- echo "window active "$window_name
- break
- fi
- sleep 0.5
- done
- }
- function time_add_3s() {
- # time format 00:58:12.749
- IFS=':' read -ra my_array1 <<< "$1"
- hr=${my_array1[0]}
- min=${my_array1[1]}
- sec=${my_array1[2]%.*}
- msec=${my_array1[2]##*.}
- secs=$(date +%s --date="1970-03-24 $hr:$min:$sec")
- # add 10s
- d=$(date '+%d.%b.%Y %T' --date="@$((secs + 3))")
- t="${d##* }"".$msec"
- echo $t
- }
- function enter_timecode() {
- wait_for_window_to_activate "$player_title"
- echo -n "" | xclip -selection clipboard
- xdotool key g
- sleep 0.1
- xdotool key Ctrl+a
- sleep 0.1
- xdotool key Ctrl+c
- clip_read=$(xsel -b)
- mod_t=$(time_add_3s "$clip_read")
- echo -n "$mod_t" | xclip -selection clipboard
- xdotool key Ctrl+v
- xdotool key Return
- echo $clip_read
- }
- enter_timecode
- spd-say -t female2 n::::::::::::::
- load_file.bash
- ::::::::::::::
- #!/bin/bash
- recordings_dir="/media/$(whoami)/extsd/recordings/"
- music_dir="/media/$(whoami)/extsd/Music/"
- clips_dir="$music_dir"clips/""
- player_full_path="$music_dir"LosslessCut-linux-x86_64.AppImage""
- player_title="LosslessCut"
- function wait_for_window() {
- # first parameter - window title or part of the window title
- window_title="$1"
- time_sec=900
- while [[ 0 -ne $time_sec ]]; do
- echo "$time_sec, waiting... to appear"
- sleep 1
- time_sec=$[$time_sec-1]
- xdotool search --onlyvisible --name "$window_title" windowactivate
- if [[ $? == 0 ]]; then
- xdotool getactivewindow windowmove 1 30
- echo "window found"
- break
- fi
- done
- }
- function repeat_send_key() {
- window_title="$1"
- key="$2"
- repeat="${3:-1}"
- xdotool search --onlyvisible --name "$window_title" windowactivate
- if [[ $? == 0 ]]; then
- for (( i=1; i <= repeat; i++ ))
- do
- xdotool key $key
- sleep 0.1
- done
- fi
- }
- function make_it_exec() {
- file_full_path="$1"
- if [[ -x "$file_full_path" ]]; then
- echo "File is executable"
- else
- chmod +x "$file_full_path"
- echo "File is executable now"
- fi
- }
- function check_out_loc() {
- w_dir="$1"
- if [ -d "$w_dir" ]; then
- echo direcotry exists
- else
- mkdir "$w_dir"
- echo direcotry created
- fi
- }
- function check_audio_playback() {
- time_sec=60
- while [[ 0 -ne $time_sec ]]; do
- repeat_send_key "$player_title" space
- echo "$time_sec, waiting... to play"
- sleep 1
- time_sec=$[$time_sec-1]
- status=$(pacmd list-sink-inputs | grep -c 'state: RUNNING')
- if [[ $status -gt 0 ]]; then
- echo "sound is playing"
- break
- fi
- done
- }
- function load_file() {
- check_out_loc "$clips_dir"
- cd $recordings_dir
- readarray -t files < <(find ./ -maxdepth 1 -type f -regex '.*\.\(mp3\|flac\)$' | sed "s/.*\///" | sort)
- if [ ${#files[@]} -gt 0 ]; then
- file_name=$(basename "${files[0]}" | cut -d. -f1)
- file_extension=$(basename "${files[0]}" | cut -d. -f2)
- out_dir="$music_dir"
- mv "$file_name.$file_extension" "$out_dir"
- make_it_exec "$player_full_path"
- echo "$out_dir$file_name.$file_extension"
- killall losslesscut
- "$player_full_path" --settings-json '{customOutDir:"'"${clips_dir::-1}"'", "autoMerge":"true"}' "$out_dir$file_name.$file_extension" &
- wait_for_window "$player_title"
- check_audio_playback
- fi
- }
- function move_previous() {
- cd $music_dir
- readarray -t files < <(find ./ -maxdepth 1 -type f -regex '.*\.\(mp3\|flac\)$' | sed "s/.*\///" | sort)
- if [ ${#files[@]} -gt 0 ]; then
- file_name=$(basename "${files[0]}" | cut -d. -f1)
- file_extension=$(basename "${files[0]}" | cut -d. -f2)
- date_str=$(date +%s)
- check_out_loc "$clips_dir"
- out_dir="$clips_dir"
- echo "file to move: ""$file_name.$file_extension"
- mv "$file_name.$file_extension" "$out_dir"$date_str"_$file_name.$file_extension"
- fi
- }
- move_previous
- load_file
- spd-say -t female2 "file loaded"::::::::::::::
- mark_in_out.bash
- ::::::::::::::
- #!/bin/bash
- recordings_dir="/media/$(whoami)/extsd/recordings/"
- player_title="LosslessCut"
- markin_loc="$recordings_dir"markin.txt""
- function wait_for_window_to_activate() {
- # first parameter - window title or part of the window title
- window_title="$1"
- time_sec=900
- while [[ 0 -ne $time_sec ]]; do
- echo "$time_sec, waiting... to activate"
- time_sec=$[$time_sec-1]
- xdotool search --onlyvisible --name "$window_title" windowactivate
- window_name=$(xdotool getwindowfocus getwindowname)
- if echo $window_name | grep -q "$window_title" ; then
- echo "window active "$window_name
- break
- fi
- sleep 0.5
- done
- }
- function repeat_send_key() {
- window_title="$1"
- key="$2"
- repeat="${3:-1}"
- xdotool search --onlyvisible --name "$window_title" windowactivate
- if [[ $? == 0 ]]; then
- for (( i=1; i <= repeat; i++ ))
- do
- xdotool key $key
- sleep 0.1
- done
- fi
- }
- function mark_in_out() {
- if [[ -f $markin_loc ]]; then
- repeat_send_key "$player_title" "o"
- rm $markin_loc
- else
- repeat_send_key "$player_title" "i"
- echo "mark in" > $markin_loc
- fi
- }
- wait_for_window_to_activate "$player_title"
- mark_in_out
- spd-say -t female2 m::::::::::::::
- play_pause.bash
- ::::::::::::::
- #!/bin/bash
- player_title="LosslessCut"
- function wait_for_window_to_activate() {
- # first parameter - window title or part of the window title
- window_title="$1"
- time_sec=900
- while [[ 0 -ne $time_sec ]]; do
- echo "$time_sec, waiting... to close"
- time_sec=$[$time_sec-1]
- xdotool search --onlyvisible --name "$window_title" windowactivate
- window_name=$(xdotool getwindowfocus getwindowname)
- if echo $window_name | grep -q "$window_title" ; then
- echo "window active "$window_name
- break
- fi
- sleep 0.5
- done
- }
- function repeat_send_key() {
- window_title="$1"
- key="$2"
- repeat="${3:-1}"
- xdotool search --onlyvisible --name "$window_title" windowactivate
- if [[ $? == 0 ]]; then
- for (( i=1; i <= repeat; i++ ))
- do
- xdotool key $key
- sleep 0.1
- done
- fi
- }
- spd-say -t female2 s
- wait_for_window_to_activate "$player_title"
- repeat_send_key "$player_title" space::::::::::::::
- redshift.bash
- ::::::::::::::
- #!/bin/bash
- redshift -O 3700
- spd-say -t female2 "redshift"::::::::::::::
- rewind.bash
- ::::::::::::::
- #!/bin/bash
- player_title="LosslessCut"
- function wait_for_window_to_activate() {
- # first parameter - window title or part of the window title
- window_title="$1"
- time_sec=900
- while [[ 0 -ne $time_sec ]]; do
- echo "$time_sec, waiting... to activate"
- time_sec=$[$time_sec-1]
- xdotool search --onlyvisible --name "$window_title" windowactivate
- window_name=$(xdotool getwindowfocus getwindowname)
- if echo $window_name | grep -q "$window_title" ; then
- echo "window active "$window_name
- break
- fi
- sleep 0.5
- done
- }
- function time_minus_10s() {
- # time format 00:58:12.749
- IFS=':' read -ra my_array1 <<< "$1"
- hr=${my_array1[0]}
- min=${my_array1[1]}
- sec=${my_array1[2]%.*}
- msec=${my_array1[2]##*.}
- secs=$(date +%s --date="1970-03-24 $hr:$min:$sec")
- # minus 10s
- d=$(date '+%d.%b.%Y %T' --date="@$((secs - 10))")
- t="${d##* }"".$msec"
- echo $t
- }
- function enter_timecode() {
- wait_for_window_to_activate "$player_title"
- echo -n "" | xclip -selection clipboard
- xdotool key g
- sleep 0.1
- xdotool key Ctrl+a
- sleep 0.1
- xdotool key Ctrl+c
- clip_read=$(xsel -b)
- mod_t=$(time_minus_10s "$clip_read")
- echo -n "$mod_t" | xclip -selection clipboard
- xdotool key Ctrl+v
- xdotool key Return
- echo $clip_read
- }
- enter_timecode
- spd-say -t female2 p::::::::::::::
- rewind_s.bash
- ::::::::::::::
- #!/bin/bash
- player_title="LosslessCut"
- function wait_for_window_to_activate() {
- # first parameter - window title or part of the window title
- window_title="$1"
- time_sec=900
- while [[ 0 -ne $time_sec ]]; do
- echo "$time_sec, waiting... to activate"
- time_sec=$[$time_sec-1]
- xdotool search --onlyvisible --name "$window_title" windowactivate
- window_name=$(xdotool getwindowfocus getwindowname)
- if echo $window_name | grep -q "$window_title" ; then
- echo "window active "$window_name
- break
- fi
- sleep 0.5
- done
- }
- function time_minus_3s() {
- # time format 00:58:12.749
- IFS=':' read -ra my_array1 <<< "$1"
- hr=${my_array1[0]}
- min=${my_array1[1]}
- sec=${my_array1[2]%.*}
- msec=${my_array1[2]##*.}
- secs=$(date +%s --date="1970-03-24 $hr:$min:$sec")
- # minus 10s
- d=$(date '+%d.%b.%Y %T' --date="@$((secs - 3))")
- t="${d##* }"".$msec"
- echo $t
- }
- function enter_timecode() {
- wait_for_window_to_activate "$player_title"
- echo -n "" | xclip -selection clipboard
- xdotool key g
- sleep 0.1
- xdotool key Ctrl+a
- sleep 0.1
- xdotool key Ctrl+c
- clip_read=$(xsel -b)
- mod_t=$(time_minus_3s "$clip_read")
- echo -n "$mod_t" | xclip -selection clipboard
- xdotool key Ctrl+v
- xdotool key Return
- echo $clip_read
- }
- enter_timecode
- spd-say -t female2 p::::::::::::::
- screen_off.bash
- ::::::::::::::
- #!/bin/bash
- xrandr --output DSI-1 --brightness 0.20
- spd-say -t female2 "screen off"
- xset dpms force off::::::::::::::
- split_audio.bash
- ::::::::::::::
- #!/bin/bash
- player_title="LosslessCut"
- function wait_for_window_to_activate() {
- # first parameter - window title or part of the window title
- window_title="$1"
- time_sec=900
- while [[ 0 -ne $time_sec ]]; do
- echo "$time_sec, waiting... to activate"
- time_sec=$[$time_sec-1]
- xdotool search --onlyvisible --name "$window_title" windowactivate
- window_name=$(xdotool getwindowfocus getwindowname)
- if echo $window_name | grep -q "$window_title" ; then
- echo "window active "$window_name
- break
- fi
- sleep 0.5
- done
- }
- function cut_audio() {
- xdotool key e
- sleep 0.5
- xdotool key e
- sleep 0.5
- }
- wait_for_window_to_activate "$player_title"
- cut_audio
- spd-say -t female2 "split audio"::::::::::::::
- volume_down.bash
- ::::::::::::::
- #!/bin/bash
- pactl -- set-sink-volume 0 -1%::::::::::::::
- volume_up.bash
- ::::::::::::::
- #!/bin/bash
- pactl -- set-sink-volume 0 +1%::::::::::::::
- .xbindkeysrc
- ::::::::::::::
- "/media/$(whoami)/extsd/Music/rewind.bash"
- c:87
- "/media/$(whoami)/extsd/Music/fforward.bash"
- c:88
- "/media/$(whoami)/extsd/Music/play_pause.bash"
- c:89
- "/media/$(whoami)/extsd/Music/mark_in_out.bash"
- c:104
- "/media/$(whoami)/extsd/Music/split_audio.bash"
- c:83
- "/media/$(whoami)/extsd/Music/volume_up.bash"
- c:86
- "/media/$(whoami)/extsd/Music/volume_down.bash"
- c:82
- "/media/$(whoami)/extsd/Music/load_file.bash"
- c:90
- "/media/$(whoami)/extsd/Music/screen_off.bash"
- c:91
- "/media/$(whoami)/extsd/Music/redshift.bash"
- c:85
- "/media/$(whoami)/extsd/Music/rewind_s.bash"
- c:79
- "/media/$(whoami)/extsd/Music/fforward_s.bash"
- c:80
Advertisement
Add Comment
Please, Sign In to add comment