From a3b27e1deaf6b445e5174ee221fd5d3c2edec3cb Mon Sep 17 00:00:00 2001 From: Dan Dembinski Date: Mon, 9 Mar 2020 16:34:28 -0400 Subject: [PATCH] Accounted for no artworkURL --- helper.py | 9 +++++---- main.py | 5 ++++- test.opml | 5 +++++ 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 test.opml diff --git a/helper.py b/helper.py index dd36320..7a523de 100644 --- a/helper.py +++ b/helper.py @@ -4,7 +4,8 @@ import requests API_URL = '''http://podcast-api.caprover.dandev.us''' def feedImport (): - outline = opml.parse("podcast_republic_podcasts.opml") + # outline = opml.parse("podcast_republic_podcasts.opml") + outline = opml.parse("test.opml") #get the number of shows from the OPML file x = len(outline) y=0 @@ -17,10 +18,10 @@ def feedImport (): desc = outline[y].pr_desc #checks to see if the podcast URL already exists for logged in user and skips it if it has already been imported. - # payload = '''{"userid" : 1, "newURL": "''' + str(url) + '''"}''' r = requests.post(API_URL+'/addFeed/', json={"userID" : 1, "newURL" : url}) - print(r.text) - # print(payload) + # print(r.text) + print(url) + y=y+1 feedImport() diff --git a/main.py b/main.py index 1aec6e5..6e682ac 100644 --- a/main.py +++ b/main.py @@ -129,7 +129,10 @@ def addFeed(): parsed = fp.parse(data['newURL']) title = str(parsed.feed.title) - artwork = str(parsed.feed.image) + if not parsed.feed.title: + artwork = str(parsed.feed.image) + else: + artwork = None # checks to see if the podcast URL already exists for logged in user and skips it if it has already been imported. # if the show doesn't already exist for the logged in user it gets added diff --git a/test.opml b/test.opml new file mode 100644 index 0000000..e006f31 --- /dev/null +++ b/test.opml @@ -0,0 +1,5 @@ +Podcast Republic Subscribed Feeds + + + +