aboutsummaryrefslogtreecommitdiff
path: root/importer/providers/providerbase.py
diff options
context:
space:
mode:
Diffstat (limited to 'importer/providers/providerbase.py')
-rw-r--r--importer/providers/providerbase.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/importer/providers/providerbase.py b/importer/providers/providerbase.py
new file mode 100644
index 0000000..374b9af
--- /dev/null
+++ b/importer/providers/providerbase.py
@@ -0,0 +1,30 @@
+import os
+from typing import List
+
+
+class ProviderBase:
+ paths: List[str]
+ downloaded: bool
+ regex: str
+
+ _TEST = [{
+ "url": "https://i.imgur.com/fXLMjfp.jpg",
+ "paths": ["source_fXLMjfp.jpg"],
+ }]
+
+ def __init__(self, url: str):
+ self.url = url
+ self.paths = []
+ self.downloaded = False
+
+ def download(self):
+ pass
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ if self.paths:
+ for path in self.paths:
+ if os.path.exists(path):
+ os.unlink(path)