From 77a7583913bece18db87a245f2843988e3b1558b Mon Sep 17 00:00:00 2001 From: aj Date: Sat, 19 Oct 2019 17:14:11 +0100 Subject: [PATCH] refactored to music package --- main.py | 2 +- {spotify => music}/__init__.py | 0 {spotify => music}/api/__init__.py | 0 {spotify => music}/api/api.py | 10 +++++----- {spotify => music}/api/decorators.py | 2 +- {spotify => music}/api/fm.py | 4 ++-- {spotify => music}/api/player.py | 4 ++-- {spotify => music}/api/spotfm.py | 4 ++-- {spotify => music}/api/spotify.py | 4 ++-- {spotify => music}/auth/__init__.py | 0 {spotify => music}/auth/auth.py | 2 +- {spotify => music}/db/__init__.py | 0 {spotify => music}/db/database.py | 2 +- {spotify => music}/db/part_generator.py | 2 +- {spotify => music}/db/user.py | 0 {spotify => music}/music.py | 4 ++-- {spotify => music}/tasks/__init__.py | 0 {spotify => music}/tasks/create_playlist.py | 2 +- {spotify => music}/tasks/play_user_playlist.py | 4 ++-- {spotify => music}/tasks/run_user_playlist.py | 4 ++-- {spotify => music}/templates/app.html | 0 {spotify => music}/templates/base.html | 0 {spotify => music}/templates/index.html | 0 {spotify => music}/templates/login.html | 0 {spotify => music}/templates/register.html | 0 25 files changed, 25 insertions(+), 25 deletions(-) rename {spotify => music}/__init__.py (100%) rename {spotify => music}/api/__init__.py (100%) rename {spotify => music}/api/api.py (98%) rename {spotify => music}/api/decorators.py (98%) rename {spotify => music}/api/fm.py (81%) rename {spotify => music}/api/player.py (97%) rename {spotify => music}/api/spotfm.py (92%) rename {spotify => music}/api/spotify.py (90%) rename {spotify => music}/auth/__init__.py (100%) rename {spotify => music}/auth/auth.py (99%) rename {spotify => music}/db/__init__.py (100%) rename {spotify => music}/db/database.py (99%) rename {spotify => music}/db/part_generator.py (98%) rename {spotify => music}/db/user.py (100%) rename {spotify => music}/music.py (89%) rename {spotify => music}/tasks/__init__.py (100%) rename {spotify => music}/tasks/create_playlist.py (94%) rename {spotify => music}/tasks/play_user_playlist.py (97%) rename {spotify => music}/tasks/run_user_playlist.py (97%) rename {spotify => music}/templates/app.html (100%) rename {spotify => music}/templates/base.html (100%) rename {spotify => music}/templates/index.html (100%) rename {spotify => music}/templates/login.html (100%) rename {spotify => music}/templates/register.html (100%) diff --git a/main.py b/main.py index 67cc4da..b282268 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,4 @@ -from spotify import app +from music import app app = app diff --git a/spotify/__init__.py b/music/__init__.py similarity index 100% rename from spotify/__init__.py rename to music/__init__.py diff --git a/spotify/api/__init__.py b/music/api/__init__.py similarity index 100% rename from spotify/api/__init__.py rename to music/api/__init__.py diff --git a/spotify/api/api.py b/music/api/api.py similarity index 98% rename from spotify/api/api.py rename to music/api/api.py index 64b37ae..36edb0d 100644 --- a/spotify/api/api.py +++ b/music/api/api.py @@ -10,11 +10,11 @@ from google.cloud import tasks_v2 from google.protobuf import timestamp_pb2 from werkzeug.security import check_password_hash, generate_password_hash -from spotify.api.decorators import login_required, login_or_basic_auth, admin_required, gae_cron, cloud_task -from spotify.tasks.run_user_playlist import run_user_playlist as run_user_playlist -from spotify.tasks.play_user_playlist import play_user_playlist as play_user_playlist +from music.api.decorators import login_required, login_or_basic_auth, admin_required, gae_cron, cloud_task +from music.tasks.run_user_playlist import run_user_playlist as run_user_playlist +from music.tasks.play_user_playlist import play_user_playlist as play_user_playlist -import spotify.db.database as database +import music.db.database as database blueprint = Blueprint('api', __name__) db = firestore.Client() @@ -130,7 +130,7 @@ def playlist(username=None): # if playlist_id is None or playlist_shuffle is None: # return jsonify({'error': 'parts and id required'}), 400 - from spotify.tasks.create_playlist import create_playlist as create_playlist + from music.tasks.create_playlist import create_playlist as create_playlist to_add = { 'name': playlist_name, diff --git a/spotify/api/decorators.py b/music/api/decorators.py similarity index 98% rename from spotify/api/decorators.py rename to music/api/decorators.py index 8030357..10fa67a 100644 --- a/spotify/api/decorators.py +++ b/music/api/decorators.py @@ -3,7 +3,7 @@ import logging from flask import session, request, jsonify -from spotify.db import database as database +from music.db import database as database logger = logging.getLogger(__name__) diff --git a/spotify/api/fm.py b/music/api/fm.py similarity index 81% rename from spotify/api/fm.py rename to music/api/fm.py index 7899824..73177fa 100644 --- a/spotify/api/fm.py +++ b/music/api/fm.py @@ -2,9 +2,9 @@ from flask import Blueprint, jsonify from datetime import date import logging -from spotify.api.decorators import login_or_basic_auth, lastfm_username_required +from music.api.decorators import login_or_basic_auth, lastfm_username_required -import spotify.db.database as database +import music.db.database as database blueprint = Blueprint('fm-api', __name__) logger = logging.getLogger(__name__) diff --git a/spotify/api/player.py b/music/api/player.py similarity index 97% rename from spotify/api/player.py rename to music/api/player.py index 632e835..81d4efb 100644 --- a/spotify/api/player.py +++ b/music/api/player.py @@ -2,8 +2,8 @@ from flask import Blueprint, request, jsonify import logging -from spotify.api.decorators import login_or_basic_auth, spotify_link_required -import spotify.db.database as database +from music.api.decorators import login_or_basic_auth, spotify_link_required +import music.db.database as database from spotframework.model.track import SpotifyTrack from spotframework.model.uri import Uri diff --git a/spotify/api/spotfm.py b/music/api/spotfm.py similarity index 92% rename from spotify/api/spotfm.py rename to music/api/spotfm.py index 7a39fd0..1215409 100644 --- a/spotify/api/spotfm.py +++ b/music/api/spotfm.py @@ -1,8 +1,8 @@ from flask import Blueprint, jsonify, request import logging -from spotify.api.decorators import login_or_basic_auth, lastfm_username_required, spotify_link_required -import spotify.db.database as database +from music.api.decorators import login_or_basic_auth, lastfm_username_required, spotify_link_required +import music.db.database as database from spotfm.maths.counter import Counter from spotframework.model.uri import Uri diff --git a/spotify/api/spotify.py b/music/api/spotify.py similarity index 90% rename from spotify/api/spotify.py rename to music/api/spotify.py index e1b5e8a..027aff8 100644 --- a/spotify/api/spotify.py +++ b/music/api/spotify.py @@ -1,8 +1,8 @@ from flask import Blueprint, request, jsonify import logging -from spotify.api.decorators import login_or_basic_auth, spotify_link_required -import spotify.db.database as database +from music.api.decorators import login_or_basic_auth, spotify_link_required +import music.db.database as database from spotframework.engine.playlistengine import PlaylistEngine from spotframework.model.uri import Uri diff --git a/spotify/auth/__init__.py b/music/auth/__init__.py similarity index 100% rename from spotify/auth/__init__.py rename to music/auth/__init__.py diff --git a/spotify/auth/auth.py b/music/auth/auth.py similarity index 99% rename from spotify/auth/auth.py rename to music/auth/auth.py index 336cdfe..5c1c983 100644 --- a/spotify/auth/auth.py +++ b/music/auth/auth.py @@ -8,7 +8,7 @@ import logging from base64 import b64encode import requests -import spotify.db.database as database +import music.db.database as database blueprint = Blueprint('authapi', __name__) diff --git a/spotify/db/__init__.py b/music/db/__init__.py similarity index 100% rename from spotify/db/__init__.py rename to music/db/__init__.py diff --git a/spotify/db/database.py b/music/db/database.py similarity index 99% rename from spotify/db/database.py rename to music/db/database.py index 1157eba..a08fea1 100644 --- a/spotify/db/database.py +++ b/music/db/database.py @@ -6,7 +6,7 @@ from werkzeug.security import check_password_hash from spotframework.net.network import Network as SpotifyNetwork from fmframework.net.network import Network as FmNetwork -from spotify.db.user import DatabaseUser +from music.db.user import DatabaseUser db = firestore.Client() diff --git a/spotify/db/part_generator.py b/music/db/part_generator.py similarity index 98% rename from spotify/db/part_generator.py rename to music/db/part_generator.py index 1249d4e..8762a99 100644 --- a/spotify/db/part_generator.py +++ b/music/db/part_generator.py @@ -1,5 +1,5 @@ from google.cloud import firestore -import spotify.db.database as database +import music.db.database as database import logging db = firestore.Client() diff --git a/spotify/db/user.py b/music/db/user.py similarity index 100% rename from spotify/db/user.py rename to music/db/user.py diff --git a/spotify/music.py b/music/music.py similarity index 89% rename from spotify/music.py rename to music/music.py index bef95a1..2007e6e 100644 --- a/spotify/music.py +++ b/music/music.py @@ -3,8 +3,8 @@ from google.cloud import firestore import os -from spotify.auth import auth_blueprint -from spotify.api import api_blueprint, player_blueprint, fm_blueprint, spotfm_blueprint, spotify_blueprint +from music.auth import auth_blueprint +from music.api import api_blueprint, player_blueprint, fm_blueprint, spotfm_blueprint, spotify_blueprint db = firestore.Client() diff --git a/spotify/tasks/__init__.py b/music/tasks/__init__.py similarity index 100% rename from spotify/tasks/__init__.py rename to music/tasks/__init__.py diff --git a/spotify/tasks/create_playlist.py b/music/tasks/create_playlist.py similarity index 94% rename from spotify/tasks/create_playlist.py rename to music/tasks/create_playlist.py index 8be5998..9ceca9e 100644 --- a/spotify/tasks/create_playlist.py +++ b/music/tasks/create_playlist.py @@ -2,7 +2,7 @@ from google.cloud import firestore import logging -import spotify.db.database as database +import music.db.database as database db = firestore.Client() diff --git a/spotify/tasks/play_user_playlist.py b/music/tasks/play_user_playlist.py similarity index 97% rename from spotify/tasks/play_user_playlist.py rename to music/tasks/play_user_playlist.py index b8d2cc5..8ac32f9 100644 --- a/spotify/tasks/play_user_playlist.py +++ b/music/tasks/play_user_playlist.py @@ -9,8 +9,8 @@ from spotframework.engine.processor.sort import SortReleaseDate from spotframework.engine.processor.deduplicate import DeduplicateByID from spotframework.player.player import Player -import spotify.db.database as database -from spotify.db.part_generator import PartGenerator +import music.db.database as database +from music.db.part_generator import PartGenerator db = firestore.Client() diff --git a/spotify/tasks/run_user_playlist.py b/music/tasks/run_user_playlist.py similarity index 97% rename from spotify/tasks/run_user_playlist.py rename to music/tasks/run_user_playlist.py index 9b57b6c..1f573e1 100644 --- a/spotify/tasks/run_user_playlist.py +++ b/music/tasks/run_user_playlist.py @@ -10,8 +10,8 @@ from spotframework.engine.processor.deduplicate import DeduplicateByID from spotframework.model.uri import Uri -import spotify.db.database as database -from spotify.db.part_generator import PartGenerator +import music.db.database as database +from music.db.part_generator import PartGenerator db = firestore.Client() diff --git a/spotify/templates/app.html b/music/templates/app.html similarity index 100% rename from spotify/templates/app.html rename to music/templates/app.html diff --git a/spotify/templates/base.html b/music/templates/base.html similarity index 100% rename from spotify/templates/base.html rename to music/templates/base.html diff --git a/spotify/templates/index.html b/music/templates/index.html similarity index 100% rename from spotify/templates/index.html rename to music/templates/index.html diff --git a/spotify/templates/login.html b/music/templates/login.html similarity index 100% rename from spotify/templates/login.html rename to music/templates/login.html diff --git a/spotify/templates/register.html b/music/templates/register.html similarity index 100% rename from spotify/templates/register.html rename to music/templates/register.html