Skip to content

Commit

Permalink
ehentai metadata plugin v1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyingren committed Oct 16, 2017
1 parent 296ad56 commit e90657f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,4 @@ calibre
example/
.project
.pydevproject
tmp/
14 changes: 8 additions & 6 deletions ehentai_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import json
from urllib import urlencode

def to_metadata(log,gmetadata): # {{{
def to_metadata(log,gmetadata,ExHentai_Status): # {{{
title = gmetadata['title']
title_jpn = gmetadata['title_jpn']
tags = gmetadata['tags']
Expand Down Expand Up @@ -43,7 +43,7 @@ def to_metadata(log,gmetadata): # {{{
authors = [(author)]

mi = Metadata(title_, authors)
mi.identifiers = {'ehentai':'%s_%s' % (str(gid),str(token))}
mi.identifiers = {'ehentai':'%s_%s_%d' % (str(gid),str(token),int(ExHentai_Status))}

# publisher
pat2 = re.compile(r'^\(([^\[\]\(\)]*)\)')
Expand Down Expand Up @@ -88,7 +88,7 @@ class Ehentai(Source):

name = 'E-hentai Galleries'
author = 'Wu yuan'
version = (1,1,0)
version = (1,1,1)
minimum_calibre_version = (2, 80, 0)

description = _('Download metadata and cover from e-hentai.org.'
Expand Down Expand Up @@ -195,7 +195,7 @@ def get_all_details(self,gidlist,log,abort,result_queue,timeout): # {{{
gmetadatas = json.loads(raw)['gmetadata']
for relevance, gmetadata in enumerate(gmetadatas):
try:
ans = to_metadata(log, gmetadata)
ans = to_metadata(log, gmetadata,self.ExHentai_Status)
if isinstance(ans, Metadata):
ans.source_relevance = relevance
db = ans.identifiers['ehentai']
Expand All @@ -212,9 +212,11 @@ def get_all_details(self,gidlist,log,abort,result_queue,timeout): # {{{
def get_book_url(self, identifiers): # {{{

db = identifiers.get('ehentai',None)
d = {'0':False,'1':True}
if db is not None:
gid,token = re.split('_', db)
if self.ExHentai_Status is True:
gid,token,s = re.split('_', db)
ExHentai_Status = d[str(s)]
if ExHentai_Status:
url = self.ExHentai_url % (gid,token)
else:
url = self.EHentai_url % (gid,token)
Expand Down

0 comments on commit e90657f

Please sign in to comment.