diff --git a/server/app/api.py b/server/app/api.py index 8025859..d513064 100644 --- a/server/app/api.py +++ b/server/app/api.py @@ -188,6 +188,7 @@ def populate_images(): return {'sample': artists_in_db_array[:25]} + @bp.route("/artist/") @cache.cached() def getArtistData(artist: str): @@ -244,24 +245,13 @@ def getArtistData(artist: str): @bp.route("/f/") @cache.cached() def getFolderTree(folder: str = None): - try: - req_dir, last_id = folder.split('::') + req_dir = folder.replace('|', '/') + print(folder) - req_dir = req_dir.replace('|', '/') - dir_list = req_dir.split('/') - requested_dir = os.path.join(home_dir, *dir_list) + if folder == "home": + req_dir = home_dir - if req_dir == "home": - requested_dir = home_dir - - if last_id == "None": - last_id = None - - except: - requested_dir = home_dir - last_id = None - - dir_content = os.scandir(requested_dir) + dir_content = os.scandir(os.path.join(home_dir, req_dir)) folders = [] @@ -286,7 +276,7 @@ def getFolderTree(folder: str = None): getTags(entry.path) songs_array = all_songs_instance.find_songs_by_folder( - req_dir, last_id) + req_dir) songs = convert_to_json(songs_array) for song in songs: song['artists'] = song['artists'].split(', ') @@ -299,27 +289,6 @@ def getFolderTree(folder: str = None): return {"files": songs, "folders": folders} -@bp.route('/image//') -def send_image(img_type, image_id): - if img_type == "thumbnail": - song_obj = all_songs_instance.get_song_by_id(image_id) - loaded_song = convert_one_to_json(song_obj) - - img_dir = app_dir + "/images/thumbnails" - image = loaded_song['image'] - - if img_type == "artist": - artist_obj = artist_instance.get_artist_by_id(image_id) - artist = convert_one_to_json(artist_obj) - - img_dir = app_dir + "/images/artists" - - image = artist['name'] + ".jpg" - print(img_dir + image) - - return send_from_directory(img_dir, image) - - @bp.route('/get/queue', methods=['POST']) def post(): args = request.get_json() @@ -340,6 +309,7 @@ def post(): return {'msg': 'ok'} + @bp.route('/qwerty') def populateArtists(): all_songs = all_songs_instance.get_all_songs() @@ -358,5 +328,25 @@ def populateArtists(): if a_obj not in artists: artists.append(a_obj) + artist_instance.insert_artist(a_obj) - return {'songs': artists} \ No newline at end of file + return {'songs': artists} + + +@bp.route('/albums') +def getAlbums(): + s = all_songs_instance.get_all_songs() + ss = convert_to_json(s) + + albums = [] + + for song in ss: + al_obj = { + "name": song['album'], + "artist": song['artists'] + } + + if al_obj not in albums: + albums.append(al_obj) + + return {'albums': albums} diff --git a/server/app/models.py b/server/app/models.py index c5af569..69c3785 100644 --- a/server/app/models.py +++ b/server/app/models.py @@ -7,13 +7,14 @@ class Mongo: mongo_uri = pymongo.MongoClient() self.db = mongo_uri[database] + class Artists(Mongo): def __init__(self): super(Artists, self).__init__('ALL_ARTISTS') self.collection = self.db['THEM_ARTISTS'] def insert_artist(self, artist_obj): - self.collection.update(artist_obj, artist_obj, upsert=True) + self.collection.update_one(artist_obj, {'$set': artist_obj}, upsert=True) def get_all_artists(self): return self.collection.find() @@ -48,20 +49,16 @@ class AllSongs(Mongo): return self.collection.find({'album': {'$regex': query, '$options': 'i'}}) def get_all_songs(self): - return self.collection.find() + return self.collection.find().limit(25) - def find_songs_by_folder(self, query, last_id=None): - limit = 18 - if last_id is None: - return self.collection.find({'folder': query}).limit(limit) - else: - return self.collection.find({'folder': query, '_id': {'$gt': ObjectId(last_id)}}).limit(limit) + def find_songs_by_folder(self, query): + return self.collection.find({'folder': query}) def find_songs_by_folder_og(self, query): return self.collection.find({'folder': query}) def find_songs_by_artist(self, query): - return self.collection.find({'artists': {'$regex': query, '$options': 'i'}}) + return self.collection.find({'artists': query}) def find_songs_by_album_artist(self, query): return self.collection.find({'album_artist': {'$regex': query, '$options': 'i'}}) diff --git a/src/App.vue b/src/App.vue index 5233030..ada03e3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -15,12 +15,12 @@
+
-
diff --git a/src/assets/css/_variables.scss b/src/assets/css/_variables.scss index 713afa7..c8a9f62 100644 --- a/src/assets/css/_variables.scss +++ b/src/assets/css/_variables.scss @@ -2,7 +2,7 @@ $card-dark: #131313b2; $red: #df4646; -$blue: #00a8ff; +$blue: rgb(5, 80, 150); $green: rgb(67, 148, 67); $separator: #ffffff46; // sizes diff --git a/src/assets/css/global.scss b/src/assets/css/global.scss index 947436c..61bd12a 100644 --- a/src/assets/css/global.scss +++ b/src/assets/css/global.scss @@ -126,11 +126,11 @@ a { margin-bottom: 0.5em; } -// @media (max-width: 70em) { -// .r-sidebar { -// display: none; -// } -// } +@media (max-width: 70em) { + .r-sidebar { + display: none; + } +} .image { background-position: center; diff --git a/src/assets/icons/folder.svg b/src/assets/icons/folder.svg index 2beb975..5d3e766 100644 --- a/src/assets/icons/folder.svg +++ b/src/assets/icons/folder.svg @@ -1,3 +1 @@ - - - + \ No newline at end of file diff --git a/src/assets/icons/home.svg b/src/assets/icons/home.svg index 56fa80f..f053a17 100644 --- a/src/assets/icons/home.svg +++ b/src/assets/icons/home.svg @@ -1,22 +1 @@ - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/src/assets/icons/settings.svg b/src/assets/icons/settings.svg index 309f959..39e2112 100644 --- a/src/assets/icons/settings.svg +++ b/src/assets/icons/settings.svg @@ -1,3 +1 @@ - - - + \ No newline at end of file diff --git a/src/components/AlbumView/Header.vue b/src/components/AlbumView/Header.vue index 290a151..42f3829 100644 --- a/src/components/AlbumView/Header.vue +++ b/src/components/AlbumView/Header.vue @@ -44,6 +44,22 @@ export default { .a-header { height: 14rem; background: rgb(0, 0, 0); + background: #355c7d; /* fallback for old browsers */ + background: -webkit-linear-gradient( + to right, + #c06c84, + #6c5b7b, + #355c7d + ); /* Chrome 10-25, Safari 5.1-6 */ + background: linear-gradient( + to right, + #c06c84, + #6c5b7b, + #355c7d + ); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ + + background-position: 50% 10%; + display: flex; align-items: center; padding: 0 1rem 0 1rem; diff --git a/src/components/AlbumsExplorer/AlbumList.vue b/src/components/AlbumsExplorer/AlbumList.vue index 7ba7451..a262621 100644 --- a/src/components/AlbumsExplorer/AlbumList.vue +++ b/src/components/AlbumsExplorer/AlbumList.vue @@ -6,6 +6,7 @@
+
export default { - props: ["folders"] + props: ["folders"], }; @@ -66,6 +66,7 @@ export default { background-position: 1rem; background-size: 10% 100%; background-color: rgba(80, 80, 80, 0.247); + transition: all 0.2s ease; .f-item-count { position: absolute; @@ -83,6 +84,11 @@ export default { } .f-container .f-item:hover { - background-color: rgba(0, 0, 0, 0.527); + transition: all 0.2s ease; + background: #000000; /* fallback for old browsers */ + background: no-repeat 8%/100% url(../../assets/icons/folder.svg), + -webkit-linear-gradient(to bottom, #434343, #000000); /* Chrome 10-25, Safari 5.1-6 */ + background: no-repeat 8%/10% url(../../assets/icons/folder.svg), + linear-gradient(to bottom, #434343, #000000); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ } \ No newline at end of file diff --git a/src/components/LeftSidebar/Navigation.vue b/src/components/LeftSidebar/Navigation.vue index 528317b..edd8096 100644 --- a/src/components/LeftSidebar/Navigation.vue +++ b/src/components/LeftSidebar/Navigation.vue @@ -72,8 +72,6 @@ export default { }; - -