mirror of https://github.com/Chizi123/Scripts.git

Joel Grunbaum
2019-08-24 8282502f8f68fa9b5664380c1c1dc4bf8aab6a12
added overviews
2 files modified
13 ■■■■ changed files
pashare.sh 5 ●●●●● patch | view | raw | blame | history
transcode_music.sh 8 ●●●● patch | view | raw | blame | history
pashare.sh
@@ -1,4 +1,9 @@
#!/bin/sh
# Stream pulseaudio to remote sources
# This can be used to stream audio to a phone assuming it has an appropriate app
# I got most of this code from StackOverflow
server_port=8000
ip_address=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
pulse_source=$(pactl list sources short | grep analog-stereo.monitor | awk '{print $2}')
transcode_music.sh
@@ -1,5 +1,9 @@
#!/bin/bash
# Script to transcode music in buld using ffmpeg
bitrate=192000
shopt -s globstar
rm -r trans_music
@@ -10,8 +14,8 @@
for d in **/*.{mp3,flac,mp4,m4a,ogg}; do
    if [ "ffprobe -show_format 2>/dev/null $d | grep bit_rate | cut -d'=' -f2" > 192000 ]; then
        echo in $d
        echo out "trans_music/$(echo ${d%.*} | cut -f2,3,4,5 -d'/').mp3"
        ffmpeg -i "$d" -b:a 192000 "trans_music/$(echo $d | cut -f1 -d'.' | cut -f2,3,4,5 -d'/').mp3"
        echo out "trans_music/$(echo ${d%.*} | cut -f1 -d'/' --complement).mp3"
        ffmpeg -i "$d" -b:a $bitrate "trans_music/$(echo $d | cut -f1 -d'.' | cut -f2,3,4,5 -d'/').mp3"
    else
        cp "$d" "trans_music/$(echo $d | cut -f2,3,4,5 -d'/')"
    fi