From 99f237518e9f3b387b77e688fd2dc22d8a07e6b4 Mon Sep 17 00:00:00 2001 From: Yuanle Song <sylecn@gmail.com> Date: Wed, 6 Mar 2019 15:59:00 +0800 Subject: [PATCH] moved many log to debug level. --- m3u8downloader/main.py | 14 +++++++------- operational | 19 ++++++++++++++----- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/m3u8downloader/main.py b/m3u8downloader/main.py index 6539949..973480d 100644 --- a/m3u8downloader/main.py +++ b/m3u8downloader/main.py @@ -111,7 +111,7 @@ def drop_http_link_in_m3u8_file(local_m3u8_filename): with open(local_m3u8_filename, 'r') as f: content = f.read() if 'http' not in content: - logger.info("media playlist m3u8 file doesn't contain http link") + logger.debug("media playlist m3u8 file doesn't contain http link") return with open(local_m3u8_filename, 'w') as f: for line in content.split('\n'): @@ -124,19 +124,19 @@ def drop_http_link_in_m3u8_file(local_m3u8_filename): if line.startswith('http'): f.write(http_line_to_relpath_line(line)) f.write('\n') - logger.info("updated media playlist m3u8 file: %s", local_m3u8_filename) + logger.info("http links modified in m3u8 file: %s", local_m3u8_filename) class M3u8Downloader: def __init__(self, url, output_filename, tempdir="."): self.start_url = url - logger.info("output_filename=%s", output_filename) + logger.debug("output_filename=%s", output_filename) self.output_filename = get_fullpath(output_filename) self.tempdir = get_fullpath( os.path.join(tempdir, get_basename(output_filename))) try: os.makedirs(self.tempdir, exist_ok=True) - logger.info("using temp dir at: %s", self.tempdir) + logger.debug("using temp dir at: %s", self.tempdir) except IOError as _: logger.exception("create tempdir failed for: %s", self.tempdir) raise @@ -205,7 +205,7 @@ class M3u8Downloader: uri = mo.group(1) key_url = urljoin(url, uri) local_key_file = self.mirror_url_resource(key_url) - logger.info("key downloaded at: %s", local_key_file) + logger.debug("key downloaded at: %s", local_key_file) def download_fragment(self, url): """download a video fragment. @@ -213,7 +213,7 @@ class M3u8Downloader: """ fragment_full_name = self.mirror_url_resource(url) if fragment_full_name: - logger.info("fragment created at: %s", fragment_full_name) + logger.debug("fragment created at: %s", fragment_full_name) return (url, fragment_full_name) def fragment_downloaded(self, result): @@ -294,7 +294,7 @@ class M3u8Downloader: replace_on_next_line = False if target_media_playlist is None: target_media_playlist = line - logger.info("choose resolution=%s uri=%s", + logger.info("chose resolution=%s uri=%s", last_resolution, target_media_playlist) self.process_media_playlist(urljoin(url, target_media_playlist)) diff --git a/operational b/operational index 53df504..a69a67c 100644 --- a/operational +++ b/operational @@ -1,6 +1,6 @@ * COMMENT -*- mode: org -*- #+Date: 2019-03-02 -Time-stamp: <2019-03-03> +Time-stamp: <2019-03-06> #+STARTUP: content * notes :entry: * later :entry: @@ -39,6 +39,19 @@ to handle it on ryzen5. * current :entry: ** +** 2019-03-03 add progress tracking log. +do a commit before I add this. + +- 2019-03-06 expected log: + 120 fragments + 25%, 30 fragments fetched. + 100%, 120 fragments fetched. + + moved some info log to debug log. + how to add progress log. + pool.join() is blocking. + +* done :entry: ** 2019-03-03 generate mp4 for audio sequence fail. probably because of png ext. https://m3u.x8sinablog.net/20180627/1530068509/vts/audio000.png @@ -64,10 +77,6 @@ it's aac audio. it works. -** 2019-03-03 add progress tracking log. -do a commit before I add this. - -* done :entry: ** 2019-03-02 my plan - target temp dir: subdir and filename same as original path. -- GitLab