Skip to content
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

New environment variable value to avoid animation in download progress #32

Closed
HeuristicPerson opened this issue Aug 13, 2021 · 5 comments

Comments

@HeuristicPerson
Copy link

Good afternoon, lightpohl, and many thanks for this downloader program. After trying some others, I find yours much more simple and practical.

I'm in the process of creating a python 3 script (that later I will "dockerize") to automate the downloading of my subscriptions and I have a problem when reading the output of your program using subprocess. Somehow, when I call your script using subprocess module in Python by doing:

o_process = subprocess.Popen(plu_cmd,
                             bufsize=0,
                             universal_newlines=True,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)

# METHOD 1
#---------
#o_process.wait()
#u_stdout = o_process.stdout.read()
#u_stderr = o_process.stderr.read()

# METHOD 2
#---------
u_stdout, u_stderr = o_process.communicate()

# --- TEST CODE ---
print('CMD:    %s' % repr(plu_cmd))
print('STDOUT: %s' % repr(u_stdout))
# ------ end ------`

where plu_cmd is the shell call to your script, I don't get the full stdout output and I precissely miss the animated lines of each episode, where the percentage downloaded is continuously updating.

CMD:    ('/mnt/jupiter/pw_david/projects/coding/docker/podcast_dl/scripts/bin/podcast-dl-linux-x64', '--url', 'https://www.ivoox.com/feed_fg_f133371_filtro_1.xml', '--out-dir', '/mnt/jupiter/pw_david/projects/coding/docker/podcast_dl/test_data/podcasts_private/podcast la hermandad', '--limit', '2', '--episode-template', '{{release_date}}_{{title}}')
STDOUT: 'Starting download of 2 episodes\n\n1 of 2\nTitle: La Hermandad Podcast 10x12: el programa de... algo, pero verano.\nPublish Date: Mon, 02 Aug 2021 12:23:34 +0200\n\n2 of 2\nTitle: La Hermandad Podcast 10x11: veraneando en la guerra del mañana\nPublish Date: Tue, 06 Jul 2021 13:53:26 +0200\n\n'

For that reason I would like to have an extra value for LOG_LEVEL environment variable that just printed a final static line.

Regards and many thanks in advance for taking it into consideration.

@lightpohl
Copy link
Owner

lightpohl commented Aug 13, 2021

Hey! Thanks a bunch. I'm glad you like it! 🙏

I don't get the full stdout output and I precissely miss the animated lines of each episode, where the percentage downloaded is continuously updating.

Ah, that's probably because the download progress logging is disabled in non-TTY environments, which I'm guessing is what a Python subprocess would use when it runs the script.

We could add another environment variable (something like LOG_DOWNLOAD_PROGRESS) that would force it on when set to true? Would that work? As long as you're not saving the log output that should work well I think.

For that reason I would like to have an extra value for LOG_LEVEL environment variable that just printed a final static line.

Sorry, could you clarify this bit here? What would be included in the final line?

Let me know if that suggestion above will work for you!

@HeuristicPerson
Copy link
Author

We could add another environment variable (something like LOG_DOWNLOAD_PROGRESS) that would force it on when set to true? Would that work? As long as you're not saving the log output that should work well I think.

For that reason I would like to have an extra value for LOG_LEVEL environment variable that just printed a final static line.

Sorry, could you clarify this bit here? What would be included in the final line?

Many thanks, lightpohl

The new extra environment variable LOG_DOWNLOAD_PROGRESS will fix the issue, but I don't think you really need it. I mean by adding a new value to LOG_LEVEL would be enough so you don't keep adding more and more configuration options. Something like:

LOG_LEVEL:

  • static: NEW Same output as now but without animation, --100% indication would be redundant--
  • quiet: Only important info and non-critical errors will be logged (e.g. episode download started).
  • silent: Only critical error messages will be be logged.

Regards

@lightpohl
Copy link
Owner

lightpohl commented Aug 13, 2021

Ah, I gotcha. We can do something like that for sure.

Instead of incrementing the progress percentage, how about Starting download of XXX MB when it's set to static?

@lightpohl
Copy link
Owner

Hey! Support for LOG_LEVEL=static is available in v6.1.0. Let me know if you run into any issues! 💯

@HeuristicPerson
Copy link
Author

Many thanks, lightpohl. I'm just finishing the docker image now with version 6.0.0 but this weekend I'll try 6.1.0 and I'll let you know how it goes.

imagen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants