Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::::::::::::::
- fforward.bash
- ::::::::::::::
- #!/bin/bash
- audtool playback-seek-relative 10
- spd-say -t female2 n::::::::::::::
- join_play.bash
- ::::::::::::::
- #!/bin/bash
- function check_out_loc() {
- w_dir="$(pwd)/joins"
- echo $w_dir
- if [ -d "$w_dir" ]; then
- echo direcotry exists
- else
- mkdir "$(pwd)/joins"
- echo direcotry created
- fi
- }
- function join_clips() {
- # join clip files
- readarray -t files < <(find ./ -maxdepth 1 -type f -regex '.*\.\(mp3\|flac\)$' | sed "s/.*\///")
- file_name=$(basename "${files[0]}" | cut -d. -f1)
- file_extension=$(basename "${files[0]}" | cut -d. -f2)
- date_str=$(date +%s)
- out_loc=$(echo joins/"$date_str"_$file_name.$file_extension)
- cat ./clips/*.* > ./"$out_loc"
- # get original file
- date_str=$((date_str + 1))
- mv "$file_name.$file_extension" "$(pwd)/joins/"$date_str"_$file_name.$file_extension"
- # get marks file
- readarray -t files < <(find ./ -maxdepth 1 -type f -regex '.*\.\(txt\)$' | sed "s/.*\///")
- file_name=$(basename "${files[0]}" | cut -d. -f1)
- file_extension=$(basename "${files[0]}" | cut -d. -f2)
- date_str=$((date_str + 1))
- mv "$file_name.$file_extension" "$(pwd)/joins/"$date_str"_$file_name.$file_extension"
- audacious "$(echo $(pwd)/$out_loc)"
- }
- cd /media/$(whoami)/extsd/Music
- check_out_loc
- join_clips
- spd-say -t female2 "join & play"::::::::::::::
- load_file.bash
- ::::::::::::::
- #!/bin/bash
- function check_out_loc() {
- w_dir="$(pwd)/joins"
- echo $w_dir
- if [ -d "$w_dir" ]; then
- echo direcotry exists
- else
- mkdir "$(pwd)/joins"
- echo direcotry created
- fi
- }
- function load_file() {
- cd /media/$(whoami)/extsd/recordings
- 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="/media/$(whoami)/extsd/Music/"
- mv "$file_name.$file_extension" "$out_dir"
- audacious "$out_dir$file_name.$file_extension"
- fi
- }
- function move_previous() {
- cd /media/$(whoami)/extsd/Music
- 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
- out_dir="/media/$(whoami)/extsd/Music/joins/"
- 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
- function mark_audio() {
- out_loc="$(echo $(pwd)/marks.txt)"
- status=$(audtool playback-status)
- current_song_pos=$(audtool --current-song-output-length-seconds)
- minutes=$((current_song_pos / 60))
- if [[ "$minutes" -lt 10 ]]; then
- minutes=$(printf "%02d" $minutes)
- fi
- seconds=$((current_song_pos % 60))
- if [[ "$seconds" -lt 10 ]]; then
- seconds=$(printf "%02d" $seconds)
- fi
- write_marker=$(echo $minutes":"$seconds)
- if [[ -f "$out_loc" ]]; then
- echo -n " $write_marker" >> $out_loc
- else
- echo -n "$write_marker" >> $out_loc
- fi
- }
- cd /media/$(whoami)/extsd/Music
- mark_audio
- spd-say -t female2 m::::::::::::::
- play_pause.bash
- ::::::::::::::
- #!/bin/bash
- function play_pause() {
- status=$(audtool playback-status)
- if grep 'paused\|stopped' <<< $status ; then
- audtool playback-play
- else
- audtool playback-pause
- fi
- }
- play_pause
- spd-say -t female2 s::::::::::::::
- redshift.bash
- ::::::::::::::
- #!/bin/bash
- redshift -O 3700
- spd-say -t female2 "redshift"::::::::::::::
- rewind.bash
- ::::::::::::::
- #!/bin/bash
- audtool playback-seek-relative -10
- 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
- function check_out_loc() {
- w_dir="$(pwd)/clips"
- echo $w_dir
- if [ -d "$w_dir" ]; then
- # re-creatates subdir clips in the current folder
- rm -rf $w_dir
- mkdir "$(pwd)/clips"
- echo direcotry re-created
- else
- mkdir "$(pwd)/clips"
- echo direcotry created
- fi
- }
- function cut_audio() {
- readarray -t mp3_files < <(find ./ -maxdepth 1 -type f -regex '.*\.\(mp3\|flac\)$' | sed "s/.*\///")
- if [ ${#mp3_files[@]} -eq 1 ]; then
- j=0
- for i in "$@"; do
- ((j++))
- if [ $((j%2)) -eq 0 ]; then
- end_time=$i
- MPHR=60
- IFS=':' read -ra start_array <<< "$start_time"
- IFS=':' read -ra end_array <<< "$end_time"
- len_start_min=${#start_array[0]}
- len_start_sec=$(( $len_start_min + 1 ))
- len_end_min=${#end_array[0]}
- len_end_sec=$(( $len_end_min + 1 ))
- start_time_sec=$(( ( 10#${start_time:0:$len_start_min} ) * MPHR + 10#${start_time:$len_start_sec} ))
- duration=$(( ( 10#${end_time:0:$len_end_min} - 10#${start_time:0:$len_start_min} ) * MPHR + 10#${end_time:$len_end_sec} - 10#${start_time:$len_start_sec} ))
- file_name=$(basename "${mp3_files[0]}" | cut -d. -f1)
- file_extension=$(basename "${mp3_files[0]}" | cut -d. -f2)
- escape=("[" "]" "~" "!" "{" "}" "(" ")" "$" "@" "<" ">" ":" ";" "," '`' "%" "+" "=" '"' "|" "?" '*' "&" " " "'")
- for e in "${escape[@]}"
- do
- file_name=${file_name//[$e]/\\$e}
- done
- file_name=${file_name//"\\'"/"'\"\'\"'"}
- w_dir="$(pwd)/clips/"
- out_name=$w_dir$(echo $file_name"_"$start_time"-"$end_time"."$file_extension | sed s/:/_/g)
- # removes metadata
- cmd=$(echo ffmpeg -y -ss $start_time_sec -t $duration -i "$file_name"."$file_extension" -map_metadata -1 -c:a copy "$out_name")
- # no metadata removal
- # cmd=$(echo ffmpeg -y -ss $start_time_sec -t $duration -i "$file_name"."$file_extension" -c:a copy "$out_name")
- # echo $cmd
- bash -c "$cmd"
- else
- start_time=$i
- fi
- done
- # backup marks.txt file
- readarray -t files < <(find ./ -maxdepth 1 -type f -regex '.*\.\(mp3\|flac\)$' | sed "s/.*\///")
- file_name=$(basename "${files[0]}" | cut -d. -f1)
- if [ -f "$(pwd)/marks.txt" ]; then
- marks_out_loc="$file_name"_marks.txt
- cp marks.txt "$marks_out_loc"
- echo -n " $file_name"."$file_extension" >> ./"$marks_out_loc"
- echo marks.txt backup done
- rm marks.txt
- fi
- else
- echo "error, only 1 mp3/flac file allowed in the current working directory"
- fi
- }
- cd /media/$(whoami)/extsd/Music
- check_out_loc
- cut_audio $(cat $(pwd)/marks.txt)
- 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/join_play.bash"
- c:84
- "/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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement