Compare commits
6 Commits
4c18167d4a
...
eeb31f79d7
Author | SHA1 | Date |
---|---|---|
Anthony Axenov | eeb31f79d7 | |
Anthony Axenov | 6e0e9fa04a | |
Anthony Axenov | cfda93e022 | |
Anthony Axenov | 1a6e763350 | |
Anthony Axenov | e4b5aff941 | |
Anthony Axenov | 944fbdcfce |
|
@ -1,6 +1,6 @@
|
|||
/.idea
|
||||
/.vscode
|
||||
/downloaded
|
||||
downloaded/
|
||||
/src/commit
|
||||
/src/cache/*
|
||||
/src/vendor
|
||||
|
|
|
@ -24,10 +24,10 @@ class Playlist extends BasicPlaylist
|
|||
empty($params['pls']) && throw new \Exception(
|
||||
"Плейлист с ID=$id обязан иметь параметр pls или redirect"
|
||||
);
|
||||
$this->url = str_replace(['http://', 'https://'], '', base_url($id));
|
||||
$this->url = base_url($id);
|
||||
$this->name = empty($params['name']) ? "Плейлист #$id" : $params['name'];
|
||||
$this->desc = empty($params['desc']) ? null : $params['desc'];
|
||||
$this->pls = empty($params['pls']) ? null : $params['pls'];
|
||||
$this->pls = $params['pls'];
|
||||
$this->src = empty($params['src']) ? null : $params['src'];
|
||||
}
|
||||
|
||||
|
|
|
@ -8,16 +8,16 @@
|
|||
"packages": [
|
||||
{
|
||||
"name": "illuminate/collections",
|
||||
"version": "v9.26.1",
|
||||
"version": "v9.36.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/collections.git",
|
||||
"reference": "3bda212d2c245b3261cd9af690dfd47d9878cebf"
|
||||
"reference": "32e3cd051cf1d12c1e7d5f7bb5a52d0dae8b7a8b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/collections/zipball/3bda212d2c245b3261cd9af690dfd47d9878cebf",
|
||||
"reference": "3bda212d2c245b3261cd9af690dfd47d9878cebf",
|
||||
"url": "https://api.github.com/repos/illuminate/collections/zipball/32e3cd051cf1d12c1e7d5f7bb5a52d0dae8b7a8b",
|
||||
"reference": "32e3cd051cf1d12c1e7d5f7bb5a52d0dae8b7a8b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -59,11 +59,11 @@
|
|||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2022-08-22T14:29:59+00:00"
|
||||
"time": "2022-10-06T14:13:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/conditionable",
|
||||
"version": "v9.26.1",
|
||||
"version": "v9.36.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/conditionable.git",
|
||||
|
@ -109,16 +109,16 @@
|
|||
},
|
||||
{
|
||||
"name": "illuminate/contracts",
|
||||
"version": "v9.26.1",
|
||||
"version": "v9.36.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/contracts.git",
|
||||
"reference": "0d1dd1a7e947072319f2e641cc50081219606502"
|
||||
"reference": "d57130115694b4f6a98d064bea31cdb09d7784f8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/contracts/zipball/0d1dd1a7e947072319f2e641cc50081219606502",
|
||||
"reference": "0d1dd1a7e947072319f2e641cc50081219606502",
|
||||
"url": "https://api.github.com/repos/illuminate/contracts/zipball/d57130115694b4f6a98d064bea31cdb09d7784f8",
|
||||
"reference": "d57130115694b4f6a98d064bea31cdb09d7784f8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -153,11 +153,11 @@
|
|||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2022-08-18T14:18:13+00:00"
|
||||
"time": "2022-09-15T13:31:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/macroable",
|
||||
"version": "v9.26.1",
|
||||
"version": "v9.36.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/macroable.git",
|
||||
|
@ -593,16 +593,16 @@
|
|||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v3.4.2",
|
||||
"version": "v3.4.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig.git",
|
||||
"reference": "e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077"
|
||||
"reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077",
|
||||
"reference": "e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/c38fd6b0b7f370c198db91ffd02e23b517426b58",
|
||||
"reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -653,7 +653,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/twigphp/Twig/issues",
|
||||
"source": "https://github.com/twigphp/Twig/tree/v3.4.2"
|
||||
"source": "https://github.com/twigphp/Twig/tree/v3.4.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -665,7 +665,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-08-12T06:47:24+00:00"
|
||||
"time": "2022-09-28T08:42:51+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
|
|
|
@ -39,10 +39,9 @@ awk '
|
|||
ARGV[1] = "/tmp/" file_name
|
||||
}
|
||||
print ""
|
||||
print "\033[20m\033[97mNote 1:\033[0m operation may take some time."
|
||||
print "\033[20m\033[97mNote 2:\033[0m press CTRL+C to skip current channel or CTRL+Z to kill process."
|
||||
print "\033[20m\033[97mNote 3:\033[0m results may be inaccurate, you should use proper IPTV software to re-check."
|
||||
print "\033[20m\033[97mNote 4:\033[0m error codes listed here - https://everything.curl.dev/usingcurl/returns"
|
||||
print "\033[20m\033[97mNote 1:\033[0m operation may take some time, press CTRL+C to stop."
|
||||
print "\033[20m\033[97mNote 2:\033[0m results may be inaccurate, you should use proper IPTV software to re-check."
|
||||
print "\033[20m\033[97mNote 3:\033[0m error codes listed here - https://everything.curl.dev/usingcurl/returns"
|
||||
print "--------------------"
|
||||
}
|
||||
{
|
||||
|
|
|
@ -16,7 +16,16 @@
|
|||
#
|
||||
#################################################
|
||||
|
||||
rm -rf ./downloaded
|
||||
mkdir -p ./downloaded && \
|
||||
cd ./downloaded && \
|
||||
grep -P "pls='(.*)'" ../playlists.ini | sed "s/^pls=//g" | sed "s/'//g" | tr -d '\r' | xargs wget
|
||||
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"
|
||||
|
||||
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" \
|
||||
| tr -d '\r' \
|
||||
| xargs wget
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
#
|
||||
#################################################
|
||||
|
||||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
||||
[ ! -d ./downloaded ] && echo "Error: ./downloaded directory does not exist. Run $SCRIPT_DIR/tools/download-all.sh" && exit 1
|
||||
[ ! "$(ls -A ./downloaded)" ] && echo "Error: ./downloaded directory is empty. Run $SCRIPT_DIR/tools/download-all.sh" && exit 2
|
||||
for file in ./downloaded/*; do
|
||||
"$SCRIPT_DIR"/find-in-pls.sh "$1" "$file"
|
||||
TOOLS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
||||
DL_DIR="$TOOLS_DIR/downloaded"
|
||||
[ ! -d "$DL_DIR" ] && echo "Error: 'tools/downloaded' directory does not exist. Run tools/download-all.sh" && exit 1
|
||||
[ ! "$(ls -A "$DL_DIR")" ] && echo "Error: 'tools/downloaded' directory is empty. Run tools/download-all.sh" && exit 2
|
||||
for file in $TOOLS_DIR/downloaded/*; do
|
||||
$TOOLS_DIR/find-in-pls.sh "$1" "$file"
|
||||
done
|
||||
|
|
|
@ -22,59 +22,63 @@
|
|||
#
|
||||
#################################################
|
||||
|
||||
awk '
|
||||
BEGIN {
|
||||
IGNORECASE=1
|
||||
channel = ARGV[1]
|
||||
playlist = ARGV[2]
|
||||
found_count = 0
|
||||
found_last = 0
|
||||
regex_ch = tolower(sprintf("^#EXTINF:.+,\s*(.*%s.*)", channel))
|
||||
regex_url = "^https?:\/\/.*$"
|
||||
channel="$1"
|
||||
playlist="$2"
|
||||
playlist_url="$playlist"
|
||||
regex_ch="^#extinf:\s*-?[01]\s*.*,(.*${channel,,}.*)"
|
||||
regex_url="^https?:\/\/.*$"
|
||||
|
||||
print "--------------------"
|
||||
print "\033[20m\033[97mPlaylist:\033[0m " playlist
|
||||
print "\033[20m\033[97mChannel to find:\033[0m " channel
|
||||
is_downloaded=0
|
||||
download_dir="/tmp/$(date '+%s%N')"
|
||||
|
||||
if (playlist ~ /^http(s)?:\/\/.*/) {
|
||||
parts_count = split(playlist, parts, "/")
|
||||
file_name = parts[parts_count]
|
||||
code = system("wget " playlist " -qO /tmp/" file_name " > /dev/null")
|
||||
if (code == 0) {
|
||||
print "Saved in /tmp/" file_name
|
||||
} else {
|
||||
print "ERROR: cannot download playlist: " playlist
|
||||
exit 1
|
||||
}
|
||||
playlist = "/tmp/" file_name
|
||||
}
|
||||
found_count=0
|
||||
found_last=0
|
||||
line_count=1
|
||||
|
||||
ARGV[1] = playlist
|
||||
delete ARGV[2]
|
||||
print "--------------------"
|
||||
}
|
||||
{
|
||||
sub("\r$", "", $0) # crlf -> lf
|
||||
if (tolower($0) ~ tolower(regex_ch)) {
|
||||
found_count++
|
||||
print "\n\033[32m" FNR " FOUND:\033[0m\t" $0
|
||||
found_last = FNR
|
||||
}
|
||||
if (found_last > 0) {
|
||||
if (tolower($0) ~ tolower(regex_url)) {
|
||||
print "\t\t" $0
|
||||
found_last = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
END {
|
||||
if (found_count == 0) {
|
||||
print "\033[91mNothing found\033[0m"
|
||||
} else {
|
||||
print "--------------------"
|
||||
print "\033[20m\033[97mPlaylist:\033[0m " playlist
|
||||
print "\033[20m\033[97mChannel found:\033[0m " channel
|
||||
print "\033[20m\033[97mFound:\033[0m\033[32m " found_count "\033[0m"
|
||||
}
|
||||
}
|
||||
' $1 $2
|
||||
if [[ "$playlist" =~ $regex_url ]]; then
|
||||
mkdir -p "$download_dir"
|
||||
cd "$download_dir"
|
||||
wget "$playlist" -q > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
is_downloaded=1
|
||||
playlist="$download_dir/$(ls -1 "$download_dir")"
|
||||
cd -
|
||||
else
|
||||
echo "ERROR: cannot download playlist: $playlist"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "--------------------"
|
||||
echo -e "\033[20m\033[97mChannel:\033[0m $channel"
|
||||
echo -e "\033[20m\033[97mPlaylist:\033[0m $playlist_url"
|
||||
echo -e "\033[20m\033[97mRegex:\033[0m $regex_ch"
|
||||
echo "--------------------"
|
||||
|
||||
while read line; do
|
||||
if [[ "${line,,}" =~ $regex_ch ]]; then
|
||||
echo -e "\n\033[32m$line_count FOUND:\033[0m\t$line"
|
||||
((found_count += 1))
|
||||
found_last=$found_count
|
||||
fi
|
||||
if [ $found_last -gt 0 ]; then
|
||||
if [[ "${line,,}" =~ $regex_url ]]; then
|
||||
echo -e "\t\t$line"
|
||||
found_last=0
|
||||
fi
|
||||
fi
|
||||
((line_count += 1))
|
||||
done < $playlist
|
||||
|
||||
if [ $found_count -eq 0 ]; then
|
||||
echo -e "\033[91mNothing found\033[0m"
|
||||
else
|
||||
echo "--------------------"
|
||||
echo -e "\033[20m\033[97mPlaylist:\033[0m $playlist_url"
|
||||
echo -e "\033[20m\033[97mChannel:\033[0m $channel"
|
||||
echo -e "\033[20m\033[97mFound:\033[0m\033[32m $found_count\033[0m"
|
||||
fi
|
||||
|
||||
if [ $is_downloaded -eq 1 ]; then
|
||||
rm -rf "$download_dir"
|
||||
fi
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#!/bin/bash
|
||||
|
||||
#################################################
|
||||
|
@ -20,41 +19,37 @@
|
|||
#
|
||||
#################################################
|
||||
|
||||
#SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
|
||||
[ ! -d ./downloaded ] && echo "Error: ./downloaded directory does not exist. Run $SCRIPT_DIR/tools/download-all.sh" && exit 1
|
||||
[ ! "$(ls -A ./downloaded)" ] && echo "Error: ./downloaded directory is empty. Run $SCRIPT_DIR/tools/download-all.sh" && exit 2
|
||||
TOOLS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
||||
DL_DIR="$TOOLS_DIR/downloaded"
|
||||
[ ! -d "$DL_DIR" ] && echo "Error: 'tools/downloaded' directory does not exist. Run tools/download-all.sh" && exit 1
|
||||
[ ! "$(ls -A "$DL_DIR")" ] && echo "Error: 'tools/downloaded' directory is empty. Run tools/download-all.sh" && exit 2
|
||||
|
||||
channel="$1"
|
||||
playlist="$2"
|
||||
|
||||
regex_ch="^#extinf:\s*-?[01]\s*.*,(.*${channel,,}.*)"
|
||||
regex_url="^https?:\/\/.*$"
|
||||
|
||||
found_count=0
|
||||
found_last=0
|
||||
|
||||
echo "#EXTM3U"
|
||||
echo "# Autogenerated at `date +%d.%m.%Y`"
|
||||
echo "# https://github.com/anthonyaxenov/iptv"
|
||||
echo
|
||||
|
||||
for file in ./downloaded/*; do
|
||||
awk '
|
||||
BEGIN {
|
||||
IGNORECASE=1
|
||||
"date +%Y-%m-%d" | getline date
|
||||
channel = ARGV[1]
|
||||
playlist = ARGV[2]
|
||||
ARGV[1] = playlist
|
||||
delete ARGV[2]
|
||||
found_count = 0
|
||||
found_last = 0
|
||||
regex_ch = tolower(sprintf("^#EXTINF:.+,\s*(.*%s.*)", channel))
|
||||
regex_url = "^https?:\/\/.*$"
|
||||
}
|
||||
{
|
||||
sub("\r$", "", $0) # crlf -> lf
|
||||
if (tolower($0) ~ tolower(regex_ch)) {
|
||||
print $0
|
||||
found_count++
|
||||
found_last = FNR
|
||||
}
|
||||
if (found_last > 0) {
|
||||
if (tolower($0) ~ tolower(regex_url)) {
|
||||
print $0 "\n"
|
||||
found_last = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
' "$1" "$file"
|
||||
while read line; do
|
||||
if [[ "${line,,}" =~ $regex_ch ]]; then
|
||||
echo -e "$line"
|
||||
((found_count += 1))
|
||||
found_last=$found_count
|
||||
fi
|
||||
if [ $found_last -gt 0 ]; then
|
||||
if [[ "${line,,}" =~ $regex_url ]]; then
|
||||
echo -e "$line\n"
|
||||
found_last=0
|
||||
fi
|
||||
fi
|
||||
done < $file
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue