Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::::::::::::::
- brightness_down.bash
- ::::::::::::::
- #!/bin/bash
- killall xbindkeys
- # keycode 163, XF86Mail
- xdotool key XF86MonBrightnessDown
- xbindkeys::::::::::::::
- brightness_up.bash
- ::::::::::::::
- #!/bin/bash
- killall xbindkeys
- # keycode 180, XF86HomePage
- xdotool key XF86MonBrightnessUp
- xbindkeys::::::::::::::
- escape.bash
- ::::::::::::::
- #!/bin/bash
- player_title="LosslessCut"
- function block_double_run () {
- pids=($(pidof -x $(basename $0)))
- if [[ ${#pids[@]} -gt 1 ]] ; then
- echo "double run blocked"
- spd-say -t female2 "double run"
- exit
- fi
- }
- 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
- }
- block_double_run
- wait_for_window_to_activate "$player_title"
- xdotool key Escape
- spd-say -t female2 "escape"::::::::::::::
- fforward.bash
- ::::::::::::::
- #!/bin/bash
- player_title="LosslessCut"
- function block_double_run () {
- pids=($(pidof -x $(basename $0)))
- if [[ ${#pids[@]} -gt 1 ]] ; then
- echo "double run blocked"
- spd-say -t female2 "double run"
- exit
- fi
- }
- 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_seconds() {
- # time format 00:58:12.749
- IFS=':' read -ra my_array1 <<< "$1"
- sec_input=$2
- 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")
- d=$(date '+%d.%b.%Y %T' --date="@$((secs + sec_input))")
- t="${d##* }"".$msec"
- echo $t
- }
- function enter_timecode() {
- seconds=$1
- wait_for_window_to_activate "$player_title"
- echo -n "" | xclip -selection clipboard
- xdotool key Right
- sleep 0.1
- xdotool key g
- sleep 0.5
- xdotool key Ctrl+a
- sleep 0.1
- xdotool key Ctrl+c
- sleep 0.1
- clip_read=$(xsel -b)
- mod_t=$(time_add_seconds "$clip_read" $seconds)
- echo -n "$mod_t" | xclip -selection clipboard
- xdotool key Ctrl+v
- xdotool key Return
- echo $clip_read
- }
- block_double_run
- enter_timecode 60
- spd-say -t female2 n::::::::::::::
- fforward_s.bash
- ::::::::::::::
- #!/bin/bash
- player_title="LosslessCut"
- function block_double_run () {
- pids=($(pidof -x $(basename $0)))
- if [[ ${#pids[@]} -gt 1 ]] ; then
- echo "double run blocked"
- spd-say -t female2 "double run"
- exit
- fi
- }
- 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_seconds() {
- # time format 00:58:12.749
- IFS=':' read -ra my_array1 <<< "$1"
- sec_input=$2
- 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")
- d=$(date '+%d.%b.%Y %T' --date="@$((secs + sec_input))")
- t="${d##* }"".$msec"
- echo $t
- }
- function enter_timecode() {
- seconds=$1
- wait_for_window_to_activate "$player_title"
- echo -n "" | xclip -selection clipboard
- xdotool key Right
- sleep 0.1
- xdotool key g
- sleep 0.5
- xdotool key Ctrl+a
- sleep 0.1
- xdotool key Ctrl+c
- clip_read=$(xsel -b)
- mod_t=$(time_add_seconds "$clip_read" $seconds)
- echo -n "$mod_t" | xclip -selection clipboard
- xdotool key Ctrl+v
- xdotool key Return
- echo $clip_read
- }
- block_double_run
- enter_timecode 3
- 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 block_double_run () {
- pids=($(pidof -x $(basename $0)))
- if [[ ${#pids[@]} -gt 1 ]] ; then
- echo "double run blocked"
- spd-say -t female2 "double run"
- exit
- fi
- }
- 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
- }
- block_double_run
- move_previous
- load_file
- spd-say -t female2 "file loaded"::::::::::::::
- mark_in.bash
- ::::::::::::::
- #!/bin/bash
- recordings_dir="/media/$(whoami)/extsd/recordings/"
- player_title="LosslessCut"
- markin_loc="$recordings_dir"markin.txt""
- function block_double_run () {
- pids=($(pidof -x $(basename $0)))
- if [[ ${#pids[@]} -gt 1 ]] ; then
- echo "double run blocked"
- spd-say -t female2 "double run"
- exit
- fi
- }
- 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() {
- repeat_send_key "$player_title" "i"
- sleep 0.5
- spd-say -t female2 "mark in"
- }
- block_double_run
- wait_for_window_to_activate "$player_title"
- mark_in::::::::::::::
- mark_out.bash
- ::::::::::::::
- #!/bin/bash
- recordings_dir="/media/$(whoami)/extsd/recordings/"
- player_title="LosslessCut"
- markin_loc="$recordings_dir"markin.txt""
- function block_double_run () {
- pids=($(pidof -x $(basename $0)))
- if [[ ${#pids[@]} -gt 1 ]] ; then
- echo "double run blocked"
- spd-say -t female2 "double run"
- exit
- fi
- }
- 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_out() {
- repeat_send_key "$player_title" "o"
- sleep 0.5
- spd-say -t female2 "mark out"
- }
- block_double_run
- wait_for_window_to_activate "$player_title"
- mark_out::::::::::::::
- move_files.bash
- ::::::::::::::
- #!/bin/bash
- # GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
- overwrite_files="yes"
- copying_mode="move"
- eject_usb_drive="yes"
- check_period_in_seconds=60
- # server PC:
- folder_to_monitor="/media/ramdisk/"
- # client PC, label of external sd card:
- monitor_skip_strings=(extsd)
- # my computer location:
- backup_root_folder="/media/$(whoami)/"
- search_for_folder_to_backup_to="recordings"
- file_extensions_to_include="mp3\|flac\|mp4"
- file_extensions_to_exclude="aria2"
- function countdown_timer() {
- time_sec=$1
- while [[ 0 -ne $time_sec ]]; do
- echo "$time_sec, waiting... to start"
- time_sec=$[$time_sec-1]
- sleep 1
- done
- }
- function download_wait_to_finish() {
- src_dir="$1"
- search_dext="$2"
- readarray -t arr_fd < <(find "$src_dir" -maxdepth 1 -type f -regex '.*\.\('$search_dext'\)$' | sed "s/.*\///" | sort)
- if [[ ${#arr_fd[@]} > 0 ]]; then
- echo "waiting for download to finish..."
- while [[ ${#arr_fd[@]} > 0 ]]; do
- sleep 1
- readarray -t arr_fd < <(find "$src_dir" -maxdepth 1 -type f -regex '.*\.\('$search_dext'\)$' | sed "s/.*\///" | sort)
- done
- echo "download finished at: "$(date +"%H:%M:%S")
- fi
- }
- function find_copy_files() {
- src_dir="$1"
- out_dir_root="$2"
- backup_dir="$3"
- search_ext="$4"
- copy_detection=0
- client_detection=0
- out_dir=""
- mount_loc=""
- readarray -t arr_d < <(find "$out_dir_root" -mindepth 1 -maxdepth 1 -type d | sed "s/.*\///" | sort)
- # detect server or client
- for i in "${arr_d[@]}"
- do
- out_dir_loc="$out_dir_root$i/$backup_dir/"
- if [[ -d "$out_dir_loc" ]]; then
- mount_loc="$out_dir_root$i"
- # client detection:
- if [[ $client_detection -eq 0 ]]; then
- for j in "${monitor_skip_strings[@]}"
- do
- if echo $out_dir_loc | grep -q "$j" ; then
- client_detection=1
- break
- fi
- done
- fi
- if [[ $client_detection -eq 1 ]]; then
- # only one input:
- for j in "${monitor_skip_strings[@]}"
- do
- if echo $out_dir_loc | grep -q "$j" ; then
- echo "skipping" > /dev/null
- else
- src_dir=$out_dir_loc
- break
- fi
- done
- # only one output:
- for j in "${monitor_skip_strings[@]}"
- do
- if echo $out_dir_loc | grep -q "$j" ; then
- out_dir=$out_dir_loc
- break
- fi
- done
- elif [[ $client_detection -eq 0 ]]; then
- # only one output, first one found:
- for j in "${monitor_skip_strings[@]}"
- do
- if echo $out_dir_loc | grep -q "$j" ; then
- echo "skipping" > /dev/null
- else
- out_dir=$out_dir_loc
- break
- fi
- done
- # input is original, unchanged
- fi
- fi
- done
- echo "source directory: $src_dir"
- echo "backup directory: $out_dir"
- download_wait_to_finish "$src_dir" "$file_extensions_to_exclude"
- if [[ ! $out_dir == "" ]]; then
- readarray -t arr_f < <(find "$src_dir" -maxdepth 1 -type f -regex '.*\.\('$search_ext'\)$' | sed "s/.*\///" | sort)
- for i in "${arr_f[@]}"
- do
- file_src_loc=$src_dir$i
- file_out_loc=$out_dir$i
- if [[ "$copying_mode" == "copy" ]]; then
- if [[ ! -f "$file_out_loc" ]]; then
- echo "coping file: $file_src_loc"
- cp "$file_src_loc" "$out_dir"
- copy_detection=1
- elif [[ "$overwrite_files" == "yes" && $file_src_loc -nt $file_out_loc ]]; then
- echo "overwriting file: $file_src_loc"
- cp "$file_src_loc" "$out_dir"
- copy_detection=1
- else
- echo "file exists, skipping: $file_out_loc"
- fi
- elif [[ "$copying_mode" == "move" ]]; then
- if [[ ! -f "$file_out_loc" ]]; then
- echo "moving file: $file_src_loc"
- mv -n "$file_src_loc" "$file_out_loc"
- copy_detection=1
- elif [[ "$overwrite_files" == "yes" && $file_src_loc -nt $file_out_loc ]]; then
- echo "moving and overwriting file: $file_src_loc"
- mv -f "$file_src_loc" "$file_out_loc"
- copy_detection=1
- else
- echo "file exists, skipping: $file_out_loc"
- fi
- fi
- done
- fi
- }
- while :
- do
- countdown_timer $check_period_in_seconds
- find_copy_files "$folder_to_monitor" "$backup_root_folder" "$search_for_folder_to_backup_to" "$file_extensions_to_include"
- if [[ copy_detection -eq 1 ]]; then
- if [[ "$eject_usb_drive" == "yes" ]]; then
- # eject backup/source location
- gio mount -e "$mount_loc"
- spd-say -t female2 "usb drive ejected"
- sleep 3
- fi
- # sudo apt install speech-dispatcher
- spd-say -t female2 "your grace, backup is done, please praise me..."
- fi
- done::::::::::::::
- play_pause.bash
- ::::::::::::::
- #!/bin/bash
- player_title="LosslessCut"
- function block_double_run () {
- pids=($(pidof -x $(basename $0)))
- if [[ ${#pids[@]} -gt 1 ]] ; then
- echo "double run blocked"
- spd-say -t female2 "double run"
- exit
- fi
- }
- 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
- }
- block_double_run
- spd-say -t female2 s
- wait_for_window_to_activate "$player_title"
- repeat_send_key "$player_title" space::::::::::::::
- poweroff_screen.bash
- ::::::::::::::
- #!/bin/bash
- # sudo apt install xprintidle
- function poweroff_screen() {
- # in seconds:
- time_in_seconds=$1
- threshold=$(( $time_in_seconds * 1000 ))
- while :
- do
- sleep 1
- idletime=$(xprintidle)
- if [[ $idletime -gt $threshold ]]; then
- # reduce brightness
- xrandr --output DSI-1 --brightness 0.10
- sleep 1
- # poweroff screen
- xset dpms force off
- sleep $time_in_seconds
- fi
- done
- }
- poweroff_screen 9::::::::::::::
- redshift.bash
- ::::::::::::::
- #!/bin/bash
- redshift -O 3700
- spd-say -t female2 "redshift"::::::::::::::
- resume_playback.bash
- ::::::::::::::
- #!/bin/bash
- 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 block_double_run () {
- pids=($(pidof -x $(basename $0)))
- if [[ ${#pids[@]} -gt 1 ]] ; then
- echo "double run blocked"
- spd-say -t female2 "double run"
- exit
- fi
- }
- 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_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() {
- 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)
- 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
- # jump to current segment's start time, mark in used to make paper place, one segment
- xdotool key Shift+Left
- fi
- }
- block_double_run
- load_file
- sleep 2
- spd-say -t female2 "resume playing"::::::::::::::
- rewind.bash
- ::::::::::::::
- #!/bin/bash
- player_title="LosslessCut"
- function block_double_run () {
- pids=($(pidof -x $(basename $0)))
- if [[ ${#pids[@]} -gt 1 ]] ; then
- echo "double run blocked"
- spd-say -t female2 "double run"
- exit
- fi
- }
- 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_seconds() {
- # time format 00:58:12.749
- IFS=':' read -ra my_array1 <<< "$1"
- sec_input=$2
- 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")
- d=$(date '+%d.%b.%Y %T' --date="@$((secs - sec_input))")
- t="${d##* }"".$msec"
- echo $t
- }
- function enter_timecode() {
- seconds=$1
- wait_for_window_to_activate "$player_title"
- echo -n "" | xclip -selection clipboard
- xdotool key Left
- sleep 0.1
- xdotool key g
- sleep 0.5
- xdotool key Ctrl+a
- sleep 0.1
- xdotool key Ctrl+c
- clip_read=$(xsel -b)
- mod_t=$(time_minus_seconds "$clip_read" $seconds)
- echo -n "$mod_t" | xclip -selection clipboard
- xdotool key Ctrl+v
- xdotool key Return
- echo $clip_read
- }
- block_double_run
- enter_timecode 15
- spd-say -t female2 p::::::::::::::
- rewind_s.bash
- ::::::::::::::
- #!/bin/bash
- player_title="LosslessCut"
- function block_double_run () {
- pids=($(pidof -x $(basename $0)))
- if [[ ${#pids[@]} -gt 1 ]] ; then
- echo "double run blocked"
- spd-say -t female2 "double run"
- exit
- fi
- }
- 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_seconds() {
- # time format 00:58:12.749
- IFS=':' read -ra my_array1 <<< "$1"
- sec_input=$2
- 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")
- d=$(date '+%d.%b.%Y %T' --date="@$((secs - sec_input))")
- t="${d##* }"".$msec"
- echo $t
- }
- function enter_timecode() {
- seconds=$1
- wait_for_window_to_activate "$player_title"
- echo -n "" | xclip -selection clipboard
- xdotool key Left
- sleep 0.1
- xdotool key g
- sleep 0.5
- xdotool key Ctrl+a
- sleep 0.1
- xdotool key Ctrl+c
- clip_read=$(xsel -b)
- mod_t=$(time_minus_seconds "$clip_read" $seconds)
- echo -n "$mod_t" | xclip -selection clipboard
- xdotool key Ctrl+v
- xdotool key Return
- echo $clip_read
- }
- block_double_run
- enter_timecode 3
- spd-say -t female2 p::::::::::::::
- screen_off.bash
- ::::::::::::::
- #!/bin/bash
- spd-say -t female2 "screen off"
- xrandr --output DSI-1 --brightness 0.10
- sleep 1
- xset dpms force off::::::::::::::
- shutdown.bash
- ::::::::::::::
- #!/bin/bash
- # sudo apt install speech-dispatcher wmctrl
- spd-say -t female2 "shutdown started"
- visible_window_ids=$(wmctrl -l | egrep -v "AllTray| -1 " | cut -d" " -f 1)
- read -ra arr -d ' ' <<< "$visible_window_ids"
- for i in "${arr[@]}"
- do
- xdotool windowactivate --sync $i
- sleep 0.5
- xdotool keydown alt && sleep 0.5 && xdotool key F4 && sleep 0.5 && xdotool keyup alt
- sleep 5
- done
- spd-say -t female2 "powering off"
- sleep 3
- systemctl poweroff::::::::::::::
- split_audio.bash
- ::::::::::::::
- #!/bin/bash
- player_title="LosslessCut"
- function block_double_run () {
- pids=($(pidof -x $(basename $0)))
- if [[ ${#pids[@]} -gt 1 ]] ; then
- echo "double run blocked"
- spd-say -t female2 "double run"
- exit
- fi
- }
- 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
- }
- block_double_run
- 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.bash"
- c:84
- "/media/$(whoami)/extsd/Music/mark_out.bash"
- c:85
- "/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:104
- "/media/$(whoami)/extsd/Music/rewind_s.bash"
- c:79
- "/media/$(whoami)/extsd/Music/fforward_s.bash"
- c:80
- "/media/$(whoami)/extsd/Music/escape.bash"
- c:106
- "/media/$(whoami)/extsd/Music/resume_playback.bash"
- c:81
- "/media/$(whoami)/extsd/Music/shutdown.bash"
- c:63
- "/media/$(whoami)/extsd/Music/brightness_down.bash"
- c:163
- "/media/$(whoami)/extsd/Music/brightness_up.bash"
- c:180
Advertisement
Add Comment
Please, Sign In to add comment