added playlist printing, model props, added popularity sorting
This commit is contained in:
parent
7f5c7709af
commit
c003065419
@ -8,21 +8,21 @@ google-auth==1.6.3
|
|||||||
google-cloud-core==1.0.3
|
google-cloud-core==1.0.3
|
||||||
google-cloud-firestore==1.4.0
|
google-cloud-firestore==1.4.0
|
||||||
google-cloud-logging==1.12.1
|
google-cloud-logging==1.12.1
|
||||||
google-cloud-pubsub==0.45.0
|
google-cloud-tasks==1.2.1
|
||||||
google-cloud-tasks==1.2.0
|
|
||||||
googleapis-common-protos==1.6.0
|
googleapis-common-protos==1.6.0
|
||||||
grpc-google-iam-v1==0.12.3
|
grpc-google-iam-v1==0.12.3
|
||||||
grpcio==1.22.0
|
grpcio==1.23.0
|
||||||
idna==2.8
|
idna==2.8
|
||||||
itsdangerous==1.1.0
|
itsdangerous==1.1.0
|
||||||
Jinja2==2.10.1
|
Jinja2==2.10.1
|
||||||
MarkupSafe==1.1.1
|
MarkupSafe==1.1.1
|
||||||
protobuf==3.9.1
|
protobuf==3.9.1
|
||||||
pyasn1==0.4.6
|
pyasn1==0.4.7
|
||||||
pyasn1-modules==0.2.6
|
pyasn1-modules==0.2.6
|
||||||
pytz==2019.2
|
pytz==2019.2
|
||||||
requests==2.22.0
|
requests==2.22.0
|
||||||
rsa==4.0
|
rsa==4.0
|
||||||
six==1.12.0
|
six==1.12.0
|
||||||
|
tabulate==0.8.3
|
||||||
urllib3==1.25.3
|
urllib3==1.25.3
|
||||||
Werkzeug==0.15.5
|
Werkzeug==0.15.6
|
||||||
|
@ -6,7 +6,6 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from google.cloud import firestore
|
from google.cloud import firestore
|
||||||
from google.cloud import pubsub_v1
|
|
||||||
from google.cloud import tasks_v2
|
from google.cloud import tasks_v2
|
||||||
from google.protobuf import timestamp_pb2
|
from google.protobuf import timestamp_pb2
|
||||||
from werkzeug.security import check_password_hash, generate_password_hash
|
from werkzeug.security import check_password_hash, generate_password_hash
|
||||||
@ -18,11 +17,9 @@ import spotify.db.database as database
|
|||||||
|
|
||||||
blueprint = Blueprint('api', __name__)
|
blueprint = Blueprint('api', __name__)
|
||||||
db = firestore.Client()
|
db = firestore.Client()
|
||||||
publisher = pubsub_v1.PublisherClient()
|
|
||||||
|
|
||||||
tasker = tasks_v2.CloudTasksClient()
|
tasker = tasks_v2.CloudTasksClient()
|
||||||
task_path = tasker.queue_path('sarsooxyz', 'europe-west2', 'spotify-executions')
|
task_path = tasker.queue_path('sarsooxyz', 'europe-west2', 'spotify-executions')
|
||||||
run_playlist_topic_path = publisher.topic_path('sarsooxyz', 'run_user_playlist')
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -660,11 +657,3 @@ def create_play_user_playlist_task(username,
|
|||||||
task['schedule_time'] = timestamp
|
task['schedule_time'] = timestamp
|
||||||
|
|
||||||
tasker.create_task(task_path, task)
|
tasker.create_task(task_path, task)
|
||||||
|
|
||||||
|
|
||||||
def push_run_user_playlist_message(username, name):
|
|
||||||
|
|
||||||
data = u'{}'.format(name)
|
|
||||||
data = data.encode('utf-8')
|
|
||||||
|
|
||||||
publisher.publish(run_playlist_topic_path, data=data, username=username)
|
|
||||||
|
@ -5,19 +5,16 @@ import logging
|
|||||||
|
|
||||||
from spotframework.engine.playlistengine import PlaylistEngine
|
from spotframework.engine.playlistengine import PlaylistEngine
|
||||||
from spotframework.engine.filter.shuffle import Shuffle
|
from spotframework.engine.filter.shuffle import Shuffle
|
||||||
from spotframework.engine.filter.sort import SortReverseReleaseDate
|
from spotframework.engine.filter.sort import SortReleaseDate
|
||||||
from spotframework.engine.filter.deduplicate import DeduplicateByID
|
from spotframework.engine.filter.deduplicate import DeduplicateByID
|
||||||
|
|
||||||
from spotframework.net.network import Network
|
from spotframework.net.network import Network
|
||||||
from spotframework.net.user import NetworkUser
|
from spotframework.net.user import NetworkUser
|
||||||
|
|
||||||
import spotify.db.database as database
|
import spotify.db.database as database
|
||||||
from spotify.db.part_generator import PartGenerator
|
from spotify.db.part_generator import PartGenerator
|
||||||
|
|
||||||
db = firestore.Client()
|
db = firestore.Client()
|
||||||
|
|
||||||
captured_playlists = []
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -69,7 +66,7 @@ def play_user_playlist(username,
|
|||||||
if shuffle:
|
if shuffle:
|
||||||
processors.append(Shuffle())
|
processors.append(Shuffle())
|
||||||
else:
|
else:
|
||||||
processors.append(SortReverseReleaseDate())
|
processors.append(SortReleaseDate(reverse=True))
|
||||||
|
|
||||||
submit_parts = parts
|
submit_parts = parts
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import logging
|
|||||||
|
|
||||||
from spotframework.engine.playlistengine import PlaylistEngine
|
from spotframework.engine.playlistengine import PlaylistEngine
|
||||||
from spotframework.engine.filter.shuffle import Shuffle
|
from spotframework.engine.filter.shuffle import Shuffle
|
||||||
from spotframework.engine.filter.sort import SortReverseReleaseDate
|
from spotframework.engine.filter.sort import SortReleaseDate
|
||||||
from spotframework.engine.filter.deduplicate import DeduplicateByID
|
from spotframework.engine.filter.deduplicate import DeduplicateByID
|
||||||
|
|
||||||
from spotframework.net.network import Network
|
from spotframework.net.network import Network
|
||||||
@ -15,8 +15,6 @@ from spotify.db.part_generator import PartGenerator
|
|||||||
|
|
||||||
db = firestore.Client()
|
db = firestore.Client()
|
||||||
|
|
||||||
captured_playlists = []
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -61,7 +59,7 @@ def run_user_playlist(username, playlist_name):
|
|||||||
if playlist_dict['shuffle'] is True:
|
if playlist_dict['shuffle'] is True:
|
||||||
processors.append(Shuffle())
|
processors.append(Shuffle())
|
||||||
else:
|
else:
|
||||||
processors.append(SortReverseReleaseDate())
|
processors.append(SortReleaseDate(reverse=True))
|
||||||
|
|
||||||
part_generator = PartGenerator(user_id=users[0].id)
|
part_generator = PartGenerator(user_id=users[0].id)
|
||||||
submit_parts = part_generator.get_recursive_parts(playlist_dict['name'])
|
submit_parts = part_generator.get_recursive_parts(playlist_dict['name'])
|
||||||
|
Loading…
Reference in New Issue
Block a user