Skip to content

Commit

Permalink
Support for Python 3.8
Browse files Browse the repository at this point in the history
Fix exception name
  • Loading branch information
pizidavi committed Sep 14, 2021
1 parent fee7af2 commit 433f3cb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
6 changes: 4 additions & 2 deletions PanoptoDownloader/PanoptoDownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import threading
from ffmpeg_progress_yield import FfmpegProgress

from PanoptoDownloader.exceptions import *


class PanoptoDownloader:

Expand All @@ -17,7 +19,7 @@ def download(self, uri: str, output: str, callback: callable, error: callable) -
:return: Thread
"""
if not self.REGEX.match(uri):
raise RegexNotMach('URI not match')
raise RegexNotMatch('URI not match')
command = ['ffmpeg', '-f', 'hls', '-i', uri, '-c', 'copy', output]

threading.excepthook = error
Expand All @@ -26,7 +28,7 @@ def download(self, uri: str, output: str, callback: callable, error: callable) -
return t

@staticmethod
def _start(command: list[str], callback: callable) -> None:
def _start(command: list, callback: callable) -> None:
ff = FfmpegProgress(command)
for progress in ff.run_command_with_progress():
callback(progress)
2 changes: 1 addition & 1 deletion PanoptoDownloader/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

class RegexNotMach(Exception):
class RegexNotMatch(Exception):
pass
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Simple library to download video from Panopto

## Prerequisites

- Python >= 3.8

## Install

- Download [lasted release](https://github.com/Panopto-Video-DL/Panopto-Video-DL-lib/releases)
Expand All @@ -14,7 +18,7 @@ Simple library to download video from Panopto

```python
from PanoptoDownloader import PanoptoDownloader
from PanoptoDownloader.exceptions import RegexNotMach
from PanoptoDownloader.exceptions import RegexNotMatch


URL = "https://****/master.m3u8"
Expand All @@ -34,7 +38,7 @@ def error(args, /):
"""
:param args: threading.excepthook -> https://docs.python.org/3/library/threading.html#threading.excepthook
"""
if isinstance(args.exc_type, RegexNotMach):
if isinstance(args.exc_type, RegexNotMatch):
print('URL not correct')
else:
raise args.exc_type
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

setup(
name='PanoptoDownloader',
version='1.0.2',
version='1.0.3',
description='Download video from Panopto',
long_description=long_description,
long_description_content_type='text/markdown',
author='Panopto-Video-DL',
url='https://github.com/Panopto-Video-DL/Panopto-Video-DL-lib',
license='MIT',
packages=find_packages(),
python_requires='>=3.8',
install_requires=[
'ffmpeg_progress_yield'
]
Expand Down

0 comments on commit 433f3cb

Please sign in to comment.