trying to divide formats into 'DRM' and 'DRM-free' groups

This commit is contained in:
Tomasz Długosz 2012-03-22 23:23:40 +01:00
parent 6d55cf1e42
commit be268d092f

View File

@ -74,15 +74,23 @@ class WoblinkStore(BasicStoreConfig, StorePlugin):
if 'pdf' in formats: if 'pdf' in formats:
formats[formats.index('pdf')] = 'PDF' formats[formats.index('pdf')] = 'PDF'
counter -= 1
s = SearchResult() s = SearchResult()
s.cover_url = 'http://woblink.com' + cover_url s.cover_url = 'http://woblink.com' + cover_url
s.title = title.strip() s.title = title.strip()
s.author = author.strip() s.author = author.strip()
s.price = price + '' s.price = price + ''
s.detail_item = id.strip() s.detail_item = id.strip()
s.drm = SearchResult.DRM_UNKNOWN if 'MOBI' in formats else SearchResult.DRM_LOCKED # MOBI should be send first,
s.formats = ', '.join(formats) if 'MOBI' in formats:
s.drm = SearchResult.DRM_UNLOCKED
s.formats = 'MOBI'
formats.remove('MOBI')
counter -= 1
yield s
# and the remaining formats (if any) next
if formats:
s.drm = SearchResult.DRM_LOCKED
s.formats = ', '.join(formats)
counter -= 1
yield s yield s