Added option and code for assume that a lone writer or artist credit from CV is a 'primary'
git-svn-id: http://comictagger.googlecode.com/svn/trunk@205 6c5673fe-1810-88d6-992b-cd32ca31540c
This commit is contained in:
parent
9ccdc60c19
commit
c845c786e4
@ -176,7 +176,7 @@ class ComicVineTalker(QObject):
|
||||
return volume_results
|
||||
|
||||
|
||||
def fetchIssueData( self, series_id, issue_number ):
|
||||
def fetchIssueData( self, series_id, issue_number, assumeLoneCreditIsPrimary = False ):
|
||||
|
||||
volume_results = self.fetchVolumeData( series_id )
|
||||
|
||||
@ -225,6 +225,31 @@ class ComicVineTalker(QObject):
|
||||
# can we determine 'primary' from CV??
|
||||
role_name = role['role'].title()
|
||||
metadata.addCredit( person['name'], role['role'].title(), False )
|
||||
|
||||
assumeLoneCreditIsPrimary = True
|
||||
if assumeLoneCreditIsPrimary:
|
||||
def setLonePrimary( role ):
|
||||
lone_credit = None
|
||||
count = 0
|
||||
for c in metadata.credits:
|
||||
if c['role'].lower() == role:
|
||||
count += 1
|
||||
lone_credit = c
|
||||
if count > 1:
|
||||
lone_credit = None
|
||||
break
|
||||
if lone_credit is not None:
|
||||
lone_credit['primary'] = True
|
||||
return lone_credit
|
||||
|
||||
#need to loop three times, once for 'writer', 'artist', and then 'penciler' if no artist
|
||||
setLonePrimary( 'writer' )
|
||||
if setLonePrimary( 'artist' ) is None:
|
||||
c = setLonePrimary( 'penciler' )
|
||||
if c is not None:
|
||||
c['primary'] = False
|
||||
metadata.addCredit( c['person'], 'Artist', True )
|
||||
|
||||
|
||||
character_credits = issue_results['character_credits']
|
||||
character_list = list()
|
||||
|
15
settings.py
15
settings.py
@ -65,6 +65,9 @@ class ComicTaggerSettings:
|
||||
# Show/ask dialog flags
|
||||
self.ask_about_cbi_in_rar = True
|
||||
self.show_disclaimer = True
|
||||
|
||||
# Comic Vine settings
|
||||
self.assumeLoneCreditIsPrimary = False
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@ -142,6 +145,10 @@ class ComicTaggerSettings:
|
||||
self.ask_about_cbi_in_rar = self.config.getboolean( 'dialogflags', 'ask_about_cbi_in_rar' )
|
||||
if self.config.has_option('dialogflags', 'show_disclaimer'):
|
||||
self.show_disclaimer = self.config.getboolean( 'dialogflags', 'show_disclaimer' )
|
||||
|
||||
if self.config.has_option('comicvine', 'assumeLoneCreditIsPrimary'):
|
||||
self.ask_about_cbi_in_rar = self.config.getboolean( 'comicvine', 'assumeLoneCreditIsPrimary' )
|
||||
|
||||
|
||||
def save( self ):
|
||||
|
||||
@ -173,8 +180,14 @@ class ComicTaggerSettings:
|
||||
self.config.set( 'dialogflags', 'ask_about_cbi_in_rar', self.ask_about_cbi_in_rar )
|
||||
self.config.set( 'dialogflags', 'show_disclaimer', self.show_disclaimer )
|
||||
|
||||
if not self.config.has_section( 'comicvine' ):
|
||||
self.config.add_section( 'comicvine' )
|
||||
|
||||
self.config.set( 'comicvine', 'assumeLoneCreditIsPrimary', self.assumeLoneCreditIsPrimary )
|
||||
|
||||
|
||||
with open( self.settings_file, 'wb') as configfile:
|
||||
self.config.write(configfile)
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user