Skip to content

Commit

Permalink
Support skip connection check. Fix #15. (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancYescO authored Feb 21, 2022
1 parent 94ab7b7 commit 1bbead8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
7 changes: 7 additions & 0 deletions docs/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,10 @@ setting it will convert all the urls automatically.
For examples, with UDPXY ``http://192.168.0.1:8888/``,
``rtp://123.45.67.89:1234`` will be converted to
``http://192.168.0.1:8888/rtp/123.45.67.89:1234``.

SKIP_CONNECTIVITY_CHECK
-----

Skip any connectivity check (to be used to just apply title and id unifiers)
use in combination with `-I 0`

3 changes: 3 additions & 0 deletions iptvtools/constants/helps.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@
UDPXY = (
'UDP Proxy for certain IPTV channels.'
)
SKIP_CONNECTIVITY_CHECK = (
'Skip connectivity check.'
)
2 changes: 2 additions & 0 deletions iptvtools/iptv_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def parse_args():
type=int, help=helps.INTERVAL)
parser.add_argument('-L', '--log-level', default=defaults.LOG_LEVEL,
help=helps.LOG_LEVEL)
parser.add_argument('-n', '--skip-connectivity-check', action='store_true',
help=helps.SKIP_CONNECTIVITY_CHECK)
parser.add_argument('-o', '--output', default=defaults.OUTPUT,
help=helps.OUTPUT)
parser.add_argument('-r', '--replace-group-by-source', action='store_true',
Expand Down
10 changes: 6 additions & 4 deletions iptvtools/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,22 @@ def filter(self):
random.shuffle(urls)
pbar = tqdm(urls, ascii=True)
for url in pbar:
time.sleep(self.args.interval)
status = 'OK'
if self.args.min_height or self.args.resolution_on_title:
time.sleep(self.args.interval)
if self.args.skip_connectivity_check:
status = 'Skipped'
elif self.args.min_height or self.args.resolution_on_title:
height = utils.check_stream(url, self.args.timeout)
if height == 0:
self.inaccessible_urls.add(url)
status = 'Inaccessible'
status = 'Inaccessible (0 height)'
elif height < self.args.min_height:
self.poor_urls.add(url)
status = 'Poor Resolution'
self.data[url]['height'] = height
elif not utils.check_connectivity(url, self.args.timeout):
self.inaccessible_urls.add(url)
status = 'Inaccessible'
status = 'Inaccessible (No connectivity)'
pbar.write(f'{url}, {status}!')

def __custom_sort(self, url):
Expand Down

0 comments on commit 1bbead8

Please sign in to comment.