paljsingh / impartus-downloader

Download Impartus lectures, convert to mkv for offline viewing.
GNU General Public License v3.0
23 stars 8 forks source link

[Bug]: Invalid format error while getting the epoch value #66

Closed brahma19 closed 3 years ago

brahma19 commented 3 years ago

Describe the bug strftime('%s') is deprecated and it throws the invalid format error on python 3.7.10. To get the epochtime we can use timestamp() from datetimetime object. https://github.com/paljsingh/impartus-downloader/blob/master/ui/content.py#L502

To Reproduce Steps to reproduce the behavior:

  1. Run the App

Expected behavior A clear and concise description of what you expected to happen.

Error Stack Exception in thread Thread-7: Traceback (most recent call last): File "C:\Users\<>\AppData\Local\Programs\Python\Python37\lib\threading.py", line 926, in _bootstrap_inner self.run() File "C:\Users\<>\AppData\Local\Programs\Python\Python37\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "C:\Users\<>\Documents\impartus_downloader\idm\ui\content.py", line 533, in _download_video self.save_captions_if_needed(video_metadata, root_url, captions_path) File "C:\Users\<>\Documents\impartus_downloader\idm\ui\content.py", line 502, in save_captions_if_needed start_epoch = int(datetime.strptime(video_metadata['startTime'], date_format).strftime('%s')) ValueError: Invalid format string

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

brahma19 commented 3 years ago

changing this line int(datetime.strptime(video_metadata['startTime'], date_format).strftime('%s')) https://github.com/paljsingh/impartus-downloader/blob/master/ui/content.py#L502 to below is working as expected datetime.strptime(video_metadata['startTime'], date_format).timestamp()

paljsingh commented 3 years ago

@brahma19 Thanks for reporting the issue, This is fixed in v3.5.1 Please let me know if you see any issues.