-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ready for another rewrite [v2.0] #39
Comments
Hey @odnar-dev I do think that we could have a rewrite of termv, development has slowed down very much due it not being exiting anymore. I'll take a look into this issue and post my thoughts here when I get time |
I've looked into the issue and yeah, making a new format for termv looks promising. A tab seperated .termv file would be best i think instead of using json. |
hi @Roshan-R , looks like i forget about this 😄 |
Yes, I'd love to do that @odnar-dev, I'll be looking into this and will be sharing my progress |
so here is the m3u8 parser i told u about, you give it a m3u8 file #!/usr/bin/env bash
# m3u8 related
parse_playlist_m3u8(){
local filepath="$@"
IFS= read -r first_line < "${filepath:?}"
case "${first_line}" in
"#EXTM3U"*) printf '%s' "(valide)";;
*) { prnt_err "${filepath:?} don't have a valide m3u8 header" ; return 1 ;};;
esac
while read -r line; do
case "$line" in
"#EXTINF"*)
declare -A metadata=( )
metadata[tv-name]="${line##*,}"
metadata[tv-name]="${metadata[tv-name]%%[[:cntrl:]]}"
metadata[tv-name]="$(echo ${metadata[tv-name]} | tr -d '\r')"
local other_metadata="${line%%,*}"
local other_metadata="${other_metadata#* }"
while IFS="=" read -r key val; do
[ "${key##\#*}" ] || continue
metadata[${key}]="${val//\"}"
done < <(printf '%s\n' ${other_metadata:-} )
;;
"#EXTVLCOPT"*|"#KODIPROP"*|"# ")
;;
*)
[ -z "${metadata[tv-name]}" ] && continue
[ -z "${line}" ] && continue
#[ -z "${metadata[tv-glanguage]}" ] && metadata[tv-glanguage]="${metadata[tvg-language]}"
#[ -z "${metadata[tv-gcountry]}" ] && metadata[tv-gcountry]="${metadata[tvg-country]}"
printf '%s \t %s \t %s \t %s \t %s\n' "${metadata[tv-name]:?}" "${metadata[group-title]:-N/A}" "${metadata[tv-glanguage]:-N/A}" "${metadata[tv-gcountry]:-N/A}" "${line:?}"
declare -A metadata=( )
;;
esac
done < "$filepath"
}
parse_playlist_m3u8 "${@:?}" |
check out the repo https://github.com/odnar-dev/termv-rewrite git clone --depth 1 https://github.com/odnar-dev/termv-rewrite
cd ./termv-rewrite
chmod +x ./termv
./termv |
I'm taking a look into the code and it seems to be a big change with what we have so far, I'll review and put my thoughts here once I go through it |
I'm pretty sure we could use awk to parse the m3u8 files, I've been working on that. Couple of things to note
|
i just wanted to try to create a pure bash m3u8 , just to see if it would work 😄
|
As you said, I feel it would be better if we keep the existing iptv-org json format and then allow users to create .termv files on top of the data source. Most users would be satisfied by just the channels in the iptv-org json About same channel with different links, I feel we should keep both but find a way to differentiate the two in the fzf dialog. something to think about I'm very much liking the new direction you are proposing for termv. |
Hopefully supporting personal playlists gets implemented in your rewrite @Roshan-R. I'd be very interested and I think it would make this more widely used. |
hi @Roshan-R ,
i think we can't add new features to
termv
in it current form, without a whole rewrite.for now,
termv
act as a terminal client for iptv-org channels, i think the first step is to maketermv
independent from iptv-org and that by introducing our own format for files.for this we can use json file or a simple text file with
.termv
extensionand store data in it like this:
name \t category \t language \t countries \t channelsUrl
with this, we can add the support of multiple sources with different formats, cause we can download the file process it and convert it into our own format. and also the user can create his own channels list easily by creating a file with
.termv
extension.the source list can be loaded form config file with this parameters : source_name, source_url and source_type
we will use the source_url to download file from , use source_name as file_name, then call process function based on source_type.
i created a m3u8 parser using only bash functions, but it slow in large files.
The text was updated successfully, but these errors were encountered: