Skip to content
This repository was archived by the owner on Nov 23, 2022. It is now read-only.

Commit e106571

Browse files
committed
skipping the creation of long tags
1 parent c8e868b commit e106571

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

readbox/management/commands/autotag.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ def remove_unused_tags(self):
2929
tag.delete()
3030

3131
def get_tag(self, tags, type_, name):
32+
if name[64:]:
33+
print 'Skipping the creation of tag with long name: %r' % (
34+
name)
35+
return
36+
3237
name = name.strip()
3338
tag = tags.get(name)
3439
if not tag:
@@ -71,8 +76,10 @@ def handle_main_directory(self):
7176
match = re.search('\(([a-zA-Z]+ jaar)\)', directory.name)
7277
if match:
7378
tag = self.get_tag(tags, tag_type, match.group(1))
79+
if tag:
80+
self.add_recursive(tag, directory)
81+
7482
print 'Processing year %r: %s' % (directory, directory.path)
75-
self.add_recursive(tag, directory)
7683
self.handle_year_directory(directory)
7784

7885
def handle_year_directory(self, year):
@@ -107,8 +114,8 @@ def handle_year_directory(self, year):
107114
self.handle_sub_directory(directory)
108115

109116
def handle_sub_directory(self, sub_directory):
110-
print 'Processing sub directory %r: %s' % (
111-
sub_directory, sub_directory.path)
117+
print 'Processing sub directory %r: %s' % (sub_directory,
118+
sub_directory.path)
112119

113120
tag_type = self.get_tag_type('Directory')
114121
tags = models.Tag.as_dict()

0 commit comments

Comments
 (0)