m3u-radio-music-playlists/stuff/everything-factory.sh

32 lines
1.2 KiB
Bash
Raw Normal View History

2023-04-17 01:10:05 +00:00
#!/bin/bash
# cd in to the folder, duh
# remove old cruddy everything files
2023-04-17 15:56:37 +00:00
rm everything-full.m3u everything-lite.m3u randomized.m3u sorted.m3u
2023-04-17 01:10:05 +00:00
# insert filenames as playlist title and put them in a big file with duplicates
for i in $(ls -v) ; do echo '#PLAYLIST: '$i | cat - $i | sed 's/#EXTM3U//g' | awk NF >> everything-full.txt ; done
# add #EXTM3U to the first line and change the text file to a m3u file format
2023-08-28 14:49:30 +00:00
#cat everything-full.txt | awk '!seen[$0]++' | grep -B1 "http" | grep -A1 "EXTINF" | awk 'length>4' | sed '1s/^/#EXTM3U\n/' > everything-full.m3u
cat everything-full.txt | awk '!seen[$0]++' | sed '1s/^/#EXTM3U\n/' > everything-full.m3u
2023-04-17 01:10:05 +00:00
# read the full file and remove all extra stuff, we just need the links
2023-04-17 15:56:37 +00:00
cat everything-full.m3u | sed -n '/^#/!p' > everything-lite.m3u
2023-04-17 01:10:05 +00:00
# shuffle the lite file
2023-04-17 15:56:37 +00:00
cat everything-lite.m3u | shuf > randomized.m3u
2023-04-17 01:10:05 +00:00
# sort the lite file
2023-04-17 15:56:37 +00:00
cat everything-lite.m3u | sort > sorted.m3u
2023-05-10 13:02:08 +00:00
# for everything-repo streams
# copy all of the everything-full files to a folder and change their names to avoid substitution
for i in *.m3u ; do cat $i >> every.txt ; done
# remove duplicates
cat every.txt | awk '!seen[$0]++' > every.m3u
# remove stream info
cat every.m3u | sed -n '/^#/!p' | sort > lite.m3u