requirements
authormarcelveldt <marcelvanderveldt@MacBook-Pro.local>
Thu, 9 May 2019 08:29:01 +0000 (10:29 +0200)
committermarcelveldt <marcelvanderveldt@MacBook-Pro.local>
Thu, 9 May 2019 08:29:01 +0000 (10:29 +0200)
Dockerfile
music_assistant/cache.py
music_assistant/database.py
music_assistant/main.py
music_assistant/modules/playerproviders/lms.py
music_assistant/music.py
requirements.txt

index 596a04c6f078fdca02d86b17dd757f0ea840189b..a72525f2c0f432b1d1f5eeedf5793a876ae56022 100755 (executable)
@@ -8,7 +8,7 @@ RUN mkdir -p /usr/src/app
 WORKDIR /usr/src/app
 COPY music_assistant /usr/src/app
 RUN chmod a+x /usr/src/app/main.py
-RUN pip install --upgrade requirements.txt
+RUN pip install --upgrade -r requirements.txt
 
 VOLUME ["/data"]
 
index 16cdc398bb17916960a4fad7bd035a5bf430ab4c..85945daae35ca9499760038467fe866d1153e395 100644 (file)
@@ -20,8 +20,9 @@ class Cache(object):
     _busy_tasks = []
     _database = None
 
-    def __init__(self):
+    def __init__(self, datapath):
         '''Initialize our caching class'''
+        self._datapath = datapath
         asyncio.ensure_future(self._do_cleanup())
         LOGGER.debug("Initialized")
 
@@ -132,7 +133,7 @@ class Cache(object):
 
     def _get_database(self):
         '''get reference to our sqllite _database - performs basic integrity check'''
-        dbfile = "/tmp/simplecache.db"
+        dbfile = os.path.join(self._datapath, "simplecache.db")
         try:
             connection = sqlite3.connect(dbfile, timeout=30, isolation_level=None)
             connection.execute('SELECT * FROM simplecache LIMIT 1')
index 7e9e92b4c7c4a2c7335fb4b84daa2b64b0cf7ed5..302137a3d2ba4c17c3406434cffe9fa8214a26bd 100755 (executable)
@@ -8,13 +8,11 @@ from models import MediaType, Artist, Album, Track, Playlist
 from typing import List
 import aiosqlite
 
-DBFILE = os.path.join(os.path.dirname(os.path.abspath(__file__)),"database.db")
-
 class Database():
 
-    def __init__(self, event_loop, dbfile=DBFILE):
+    def __init__(self, datapath, event_loop):
         self.event_loop = event_loop
-        self.dbfile = dbfile
+        self.dbfile = os.path.join(datapath, "database.db")
         self.db_ready = False
         event_loop.run_until_complete(self.__init_database())
 
index c0af4037484531e79026153c25eea1db89a5d056..63ef2e356f137368098bdca0f4e664fb78c64c80 100755 (executable)
@@ -37,11 +37,11 @@ class Main():
         signal.signal(signal.SIGTERM, self.stop)
 
         # init database and metadata modules
-        self.db = Database(self.event_loop)
+        self.db = Database(datapath, self.event_loop)
         # allow some time for the database to initialize
         while not self.db.db_ready:
             time.sleep(0.5) 
-        self.cache = Cache()
+        self.cache = Cache(datapath)
         self.metadata = MetaData(self.event_loop, self.db, self.cache)
         self.music = Music(self)
         self.player = Player(self)
index 6df0fc056642bb7917f2c86bce41302f8b3636e8..16c977f30b3d7fb3f247927b841f24adde3967ba 100644 (file)
@@ -33,7 +33,7 @@ def setup(mass):
 def config_entries():
     ''' get the config entries for this provider (list with key/value pairs)'''
     return [
-        (CONF_ENABLED, True, CONF_ENABLED),
+        (CONF_ENABLED, False, CONF_ENABLED),
         (CONF_HOSTNAME, 'localhost', CONF_HOSTNAME), 
         (CONF_PORT, 9000, CONF_PORT)
         ]
index e3bb4a3594e44bfee132b1331c9854eb467984d9..73a980c621cdceba21203aec670b4d136fbec30a 100755 (executable)
@@ -154,6 +154,8 @@ class Music():
             prov_item_id = prov_mapping['item_id']
             prov_obj = self.providers[prov_id]
             items += await prov_obj.album_tracks(prov_item_id)
+            if items:
+                break # no need to pull in dups
         items = list(toolz.unique(items, key=operator.attrgetter('item_id')))
         return items
 
@@ -166,6 +168,8 @@ class Music():
             prov_item_id = prov_mapping['item_id']
             prov_obj = self.providers[prov_id]
             items += await prov_obj.playlist_tracks(prov_item_id, offset=offset, limit=limit)
+            if items:
+                break
         items = list(toolz.unique(items, key=operator.attrgetter('item_id')))
         return items
 
index 6eb48e834fa28c5c5732e960064363fa47b45428..05009d90bcabe722b9e2bd324b465202472436de 100644 (file)
@@ -5,4 +5,6 @@ pychromecast
 uvloop
 slugify
 asyncio_throttle
-aiocometd
\ No newline at end of file
+aiocometd
+aiosqlite
+pytaglib
\ No newline at end of file