Merged helper-scripts and music-library-scripts

This commit is contained in:
Eric Torres 2018-09-13 15:46:32 -07:00
parent 3c7430df30
commit e8522c6fd4
5 changed files with 162 additions and 14 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
helper-scripts helper-scripts
PKGBUILD

View File

@ -1,6 +1,6 @@
# Maintainer: Eric Torres <erictorres4@protonmail.com> # Maintainer: Eric Torres <erictorres4@protonmail.com>
pkgname=helper-scripts pkgname=helper-scripts
pkgver=1.5 pkgver=1.5.1
pkgrel=1 pkgrel=1
pkgdesc="A collection of various helper scripts" pkgdesc="A collection of various helper scripts"
arch=('any') arch=('any')
@ -8,22 +8,13 @@ license=('GPL3')
groups=() groups=()
depends=('curl' 'python') depends=('curl' 'python')
makedepends=('git') makedepends=('git')
optdepends=('xdg-utils: for xdg-open with the open script') optdepends=()
source=("${pkgname}::git+file:///home/etorres/Packages/helper-scripts") source=("${pkgname}::git+file:///home/etorres/Packages/helper-scripts")
sha256sums=('63e0deceb6384700ae419ebea0abdb23b859d88417a52f5c83956ed25d1ade1b' sha256sums=('SKIP')
'a946953eaa319cdb322a747022a86ef6b01dcb1bb1d08af68551183617d37f2c' sha512sums=('SKIP')
'eb8a1747ac1742bf0e480801cdb948154bcc19c8e6af272ff1a9d24d371e5b6c'
'a89d8dd332ff0daf15eb7ca614dda3ddab8d6bd1d8dddf436aaa1cafbf695cbc'
'5350ddb71851be9159439f113325ef4d30bb90c5ee100b302ec4d55645f62413'
'cc9feaf4279a1d7bc65ad826f540e44c84ff8ae7eb6ae8b4cb71ef9d1f8576ca')
sha512sums=('d6dcd9dfb7f5275562f831da87edfb712f01a9c4de1c3ea0070c0a9a2d7a21707eee4a21feca9de5d735ab9c45c99470f70dd95e63bf4a0e695453fd55576771'
'534cd37a3222cc617ef2af194822a3b79b9a3836653ae13a734f055904d836eba87478965af2902ae718c90dbb4d7f2da28ac533a276c2a847d4978d2a2ae9b4'
'8b3fa9f7114bb89da005285676a92ad7000503f28d732aaa7c8f84976f80c627153b3728a8ec59aba5b6f19f7df7affb963a047328449be1d520a810de284d45'
'0b71a3ab2fe09647b29b4bf4370c9332749605fe45f3defade45ecc2d85638be7312bc786b5f56a2b3df6d5ef83e10e52108b8b40b2460b11f5a8f3785afc61c'
'74f4559a3ddcde0a3a411f11898d6323639c593525de83064eab82b10353417d518ed5b0bb1d4c2bed9b03b25f007bd8ced413cfb549fb36a7530cb3f0a935f5'
'00777bc87b7e522cc96616c84451ddbe6470ba65ef97a6bd9be0acfd3295ea15e9d63ca2c95d3a08dd47e67a0c3cf0afccf849bfd0d2321a0444e837fed3311e')
package() { package() {
cd "${srcdir}/${pkgname}"
install -Dm755 "drivetemp.py" "${pkgdir}/usr/bin/drivetemp" install -Dm755 "drivetemp.py" "${pkgdir}/usr/bin/drivetemp"
install -Dm755 "fqo.sh" "${pkgdir}/usr/bin/fqo" install -Dm755 "fqo.sh" "${pkgdir}/usr/bin/fqo"
install -Dm755 "gek.sh" "${pkgdir}/usr/bin/gek" install -Dm755 "gek.sh" "${pkgdir}/usr/bin/gek"

37
audiotrim.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/env bash
# Trim an audio file given a startpoint and an endpoint
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
readonly infile=${1}
readonly starttime=${2}
readonly stoptime=${3}
readonly outfile=${4}
printHelp() {
cat << EOF
Usage: audiotrim [input file] [start time] [stop time] [output file]
Options:
-h show this help page
EOF
}
while getopts ":h" opt; do
case "${opt}" in
h)
printHelp
;;
esac
ffmpeg -i "${infile}" -ss "${starttime}" -to "${stoptime}" -c copy "${outfile}"

107
dlaudio.sh Executable file
View File

@ -0,0 +1,107 @@
#!/usr/bin/env bash
# Download audio using youtube-dl, passing
# a specific set of options specified by the user
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
printHelp() {
cat << EOF
Usage: dlaudio [options] [URLs]
Options:
-b, --batch-dl provide the links from a text file
-f, --format the format to use (default: flac)"
-h, --help print this help page
-n, --filename the name of the downloaded file (without the extension)
EOF
}
TEMP=$(getopt -o "b:f:hn:::" --long "batch-dl:,filename:,format:,help::" -n "dlaudio" -- "${@}")
declare -a opts
eval set -- "${TEMP}"
unset TEMP
while true; do
case "${1}" in
"-b"|"--batch-dl")
case "${2}" in
"")
batchfile="${2}"
;;
*)
echo "No batch file entered" >&2
exit 1
esac
shift 2
continue
;;
"-f"|"--format")
case "${2}" in
"")
echo "No format entered" >&2
exit 1
;;
*)
format="${2}"
;;
esac
shift 2
continue
;;
"-h"|"--help")
# print help page and exit
printHelp
exit
;;
"-n"|"--filename")
case "${2}" in
"")
echo "No filename entered" >&2
exit 1
;;
*)
filename="${2}"
;;
esac
shift 2
continue
;;
"--")
shift
break
;;
esac
done
[[ -z "${*}" ]] && echo "No input given" >&2 && exit 1
# default options
opts+=("--no-part")
opts+=("--no-continue")
opts+=("--extract-audio")
opts+=("--audio-format=${format:-flac}")
# set filename to either what the user set or its original title
if [[ -n "${filename}" ]]; then
opts+=("--output=${HOME}/Music/${filename}.%(ext)s")
else
opts+=("--output=${HOME}/Music/%(title)s.%(ext)s")
fi
if [[ -n "${batchfile}" ]]; then
youtube-dl "${opts[@]}" --batch-file="${batchfile}"
else
youtube-dl "${opts[@]}" "${@}"
fi

12
fqo.sh
View File

@ -1,4 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Fuzzy find a file and then check which package owns it # Fuzzy find a file and then check which package owns it
printHelp() {
cat << EOF
fqo - fuzzy find a file and then check which package owns it
Usage: fqo [patterns]
Options:
-h show this help page
EOF
}
[[ -z "${*}" ]] && echo "No patterns specified" && exit 1
locate --all --ignore-case --null -- "${@}" | fzf --read0 --exit-0 --select-1 | pacman -Qo - locate --all --ignore-case --null -- "${@}" | fzf --read0 --exit-0 --select-1 | pacman -Qo -