mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
client: improve quick access
- default to opened sidebar
This commit is contained in:
+2
-15
@@ -7,19 +7,6 @@ class Mongo:
|
||||
mongo_uri = pymongo.MongoClient()
|
||||
self.db = mongo_uri[database]
|
||||
|
||||
|
||||
class Folders(Mongo):
|
||||
def __init__(self):
|
||||
super(Folders, self).__init__('LOCAL_FOLDERS')
|
||||
self.collection = self.db['LOCAL_FOLDERS']
|
||||
|
||||
def insert_folder(self, folder):
|
||||
self.collection.insert_one(folder)
|
||||
|
||||
def find_folder(self, folder_id):
|
||||
return self.collection.find_one({'_id': ObjectId(folder_id)})
|
||||
|
||||
|
||||
class Artists(Mongo):
|
||||
def __init__(self):
|
||||
super(Artists, self).__init__('ALL_ARTISTS')
|
||||
@@ -34,8 +21,8 @@ class Artists(Mongo):
|
||||
def get_artist_by_id(self, artist_id):
|
||||
return self.collection.find_one({'_id': ObjectId(artist_id)})
|
||||
|
||||
def find_artists_by_name(self, query):
|
||||
return self.collection.find({'name': {'$regex': query, '$options': 'i'}})
|
||||
def get_artists_by_name(self, query):
|
||||
return self.collection.find({'name': query}).limit(20)
|
||||
|
||||
|
||||
class AllSongs(Mongo):
|
||||
|
||||
Reference in New Issue
Block a user