From 900084f493279b59a729e7bbb6967d83b7bfa121 Mon Sep 17 00:00:00 2001 From: Dan Dembinski Date: Mon, 9 Mar 2020 14:30:43 -0400 Subject: [PATCH] added note to main about resetting autoincrement. Added podcast.opml file back in. wrote small console helper app to load in opml files for testing --- helper.py | 26 ++++++++++++++++++++++++++ main.py | 8 +++++++- podcast_republic_podcasts.opml | 19 +++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 helper.py create mode 100644 podcast_republic_podcasts.opml diff --git a/helper.py b/helper.py new file mode 100644 index 0000000..3c05afe --- /dev/null +++ b/helper.py @@ -0,0 +1,26 @@ +import opml +import requests + +API_URL = '''localhost:5000''' + +def feedImport (): + outline = opml.parse("podcast_republic_podcasts.opml") +#get the number of shows from the OPML file + x = len(outline) + y=0 + +#loops through each podcast and parses out relevant information + while y < x: + title = outline[y].title + url = outline[y].xmlUrl + artwork = outline[y].pr_artwork + 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": "''' + url + '''"}''' + # r = requests.post(API_URL+'/addFeed/', data=payload) + # print(r.text) + print(payload) + y=y+1 + +feedImport() \ No newline at end of file diff --git a/main.py b/main.py index 7314280..49ada45 100644 --- a/main.py +++ b/main.py @@ -9,14 +9,20 @@ app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://pc:pc@67.149.14.121:330 db = SQLAlchemy(app) +############# +# ALTER TABLE shows AUTO_INCREMENT = 1; +# ALTER TABLE podcasts AUTO_INCREMENT = 1; +# ALTER TABLE users AUTO_INCREMENT = 1; +############# + class users(db.Model): userID = db.Column(db.Integer, primary_key=True) username = db.Column(db.Text, unique=True) password = db.Column(db.Text) name = db.Column(db.Text) - name = db.Column(db.Text) email = db.Column(db.Text) + # token = db.column(db.Text) class shows(db.Model): showID = db.Column(db.Integer, primary_key=True) diff --git a/podcast_republic_podcasts.opml b/podcast_republic_podcasts.opml new file mode 100644 index 0000000..b1228b1 --- /dev/null +++ b/podcast_republic_podcasts.opml @@ -0,0 +1,19 @@ +Podcast Republic Subscribed Feeds + + + + + + + + \ No newline at end of file