Ravas coding goodies
Posted: 09 Dec 2020, 16:36
FWIW I don't understand why you needed the quotes on the my.name or how the next two lines would work with the # sign in front of them.
I not need them for my.name, I altered all info of the script and the output. E.g. there is no such URL like https://what.ever, I even made up the TLD of .ever .
I explained that in a post above.
Code: Select all
wget -c "" -O somename
Code: Select all
guest@porteus:~$ wget -c "" -O somename
http://: Invalid host name.
Code: Select all
#!/bin/sh
#wget -c "" -O "part 1.extension"
echo press enter 1
read
#wget -c "" -O "part 2.extension"
echo press enter 2
read
#wget -c "" -O "part 3.extension"
echo press enter 3
read
echo press enter xx
read
Code: Select all
#!/bin/sh
wget -c "https://what.ever/123/456/789.ext?token=bla&expires=123&id=456" -O "part 1.extension"
echo press enter 1
read
#wget -c "" -O "part 2.extension"
echo press enter 2
read
#wget -c "" -O "part 3.extension"
echo press enter 3
read
echo press enter xx
read
Code: Select all
guest@porteus:/mnt/sdz2/downloads$ ./.wget.sh
Code: Select all
#!/bin/sh
wget -c "https://what.ever/123/456/789.ext?token=bla&expires=123&id=456" -O "part 1.extension"
#echo press enter 1
#read
wget -c "https://what1.ever/123a/456b/789c.ext?token=bla1&expires=123&id=456" -O "part 2.extension"
echo press enter 2
read
#wget -c "" -O "part 3.extension"
echo press enter 3
read
echo press enter xx
read
Code: Select all
#!/bin/sh
wget -c "https://what.ever/123/456/789.ext?token=bla&expires=123&id=456" -O "part 1.extension"
#echo press enter 1
#read
wget -c "https://what1.ever/123a/456b/789c.ext?token=bla1&expires=123&id=456x" -O "part 2.extension"
#echo press enter 2
#read
wget -c "https://what3.ever/123bxxx/456cxxx/789dxxx.ext?token=bla123&expires=123&id=456a" -O "part 3.extension"
#echo press enter 3
#read
echo press enter xx
read
Code: Select all
#wget -c "" -O "part 4.extension"
echo press enter 4
read
#wget -c "" -O "part 5.extension"
echo press enter 5
read
Code: Select all
#echo press enter 3
#read
Code: Select all
echo press enter xx
read
Code: Select all
./.wget.sh: line 37: unexpected EOF while looking for matching `"'
./.wget.sh: line 43: syntax error: unexpected end of file
Rava wrote: ↑12 Jan 2021, 17:19donald, I created this script thinking of you.
Place it in $PATH - but go to your video folder and use a relative path.
E.g. go to /mnt/sda6/video and execute it like so:orCode: Select all
# make-ffplay-script Filme
but not like soCode: Select all
# make-ffplay-script Filme/
and it will create Filme.sh that plays all supported files in alphanumerical sorted way - makes more sense for a series than for diverse collection of movies.Code: Select all
/somewhere/else # make-ffplay-script /mnt/sda6/video/Filme/
Filme/ is meant to be an existing folder in $PWD containing supported files.
It is meant to use relative paths not absolute ones so that any drive with the videos can be played regardless if its mounted as sdb or sdz.
Cave! For now it not sets Filme.sh +x for everyone, but just add this as last linehere the code of make-ffplay-scriptCode: Select all
chmod a+x "$PARAMETER".sh
The unusual high version number explains itself by the fact it had been based on a script creating m3u playlists that had the version of 3.1Code: Select all
#!/bin/sh # V3.2 - $1 is the relative folder with the files, will be stripped of any "/" - e.g. Filme or Filme/ works but not /mnt/sda1/video/Filme nor /mnt/sda1/video/Filme/ # for now supported file endings are # avi flv mp3 mp4 mpg mkv ogv TS ts webm divx VOB vob PARAMETER=$(echo "$1"|sed 's|/||g') if [ -d "$PARAMETER" ]; then echo working on "$PARAMETER"… writing into "$PARAMETER".sh echo '#!/bin/sh' >"$PARAMETER".sh find "$PARAMETER" |grep -E "\.avi$|\.flv$|\.mp[34g]$|\.mkv$|\.ogv$|\.[tT][sS]$|\.webm$|\.divx$|\.[vV][oO][bB]$" |sort | while read line ; do { echo ffplay -autoexit -hide_banner -i \"${line}\" >>"$PARAMETER".sh } ; done else echo Given parameter "$PARAMETER" is not a directory. Abort. exit 1 fi
Rava wrote: ↑14 Jan 2021, 13:03[ q to jump to next file ] - what a surprise, same as with my script.donald wrote: ↑14 Jan 2021, 09:32So if I'm really too lazy to click one after the other I could do something like this:[ q to jump to next file ]Code: Select all
find /mnt/sda4/Professor-T/ -type f -name "*.mp4" | sort | while read f; do ffplay -autoexit -- "$f"; done
Still, my script could be considered having a tiny advantage towards your otherwise neat solution.
Both cannot be easily terminated, [ q ] just quits the current ffplay, and the next is started. When there are dozens video files in one folder, having to wait till next ffplay is open, [ q ] quits current ffplay, wait till next ffplay is open, [ q ] quits … … could easily be annoying.
In my case, you need to(unless you have more scripts doing whatnot all named after your video folders - but why have named these as such ) while in your solution you should look if there is not some background (cron) job using find - you probably do not want to terminate.Code: Select all
killall Professor-T.sh
But aside from the rare need to terminate even the not yet started ffplay's - nice solution.
Maybe could even be made into the file manager association "play all supported media files in folder with ffplay"
but also the diff I wantedOnly in /path/one/rootcopy/usr/local/bin: monitorrotate.LVDS-0.right
Only in /path/one/rootcopy/usr/local/bin: mount-Lsfind
That comparing of directories with info likediff /path/one/rootcopy/usr/local/bin/aliasset /path/two/backup/usr/local/bin/aliasset
2c2
< # aliasset V3.6.37 (2021-01-08)
---
> # aliasset V3.6.36 (2020-12-28)
[…]
When executed without parameter it displays this gem:Rava wrote: ↑22 Dec 2018, 01:55Code: Select all
root@porteus:/# 1024calc 454656 444 KB 444.00 KB root@porteus:/# cat /usr/local/bin/1024calc #!/usr/bin/awk -f BEGIN{ x = ARGV[1] split("B KB MB GB TB PB",type) for(i=5;y < 1;i--) y = x / (2**(10*i)) print y " " type[i+2] printf("%.2f %s\n",y,type[i+2]) }
Code: Select all
guest@porteus:~$ 1024calc
awk: /usr/local/bin/1024calc:8: fatal: division by zero attempted
Code: Select all
guest@porteus:/mnt/sdb2/video$ ls |wc
352 1044 7331
guest@porteus:/mnt/sdb2/video$ ls -a |wc
377 1087 7958
guest@porteus:/mnt/sdb2/video$ ls -d */|wc
179 519 3474
guest@porteus:/mnt/sdb2/video$ ls -da */ .*/|wc
183 523 3503
Code: Select all
#!/bin/sh
function tz () {
echo $(date +%d.%m.%Y\ %H:%M:%S) ____________________________________________________________
}
tz
sensors|tail -n 5|head -n 4
Code: Select all
guest@porteus:~$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +63.0°C (high = +84.0°C, crit = +100.0°C)
Core 1: +55.0°C (high = +84.0°C, crit = +100.0°C)
Core 2: +59.0°C (high = +84.0°C, crit = +100.0°C)
Core 3: +55.0°C (high = +84.0°C, crit = +100.0°C)
Code: Select all
guest@porteus:~$ mysensors.sh
02.10.2021 07:53:57 ____________________________________________________________
Core 0: +58.0°C (high = +84.0°C, crit = +100.0°C)
Core 1: +56.0°C (high = +84.0°C, crit = +100.0°C)
Core 2: +59.0°C (high = +84.0°C, crit = +100.0°C)
Core 3: +56.0°C (high = +84.0°C, crit = +100.0°C)
Code: Select all
#!/bin/sh
logfile=/home/guest/cpu-temp.log
while true
do
echo $(date +%d.%m.%Y\ %H:%M:%S) | tee -a $logfile
echo "$(sensors | grep -i core)" | tee -a $logfile
echo | tee -a $logfile
sleep 5
done
Code: Select all
#!/bin/sh
logfile=/home/guest/cpu-temp.log
while true
do
echo $(date +%d.%m.%Y\ %H:%M:%S) | tee -a $logfile
echo "$(sensors | grep Core)" | tee -a $logfile
echo | tee -a $logfile
sleep 5
done
I have an indexing system that creates a find.gz and ls.gz listing of each partition of each drive. All these sit on an approx 60 MB file that is created as an ext2-filesystem and mounted at each Porteus startup.
Especially since creating a log-entry every 5 seconds makes for a huge log file.