From: W. Trevor King Date: Sun, 18 Jul 2010 17:26:33 +0000 (-0400) Subject: Use .html instead of .dat so the iframe can display the files X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d36270de1f4b2c093eb131dac2440fcf708d6036;p=dirtag.git Use .html instead of .dat so the iframe can display the files --- diff --git a/README b/README index cc10340..323d9d2 100644 --- a/README +++ b/README @@ -10,34 +10,34 @@ For example, with a raw directory like this:: raw |-- a - | |-- a1.dat - | |-- a2.dat - | `-- a3.dat + | |-- a1.html + | |-- a2.html + | `-- a3.html `-- b - |-- b1.dat - |-- b2.dat - `-- b3.dat + |-- b1.html + |-- b2.html + `-- b3.html You could create a tag directory like this:: tag/ |-- 1 - | |-- a1.dat -> ../../raw/a/a1.dat - | `-- b1.dat -> ../../raw/b/b1.dat + | |-- a1.html -> ../../raw/a/a1.html + | `-- b1.html -> ../../raw/b/b1.html `-- x - |-- a2.dat -> ../../raw/a/a2.dat - |-- b3.dat -> ../../raw/b/b3.dat + |-- a2.html -> ../../raw/a/a2.html + |-- b3.html -> ../../raw/b/b3.html `-- y - `-- b1.dat -> ../../../raw/b/b1.dat + `-- b1.html -> ../../../raw/b/b1.html Corresponding to the following tags:: - a1.dat 1 - a2.dat x - a3.dat - b1.dat 1, x/y - b2.dat - b3.dat x + a1.html 1 + a2.html x + a3.html + b1.html 1, x/y + b2.html + b3.html x Then you could play all your x/y music with:: diff --git a/dirtag/__init__.py b/dirtag/__init__.py index 2270104..fb24f31 100644 --- a/dirtag/__init__.py +++ b/dirtag/__init__.py @@ -82,19 +82,19 @@ def dir_tree(root_dir): >>> t = dir_tree('test/tag') >>> print '\\n'.join(['|'.join(x) for x in t.traverse(depth=1)]) 1 - 1|a1.dat - 1|b1.dat + 1|a1.html + 1|b1.html x x|y - x|y|b1.dat - x|a2.dat - x|b3.dat + x|y|b1.html + x|a2.html + x|b3.html >>> print '\\n'.join(['|'.join(x) for x in t.traverse(depth=1, type='files')]) - 1|a1.dat - 1|b1.dat - x|y|b1.dat - x|a2.dat - x|b3.dat + 1|a1.html + 1|b1.html + x|y|b1.html + x|a2.html + x|b3.html >>> print '\\n'.join(['|'.join(x) for x in t.traverse(depth=1, type='dirs')]) 1 x @@ -125,36 +125,36 @@ class Dirtag (object): ... for x in d.elements()] ... ) # doctest: +NORMALIZE_WHITESPACE dir test/raw a - file test/raw a|a1.dat 1 - file test/raw a|a2.dat x - file test/raw a|a3.dat + file test/raw a|a1.html 1 + file test/raw a|a2.html x + file test/raw a|a3.html dir test/raw b - file test/raw b|b1.dat 1,x/y - file test/raw b|b2.dat - file test/raw b|b3.dat x + file test/raw b|b1.html 1,x/y + file test/raw b|b2.html + file test/raw b|b3.html x >>> print '\\n'.join(['|'.join(x) for x in d.elements(['x'])]) x|y - x|y|b1.dat - x|a2.dat - x|b3.dat - >>> print '\\n'.join(['|'.join(x) for x in d.tags(['b', 'b2.dat'])]) + x|y|b1.html + x|a2.html + x|b3.html + >>> print '\\n'.join(['|'.join(x) for x in d.tags(['b', 'b2.html'])]) - >>> print '\\n'.join(['|'.join(x) for x in d.tags(['b', 'b1.dat'])]) + >>> print '\\n'.join(['|'.join(x) for x in d.tags(['b', 'b1.html'])]) 1 x|y - >>> print d.tag_path(['a', 'a3.dat'], ['x', 'y']) - test/tag/x/y/a3.dat + >>> print d.tag_path(['a', 'a3.html'], ['x', 'y']) + test/tag/x/y/a3.html >>> os.listdir('test/tag/x/y') - ['b1.dat'] - >>> d.add_tag(['a', 'a3.dat'], ['x', 'y']) + ['b1.html'] + >>> d.add_tag(['a', 'a3.html'], ['x', 'y']) >>> os.listdir('test/tag/x/y') - ['a3.dat', 'b1.dat'] - >>> print 'Z'+os.path.realpath('test/tag/x/y/a3.dat') # doctest: +ELLIPSIS - Z.../test/raw/a/a3.dat - >>> d.remove_tag(['a', 'a3.dat'], ['x', 'y']) + ['a3.html', 'b1.html'] + >>> print 'Z'+os.path.realpath('test/tag/x/y/a3.html') # doctest: +ELLIPSIS + Z.../test/raw/a/a3.html + >>> d.remove_tag(['a', 'a3.html'], ['x', 'y']) >>> os.listdir('test/tag/x/y') - ['b1.dat'] + ['b1.html'] """ def __init__(self, raw_dir, tag_dir): self.raw_dir = raw_dir