mirror of
https://github.com/Xevion/v1.xevion.dev.git
synced 2026-01-31 04:26:30 -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):
|
def __repr__(self):
|
||||||
return '<Post {}>'.format(self.body)
|
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
|
@login.user_loader
|
||||||
def load_user(id):
|
def load_user(id):
|
||||||
return User.query.get(int(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
|
# 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
|
# spotify:track:16PmczUxlX7dpr6ror6pXd => /duration/spotify/16PmczUxlX7dpr6ror6pXd => spotify/16PmczUxlX7dpr6ror6pXd.mp3
|
||||||
|
|
||||||
class SoundcloudHandler:
|
|
||||||
pass
|
|
||||||
|
|
||||||
class SpotifyHandler:
|
|
||||||
pass
|
|
||||||
|
|
||||||
class YouTubeHandler:
|
class YouTubeHandler:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def url(videoid):
|
def url(videoid):
|
||||||
@@ -83,7 +77,6 @@ service_functions = {
|
|||||||
# Default JSON format, will be used in case of corruption
|
# Default JSON format, will be used in case of corruption
|
||||||
JSONDefault = {'youtube' : {}, 'soundcloud' : {}, 'spotify' : {}}
|
JSONDefault = {'youtube' : {}, 'soundcloud' : {}, 'spotify' : {}}
|
||||||
|
|
||||||
|
|
||||||
if not os.path.exists(os.path.join('app', 'sounds')):
|
if not os.path.exists(os.path.join('app', 'sounds')):
|
||||||
print('Sounds folder not found. Creating.')
|
print('Sounds folder not found. Creating.')
|
||||||
os.mkdir(os.path.join('app', 'sounds'))
|
os.mkdir(os.path.join('app', 'sounds'))
|
||||||
|
|||||||
Reference in New Issue
Block a user