diff options
author | gabrielgio <gabriel.giovanini@pm.me> | 2021-07-26 22:28:05 +0200 |
---|---|---|
committer | gabrielgio <gabriel.giovanini@pm.me> | 2021-07-26 22:36:04 +0200 |
commit | c8bd60648d193f85479d5f380b05bb6d4394ffda (patch) | |
tree | bf28d510da708ce45c39a6e3accdc514a6b2cd1c /importer/providers | |
parent | bf0cde0b0bb77cd75db03327a461abf26b90c465 (diff) | |
download | reddit-nextcloud-importer-c8bd60648d193f85479d5f380b05bb6d4394ffda.tar.gz reddit-nextcloud-importer-c8bd60648d193f85479d5f380b05bb6d4394ffda.tar.bz2 reddit-nextcloud-importer-c8bd60648d193f85479d5f380b05bb6d4394ffda.zip |
fix: Various fixes
Diffstat (limited to 'importer/providers')
-rw-r--r-- | importer/providers/i_reddit.py | 16 | ||||
-rw-r--r-- | importer/providers/providerbase.py | 2 | ||||
-rw-r--r-- | importer/providers/raw_image_base.py | 2 | ||||
-rw-r--r-- | importer/providers/youtube_dl_base.py | 5 |
4 files changed, 16 insertions, 9 deletions
diff --git a/importer/providers/i_reddit.py b/importer/providers/i_reddit.py index 797ce43..13fc70e 100644 --- a/importer/providers/i_reddit.py +++ b/importer/providers/i_reddit.py @@ -2,8 +2,14 @@ from importer.providers.raw_image_base import RawImageProviderBase class IReddit(RawImageProviderBase): - regex = "^.*i\\.redd\\.it.*\\.(jpg|jpeg)$" - _TEST = [{ - "url": "https://i.redd.it/pjj1ll1b2rr41.jpg", - "paths": ["source_pjj1ll1b2rr41.jpg"] - }] + regex = "^.*i\\.redd\\.it.*\\.(jpg|jpeg|gif)$" + _TEST = [ + { + "url": "https://i.redd.it/pjj1ll1b2rr41.jpg", + "paths": ["source_pjj1ll1b2rr41.jpg"] + }, + { + "url": "https://i.redd.it/55vpi6ol5jc71.gif", + "paths": ['source_55vpi6ol5jc71.gif'] + } + ] diff --git a/importer/providers/providerbase.py b/importer/providers/providerbase.py index 374b9af..51b525e 100644 --- a/importer/providers/providerbase.py +++ b/importer/providers/providerbase.py @@ -12,7 +12,7 @@ class ProviderBase: "paths": ["source_fXLMjfp.jpg"], }] - def __init__(self, url: str): + def __init__(self, url: str, **kwargs): self.url = url self.paths = [] self.downloaded = False diff --git a/importer/providers/raw_image_base.py b/importer/providers/raw_image_base.py index 267dcad..89ecfca 100644 --- a/importer/providers/raw_image_base.py +++ b/importer/providers/raw_image_base.py @@ -8,7 +8,7 @@ from importer.providers.providerbase import ProviderBase class RawImageProviderBase(ProviderBase): - regex = "^.*i.(jpg|jpeg|mp4)$" + regex = "^.*.(jpg|jpeg|mp4|gif)$" def download(self): path = self._download_raw_file(self.url) diff --git a/importer/providers/youtube_dl_base.py b/importer/providers/youtube_dl_base.py index 3bb2fb8..3d67738 100644 --- a/importer/providers/youtube_dl_base.py +++ b/importer/providers/youtube_dl_base.py @@ -18,6 +18,7 @@ class YoutubeDlProviderBase(ProviderBase): def download(self): ydl_opts = { + 'quiet': True, 'format': self.format, 'merge_output_format': self.merge_format_output, 'outtmpl': self.output_template @@ -28,9 +29,9 @@ class YoutubeDlProviderBase(ProviderBase): if info.get('_type', None) == 'playlist': for entry in info['entries']: r = ydl.prepare_filename(entry) - self.paths.append(f'{os.path.splitext(r)[0]}.mp4') + self.paths.append(f'{os.path.splitext(r)[0]}.{entry["ext"]}') else: r = ydl.prepare_filename(info) - self.paths.append(f'{os.path.splitext(r)[0]}.mp4') + self.paths.append(f'{os.path.splitext(r)[0]}.{info["ext"]}') self.downloaded = True |