commit 2ac3398bdb90be3ffb34eb0f944ce16f7aa87678
parent d1e2fd226809735f59baff7bad4353f617588773
Author: nolash <dev@holbrook.no>
Date:   Fri,  3 Jul 2020 22:07:16 +0200
Fix missed path problems
Diffstat:
7 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
@@ -1,3 +1,6 @@
+* 0.4.0
+	- Consolidate put and get methods on same adapter interface
+	- Resolve uncompressed path bug 
 * 0.3.0 
 	- Add gzip option for entries
 * 0.2.2
diff --git a/VERSION b/VERSION
@@ -1 +1 @@
-0.3.0
+0.4.0
diff --git a/feedwarrior/adapters/fileadapter.py b/feedwarrior/adapters/fileadapter.py
@@ -12,6 +12,7 @@ class fileadapter:
             os.mkdir(os.path.join(db_directory, 'feeds'))
         except FileExistsError:
             pass
+
         try:
             os.mkdir(os.path.join(db_directory, 'feeds', str(uu)))
         except FileExistsError:
@@ -21,12 +22,18 @@ class fileadapter:
             os.mkdir(os.path.join(db_directory, 'entries'))
         except FileExistsError:
             pass
+
+        try:
+            os.mkdir(os.path.join(db_directory,  'feeds', str(uu), 'entries'))
+        except FileExistsError:
+            pass
+
         self.src = db_directory
         self.feeds_uuid = uu
 
 
     def get(self, uu):
-        entry_path = os.path.join(self.src, str(uu))
+        entry_path = os.path.join(self.src, 'entries', str(uu))
         f = None
         if entry_path[len(entry_path)-3:] == '.gz':
             logg.debug('uncompressing {}'.format(entry_path))
diff --git a/feedwarrior/cmd/entry.py b/feedwarrior/cmd/entry.py
@@ -37,7 +37,7 @@ def execute(config, feed, args):
     uu = str(entry.uuid)
     logg.debug('adding entry {}'.format(uu))
     
-    fa = fileadapter(config.feeds_dir, feed.uuid)
+    fa = fileadapter(config.data_dir, feed.uuid)
 
     entry_json = json.dumps(entry_serialized)
     fa.put(entry.uuid, entry_json.encode('utf-8'), args.z)
diff --git a/feedwarrior/feed.py b/feedwarrior/feed.py
@@ -106,7 +106,8 @@ class feed:
 
 # TODO: add input checking for timestamps
 # TODO: check state of symlink index
-def load(path):
+def load(data_dir, uu):
+    path = os.path.join(data_dir, 'feeds', str(uu))
     feed_meta_path = os.path.join(path, '.log')
     f = open(feed_meta_path, 'r')
     o = json.load(f)
@@ -122,7 +123,7 @@ def load(path):
     for entry in os.listdir(feed_entries_path):
         feed_loaded.entries.append(entry)
 
-    fg = fileadapter(os.path.join(path, 'entries'), uu)
+    fg = fileadapter(data_dir, uu)
     feed_loaded.set_getter(fg)
 
     return feed_loaded
diff --git a/scripts/feedwarrior b/scripts/feedwarrior
@@ -77,7 +77,7 @@ elif args.command == 'show' or args.command == None:
     if feed_current == None:
         sys.stderr.write('plesae speficy a feed for showing\n')
         sys.exit(1)
-    feed_current = feedwarrior.load_feed(os.path.join(config.feeds_dir, str(feed_current.uuid)))
+    feed_current = feedwarrior.load_feed(config.data_dir, feed_current.uuid)
     cmd_mod = cmd_show
 else:
     sys.stderr.write('invalid command {}\n'.format(args.command))
diff --git a/setup.py b/setup.py
@@ -2,7 +2,7 @@ from setuptools import setup
 
 setup(
     name='feedwarrior',
-    version='0.3.0',
+    version='0.4.0',
     description='feeds, warrior style',
     author='Louis Holbrook',
     author_email='dev@holbrook.no',