diff options
author | Eric Wong <e@80x24.org> | 2015-12-16 10:30:07 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-12-16 10:31:50 +0000 |
commit | 27d50ef044ab66d77abdb9f5b94d7c568dad035f (patch) | |
tree | 949d7672ff2181faef9209ae5182ae051159d955 /lib/dtas | |
parent | 564745e3f2a6fa427414009b8eec74b6ed06ed8f (diff) | |
download | dtas-27d50ef044ab66d77abdb9f5b94d7c568dad035f.tar.gz |
Not in any way a stable interface, yet, and still incomplete. This should emulate parts of the mpd protocol which should make it easier to debug and develop.
Diffstat (limited to 'lib/dtas')
-rw-r--r-- | lib/dtas/mlib.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/dtas/mlib.rb b/lib/dtas/mlib.rb index b81ec54..0d2f70c 100644 --- a/lib/dtas/mlib.rb +++ b/lib/dtas/mlib.rb @@ -212,6 +212,7 @@ class DTAS::Mlib # :nodoc: q = { parent_id: 1, # self name: '', + dirname: '', } node = @db[:nodes][q] and return (@root_node = node) begin @@ -378,10 +379,10 @@ class DTAS::Mlib # :nodoc: def path_of(node, cache) base = node[:name] - return '/' if base == '' + return '/' if base == '' # root_node parent_id = node[:parent_id] base += '/' unless node[:tlen] >= 0 - ppath = cache[parent_id] and return "#{ppath}#{base}" + ppath = cache[parent_id] and return "#{ppath}/#{base}" parts = [] begin node = @db[:nodes][id: node[:parent_id]] @@ -389,8 +390,9 @@ class DTAS::Mlib # :nodoc: parts.unshift node[:name] end while true parts.unshift('') - parts << base cache[parent_id] = parts.join('/') + parts << base + parts.join('/') end def emit_recurse(node, cache, cb) |