Initial
This commit is contained in:
commit
20f97b8e6c
|
@ -0,0 +1,17 @@
|
|||
# SCRIPTS
|
||||
|
||||
A Collection of some "useful" scripts
|
||||
|
||||
| Name | Usecase |requirements|
|
||||
|------|---------|------------|
|
||||
|```downloadhelper.sh``` | download anc convert Youtube Videos or Soundcloud Songs | Youtube-DL & ffmpeg
|
||||
|```fixcam.sh``` |remove " (1)" from all files inside a folder| |
|
||||
|```kvm.sh``` |start a kvm| kvm |
|
||||
|```load.sh``` |download a bunch of sequentialy numbered files| wget |
|
||||
|```m3u8append.sh``` | takes a m3u8 playlist, removes comments (lines starting with '#') and addes a line in front of every other line. Saves the output to a difrent file. | |
|
||||
|```secondcount.sh``` | count the total time of video material in seconds in a folder | ffmpeg |
|
||||
|``` switch-speaker.sh```| switch the default audio output to a difrent speaker | pulseaudio |
|
||||
|```timedbackup.sh``` | creates a backup. This simple script should be used with cron | rsync |
|
||||
|```videoappend.sh``` | concatinats a list of videos to one long video | ffmpeg |
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
echo "enter the dldir to download - dont forget trailing '/'!, leave empty for default."
|
||||
read out
|
||||
dldir="/home/${USER}/Downloads/"
|
||||
if [ "$out" != "" ]; then
|
||||
dldir=$(out)
|
||||
fi
|
||||
#todo: check that dldir ends with /
|
||||
|
||||
echo "Downloading to: ${dldir}"
|
||||
mkdir -p ${dldir}
|
||||
while : ; do
|
||||
read -p "enter ytid or link, noting to exit: " ytid
|
||||
if [ "${ytid}" == "" ]; then
|
||||
break
|
||||
fi
|
||||
youtube-dl -F ${ytid}
|
||||
echo "please chose format: (by number or mp3/mp4/aac/...)"
|
||||
read form
|
||||
youtube-dl --restrict-filenames -o "${dldir}%(title)s.%(ext)s" -f ${form} --exec 'touch {}' ${ytid}
|
||||
file="$(ls /home/yannis/Downloads/ -ot | sed -n 2p | perl -lane 'print $F[7]')"
|
||||
echo "DOWNLOADED FILE: $file"
|
||||
#todo check if its already mp3
|
||||
read -p "convert to other format? (mp3/mp4/...): " mp
|
||||
if [ "${mp}" != "" ]; then
|
||||
ffmpeg -hide_banner -i "${dldir}${file}" "${dldir}${file%%.*}.${mp}"
|
||||
|
||||
#delete original?
|
||||
rm -i ${dldir}${file}
|
||||
fi
|
||||
done
|
||||
echo "exit."
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
remove=" (1)"
|
||||
doneanything=false
|
||||
for file in fixcam/*; do
|
||||
to="${file/$remove}"
|
||||
if [ "$to" == "$file" ]; then
|
||||
echo "skip file $file"
|
||||
else
|
||||
echo "rename file $file to $to"
|
||||
mv "$file" "$to"
|
||||
doneanything=true
|
||||
fi
|
||||
done
|
||||
if [ $doneanything = false ]; then
|
||||
echo "noting done"
|
||||
fi
|
|
@ -0,0 +1 @@
|
|||
sudo kvm -hda /dev/sda -hdb /dev/sdb -hdc /dev/sdc -hdd /dev/sdd -m 10G -cpu host -smp cpus=1,cores=4,threads=1,maxcpus=4 -k de -soundhw all #-device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
#create dir
|
||||
mkdir dl
|
||||
cd dl
|
||||
#url to download from
|
||||
BASEURL=""
|
||||
#part behind the nummber
|
||||
POSTFIX=".jpg"
|
||||
#start id
|
||||
i=1
|
||||
#endid
|
||||
end=1000
|
||||
while [ $i -lt $end ]; do
|
||||
wget "${BASEURL}${i}${POSTFIX}" -O "${i}${POSTFIX}"
|
||||
let i=i+1
|
||||
done
|
||||
|
||||
#delete small files (404-errors)
|
||||
#find . -size -1k -delete
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
#appends the url in an m3u8 file
|
||||
echo "USAGE: m3u8dl.sh URL FOLDER NAME NEWNAME"
|
||||
|
||||
url=""
|
||||
name=""
|
||||
folder="/tmp/mozilla_yannis0/"
|
||||
out="new.m3u8"
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
url=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
folder=$2
|
||||
if [ $# -gt 2 ]; then
|
||||
name=$3
|
||||
if [ $# -gt 3 ]; then
|
||||
out=$4
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "reading: $name"
|
||||
echo "in folder $folder"
|
||||
echo "writing in $out"
|
||||
echo "appending $url"
|
||||
|
||||
while read -r line
|
||||
do
|
||||
if [[ "$line" == "#"* ]];then
|
||||
echo "$line" >> $folder$out
|
||||
else
|
||||
echo "$url$line" >> $folder$out
|
||||
fi
|
||||
done < "$folder$name"
|
||||
echo "done"
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
echo "usage: script.sh folder_without_slash file_extention"
|
||||
count=0
|
||||
cd $1
|
||||
for file in *.$2 ; do
|
||||
#echo $file
|
||||
add=$( ffmpeg -i "$file" 2>&1 | grep "Duration" | cut -d ' ' -f 4 | sed s/,// | sed 's@\..*@@g' | awk '{ split($1, A, ":"); split(A[3], B, "."); print 3600*A[1] + 60*A[2] + B[1] }')
|
||||
# echo "length $add"
|
||||
count=$(($count + $add))
|
||||
done
|
||||
echo "total: $count s"
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
pacmd set-default-sink $1
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
folder="/home/yannis/Dokumente"
|
||||
backup="/home/yannis/backups/docs/"
|
||||
mkdir -p ${backup}
|
||||
name=`date +%F_%H_%M`
|
||||
echo $name
|
||||
rsync -rvhP ${folder} ${backup}$name/
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
folderout="/tmp/render/"
|
||||
folderin="videos/"
|
||||
fileout="out.mp4"
|
||||
|
||||
#mkdir
|
||||
mkdir -p $folderout
|
||||
#deletes this file - if exists
|
||||
rm -f "${folderout}list.txt"
|
||||
|
||||
echo "generate listfile"
|
||||
list=$(ls --color=never -tr "$folderin" )
|
||||
for file in $list; do
|
||||
echo "file '$folderin$file'" >> "${folderout}list.txt"
|
||||
done
|
||||
|
||||
#if the user wants to correct somethink in the file
|
||||
echo "wait for acc"
|
||||
read ignored
|
||||
|
||||
echo "RENDER!"
|
||||
ffmpeg -hide_banner -threads 0 -f concat -safe 0 -i "${folderout}list.txt" -c copy "$folderout$fileout"
|
||||
rm "${folderout}list.txt"
|
||||
echo "done."
|
Loading…
Reference in New Issue