about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xPodWeb.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/PodWeb.py b/PodWeb.py
index 5adc86e..5c2d9e0 100755
--- a/PodWeb.py
+++ b/PodWeb.py
@@ -284,6 +284,18 @@ class PodWeb:
             )
             self.con.commit()
 
+    def download_episode(self, guid):
+        response = self.data.execute(
+            'SELECT "url" FROM "episodes" WHERE guid = :GUID;', {"GUID": guid}
+        )
+        url = response.fetchone()
+        if url == None:
+            click.echo("No URL found!", err=True)
+            return 1
+        url = url[0]
+        audio_data = urllib.request.urlopen(url)
+        click.echo(audio_data.read())
+
     def import_opml(self, opml_path: str) -> None:
         body = xmlet.parse(source=opml_path).getroot().find("body")
         if body is None: