Новый скрипт playlists, который выкачивает ini
- playlists вызывается в download-all - download-all теперь вызывается в начале find-in-all и make-pls - мелочи по скриптам в целом
This commit is contained in:
parent
2ec6b582c4
commit
c3163d683d
@ -3,6 +3,7 @@
|
||||
Проект, содержащий в себе скрипты для работы с IPTV-плейлистами.
|
||||
|
||||
Для начала работы необходимо скачать файл [playlists.ini](https://git.axenov.dev/IPTV/playlists/raw/branch/master/playlists.ini).
|
||||
Для этого можно запустить `./playlists.sh`.
|
||||
|
||||
- [Инструменты для работы с IPTV-плейлистами](#инструменты-для-работы-с-iptv-плейлистами)
|
||||
- [Скачать все плейлисты](#скачать-все-плейлисты)
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
#################################################
|
||||
#
|
||||
# IPTV Playlist check tool
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
#################################################
|
||||
#
|
||||
# IPTV Playlist download tool
|
||||
@ -15,17 +14,18 @@
|
||||
# https://git.axenov.dev/IPTV/tools/src/branch/master/LICENSE
|
||||
#
|
||||
#################################################
|
||||
# shellcheck disable=SC2002
|
||||
|
||||
./playlists.sh
|
||||
|
||||
TOOLS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
||||
DL_DIR="$TOOLS_DIR/downloaded"
|
||||
INI_FILE="$(dirname "$TOOLS_DIR")/playlists.ini"
|
||||
INI_FILE="$TOOLS_DIR/playlists.ini"
|
||||
|
||||
rm -rf "$DL_DIR" && \
|
||||
mkdir -p "$DL_DIR" && \
|
||||
cd "$DL_DIR" && \
|
||||
cat "$INI_FILE" \
|
||||
| grep -P "pls\s*=\s*'(.*)'" \
|
||||
| sed "s#^pls\s*=\s*##g" \
|
||||
| sed "s#'##g" \
|
||||
grep -oP "(?<=pls=)(.*)" "$INI_FILE" \
|
||||
| tr -d "'" \
|
||||
| tr -d '\r' \
|
||||
| xargs wget
|
||||
|
@ -1,11 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
#################################################
|
||||
#
|
||||
# IPTV channel finder (all playlists)
|
||||
#
|
||||
# Usage:
|
||||
# ./download-all.sh
|
||||
# ./find-in-all.sh "(disney|atv)"
|
||||
#
|
||||
# 1st argument is channel name pattern.
|
||||
@ -16,7 +14,10 @@
|
||||
#
|
||||
#################################################
|
||||
|
||||
|
||||
TOOLS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
||||
$TOOLS_DIR/download-all.sh
|
||||
|
||||
DL_DIR="$TOOLS_DIR/downloaded"
|
||||
[ ! -d "$DL_DIR" ] && echo "Error: '$DL_DIR' directory does not exist. Run ./download-all.sh" && exit 1
|
||||
[ ! "$(ls -A "$DL_DIR")" ] && echo "Error: '$DL_DIR' directory is empty. Run ./download-all.sh" && exit 2
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
#################################################
|
||||
#
|
||||
# IPTV channel finder (one playlist)
|
||||
|
16
make-pls.sh
16
make-pls.sh
@ -1,11 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
#################################################
|
||||
#
|
||||
# IPTV channel maker (all playlists)
|
||||
# IPTV playlist maker (all playlists)
|
||||
#
|
||||
# Usage:
|
||||
# ./download-all.sh
|
||||
# ./make-pls.sh "disney"
|
||||
#
|
||||
# 1st argument is channel name pattern.
|
||||
@ -18,14 +16,12 @@
|
||||
# https://git.axenov.dev/IPTV/tools/src/branch/master/LICENSE
|
||||
#
|
||||
#################################################
|
||||
# shellcheck disable=SC2086
|
||||
|
||||
TOOLS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
||||
DL_DIR="$TOOLS_DIR/downloaded"
|
||||
[ ! -d "$DL_DIR" ] && echo "Error: '$DL_DIR' directory does not exist. Run ./download-all.sh" && exit 1
|
||||
[ ! "$(ls -A "$DL_DIR")" ] && echo "Error: '$DL_DIR' directory is empty. Run ./download-all.sh" && exit 2
|
||||
$TOOLS_DIR/download-all.sh
|
||||
|
||||
channel="$1"
|
||||
playlist="$2"
|
||||
|
||||
regex_ch="^#extinf:\s*-?[01]\s*.*,(.*${channel,,}.*)"
|
||||
regex_url="^https?:\/\/.*$"
|
||||
@ -34,12 +30,12 @@ found_count=0
|
||||
found_last=0
|
||||
|
||||
echo "#EXTM3U"
|
||||
echo "# Autogenerated at `date +%d.%m.%Y`"
|
||||
echo "# Autogenerated at $(date '+%d.%m.%Y')"
|
||||
echo "# https://git.axenov.dev/IPTV/tools"
|
||||
echo
|
||||
|
||||
for file in ./downloaded/*; do
|
||||
while read line; do
|
||||
while read -r line; do
|
||||
if [[ "${line,,}" =~ $regex_ch ]]; then
|
||||
echo -e "$line"
|
||||
((found_count += 1))
|
||||
@ -51,5 +47,5 @@ for file in ./downloaded/*; do
|
||||
found_last=0
|
||||
fi
|
||||
fi
|
||||
done < $file
|
||||
done < "$file"
|
||||
done
|
||||
|
20
playlists.sh
Executable file
20
playlists.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
#################################################
|
||||
#
|
||||
# IPTV playlists.ini download tool
|
||||
#
|
||||
# Usage:
|
||||
# ./playlists.sh
|
||||
#
|
||||
# Remote playlists.ini will be downloaded in this directory
|
||||
# More info: https://git.axenov.dev/IPTV/playlists
|
||||
#
|
||||
# Anthony Axenov (c) 2022
|
||||
# The MIT License:
|
||||
# https://git.axenov.dev/IPTV/tools/src/branch/master/LICENSE
|
||||
#
|
||||
#################################################
|
||||
|
||||
TOOLS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
||||
INI_FILE="$TOOLS_DIR/playlists.ini"
|
||||
wget "https://git.axenov.dev/IPTV/playlists/raw/branch/master/playlists.ini" -O "$INI_FILE"
|
Reference in New Issue
Block a user