Skip to content

Commit

Permalink
Add audio playback to beat library view
Browse files Browse the repository at this point in the history
Fixes #2
- Installed pafy and youtube-dl
- Modified pafy to fix dislike bug. (Modified module will be included in repo)
- Add audio_url to Video database model and inlcuded in add_uploads_to_database()
- Changed additionallinks to head (Jinja templating)
- Added Favicon
- Incorporate a while loop to deal with pafy's "dead link" problem
  • Loading branch information
vincemaina committed Jul 1, 2022
1 parent 86c8f33 commit d7d57cf
Show file tree
Hide file tree
Showing 22 changed files with 2,685 additions and 30 deletions.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def home():
@app.route('/') # START PAGE
@app.route('/beats')
def beat_library():
videos = Videos.query.all() # Consider updating this to only send through the data from 'videos' that is needed. Better to be more specific, in case I add any kind of sensitive information to this database model in future.
videos = Videos.query.all()
return render_template('beat-library.html', videos=videos)

@app.route('/beats/<video_id>')
Expand Down
2 changes: 1 addition & 1 deletion credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
with open('credentials.json', 'w') as f: # Creates a credentials.json file from the string in the environment variable, BEAT_WEBSITE_OAUTH_CREDENTIALS. This string was obtained from a json file downlaoded from the google developer console.
with open('credentials.json', 'w') as f:
f.write(BEAT_WEBSITE_OAUTH_CREDENTIALS)
flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES)
creds = flow.run_local_server(port=0) # IS THIS GOING TO WORK ON A LIVE SERVER?
Expand Down
Binary file modified main.db
Binary file not shown.
1 change: 1 addition & 0 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Videos(db.Model):
video_tags = db.Column(db.Text)
beat_mixdowns = db.Column(db.Text)
beat_stems = db.Column(db.Text)
audio_url = db.Column(db.Text)

def __repr__(self):
return f"\nvideo_id = {self.video_id}\nvideo_title = {self.video_title}\nvideo_publishedAt = {self.video_publishedAt}\nvideo_thumbnail = {self.video_thumbnail}\nvideo_description = {self.video_description}"
Expand Down
14 changes: 14 additions & 0 deletions pafy_modified/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
__version__ = "0.5.5"
__author__ = "np1"
__license__ = "LGPLv3"


# External api
from .pafy import new
from .pafy import set_api_key
from .pafy import load_cache, dump_cache
from .pafy import get_categoryname
from .pafy import backend
from .util import GdataError, call_gdata
from .playlist import get_playlist, get_playlist2
from .channel import get_channel
Loading

0 comments on commit d7d57cf

Please sign in to comment.