Make sure to set default title on refresh. fix #1436
This commit is contained in:
@@ -38,7 +38,8 @@ class LibraryPlugin(Plugin):
|
|||||||
|
|
||||||
title = LibraryTitle(
|
title = LibraryTitle(
|
||||||
title = toUnicode(attrs.get('title')),
|
title = toUnicode(attrs.get('title')),
|
||||||
simple_title = self.simplifyTitle(attrs.get('title'))
|
simple_title = self.simplifyTitle(attrs.get('title')),
|
||||||
|
default = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
l.titles.append(title)
|
l.titles.append(title)
|
||||||
@@ -96,6 +97,7 @@ class LibraryPlugin(Plugin):
|
|||||||
|
|
||||||
titles = info.get('titles', [])
|
titles = info.get('titles', [])
|
||||||
log.debug('Adding titles: %s', titles)
|
log.debug('Adding titles: %s', titles)
|
||||||
|
counter = 0
|
||||||
for title in titles:
|
for title in titles:
|
||||||
if not title:
|
if not title:
|
||||||
continue
|
continue
|
||||||
@@ -103,9 +105,10 @@ class LibraryPlugin(Plugin):
|
|||||||
t = LibraryTitle(
|
t = LibraryTitle(
|
||||||
title = title,
|
title = title,
|
||||||
simple_title = self.simplifyTitle(title),
|
simple_title = self.simplifyTitle(title),
|
||||||
default = title.lower() == toUnicode(default_title.lower()) or (toUnicode(default_title) == u'' and toUnicode(titles[0]) == title)
|
default = (len(default_title) == 0 and counter == 0) or len(titles) == 1 or title.lower() == toUnicode(default_title.lower()) or (toUnicode(default_title) == u'' and toUnicode(titles[0]) == title)
|
||||||
)
|
)
|
||||||
library.titles.append(t)
|
library.titles.append(t)
|
||||||
|
counter += 1
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user