summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-01-17 02:52:03 +0100
committerhut <hut@lepus.uberspace.de>2015-01-17 02:52:03 +0100
commit9fc99fb71e505c91ba8bfa5f0cc1175d01c33d05 (patch)
treea48f68c34e032c1f0de6a0fd731296035ca60039
parentd87ab338a45e13128615b5365a50e4cf727ae348 (diff)
downloadranger-9fc99fb71e505c91ba8bfa5f0cc1175d01c33d05.tar.gz
core.metadata: use DefaultOpenStruct instead of OpenStruct
-rw-r--r--ranger/core/metadata.py8
-rw-r--r--ranger/gui/widgets/browsercolumn.py8
2 files changed, 8 insertions, 8 deletions
diff --git a/ranger/core/metadata.py b/ranger/core/metadata.py
index 5b73e9dc..2454ee15 100644
--- a/ranger/core/metadata.py
+++ b/ranger/core/metadata.py
@@ -12,7 +12,7 @@ DEEP_SEARCH_DEFAULT = False
 
 import copy
 from os.path import join, dirname, exists, basename
-from ranger.ext.openstruct import OpenStruct
+from ranger.ext.openstruct import DefaultOpenStruct as ostruct
 
 class MetadataManager(object):
     def __init__(self):
@@ -28,12 +28,12 @@ class MetadataManager(object):
 
     def get_metadata(self, filename):
         try:
-            return OpenStruct(copy.deepcopy(self.metadata_cache[filename]))
+            return ostruct(copy.deepcopy(self.metadata_cache[filename]))
         except KeyError:
             try:
-                return OpenStruct(copy.deepcopy(self._get_entry(filename)))
+                return ostruct(copy.deepcopy(self._get_entry(filename)))
             except KeyError:
-                return OpenStruct()
+                return ostruct()
 
     def set_metadata(self, filename, update_dict):
         import json
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index c8d1023c..00cac553 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -253,7 +253,7 @@ class BrowserColumn(Pager):
             use_linemode = drawn._linemode
             if use_linemode == "metatitle":
                 metadata = self.fm.metadata.get_metadata(drawn.path)
-                if 'title' not in metadata:
+                if not metadata.title:
                     use_linemode = "filename"
 
             metakey = hash(repr(sorted(metadata.items()))) if metadata else 0
@@ -270,8 +270,8 @@ class BrowserColumn(Pager):
 
             # Deal with the line mode
             if use_linemode == "metatitle":
-                assert 'title' in metadata, "Ensure that metadata.title is set!"
-                if 'year' in metadata:
+                assert metadata.title, "Ensure that metadata.title is set!"
+                if metadata.year:
                     text = "%s - %s" % (metadata.year, metadata.title)
                 else:
                     text = metadata.title
@@ -314,7 +314,7 @@ class BrowserColumn(Pager):
             if use_linemode == "filename":
                 infostring = self._draw_infostring_display(drawn, space)
             elif use_linemode == "metatitle":
-                if metadata and 'authors' in metadata:
+                if metadata.authors:
                     authorstring = metadata.authors
                     if ',' in authorstring:
                         authorstring = authorstring[0:authorstring.find(",")]