mirror of
https://github.com/Xevion/v1.xevion.dev.git
synced 2025-12-09 14:09:07 -06:00
create new YouTube & Soundcloud models in database
This commit is contained in:
@@ -111,6 +111,22 @@ class Post(db.Model):
|
||||
def __repr__(self):
|
||||
return '<Post {}>'.format(self.body)
|
||||
|
||||
class YouTubeAudio(db.Model):
|
||||
id = db.Column(db.String(11), primary_key=True) # 11 char id, presumed to stay the same for the long haul. Should be able to change to 12 chars.
|
||||
url = db.Column(db.String(64)) # 43 -> 64
|
||||
title = db.Column(db.String(128)) # 120 > 128
|
||||
creator = db.Column(db.String(32)) # 20 -> 32
|
||||
filename = db.Column(db.String(156)) # 128 + 11 + 1 -> 156
|
||||
duration = db.Column(db.Integer)
|
||||
|
||||
class SoundcloudAudio(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True) # hidden API-accessible only ID
|
||||
url = db.Column(db.String(256))
|
||||
title = db.Column(db.String(128))
|
||||
creator = db.Column(db.String(64))
|
||||
filename = db.Column(db.String(156))
|
||||
duration = db.Column(db.Integer)
|
||||
|
||||
@login.user_loader
|
||||
def load_user(id):
|
||||
return User.query.get(int(id))
|
||||
@@ -18,12 +18,6 @@ import shutil
|
||||
# https://soundcloud.com/yungraredeath/fall-in-line-w-kxng-prod-mars-mission => /stream/soundcloud/fall-in-line-w-kxng-prod-mars-mission---yungraredeath => soundcloud/fall-in-line-w-kxng-prod-mars-mission---yungraredeath.mp3
|
||||
# spotify:track:16PmczUxlX7dpr6ror6pXd => /duration/spotify/16PmczUxlX7dpr6ror6pXd => spotify/16PmczUxlX7dpr6ror6pXd.mp3
|
||||
|
||||
class SoundcloudHandler:
|
||||
pass
|
||||
|
||||
class SpotifyHandler:
|
||||
pass
|
||||
|
||||
class YouTubeHandler:
|
||||
@staticmethod
|
||||
def url(videoid):
|
||||
@@ -83,7 +77,6 @@ service_functions = {
|
||||
# Default JSON format, will be used in case of corruption
|
||||
JSONDefault = {'youtube' : {}, 'soundcloud' : {}, 'spotify' : {}}
|
||||
|
||||
|
||||
if not os.path.exists(os.path.join('app', 'sounds')):
|
||||
print('Sounds folder not found. Creating.')
|
||||
os.mkdir(os.path.join('app', 'sounds'))
|
||||
|
||||
Reference in New Issue
Block a user