2012-09-13 15:27:34 +00:00
# This file is part of Mylar.
#
# Mylar is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
# Mylar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
2012-09-13 15:27:34 +00:00
#
# You should have received a copy of the GNU General Public License
# along with Mylar. If not, see <http://www.gnu.org/licenses/>.
import sys
import os
2013-03-11 17:25:45 +00:00
import re
2012-09-13 15:27:34 +00:00
import logger
import string
import urllib
import lib . feedparser
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
import mylar
FIX: (#746) updated autoProcessComics.py / ComicRN.py's which will now send proper completion messeages to clients, FIX: (#752) refresh series will now test if a series is 'out of whack' with it's numerical issue count (ie. 5/4) or it has no issue data due to a bad refresh / api maxing out and will adjust it's processing to accomodate either, IMP: (#750) Added ComicVine API Checker which will check API counts at regular intervals to inform/warn users of usage, as well as adding a screen-time display of API hits / mins used at the bottom of every page (refreshing/reloading pages will update counts), FIX: (#747)EOL normalization (dos2unix) on search.py - removed classes & exceptions as not being used, IMP: (#747) Skip processing issues with an invalid store date & issue date (thnx rupaschomaker), FIX: Removed strings when searching/logging torrents as was causing ascii errors especially with KAT, IMP: Added [META-TAGGING] to logging for meta-tagging module, IMP: Added ability in GUI to select CR or Cbl tags (or both) when writing metadata to cbz files, IMP: Improved support/usage with ComicTagger v1.1.15 which allows for personal CV API Key usage - if supplied to Mylar, will use when tagging with ComicTagger, IMP: Added Manual Search option to allow for individual searches of issues without changing initial status.
2014-06-18 19:58:19 +00:00
from mylar . helpers import cvapi_check
2012-09-13 15:27:34 +00:00
from bs4 import BeautifulSoup as Soup
2013-04-08 16:31:41 +00:00
def pulldetails ( comicid , type , issueid = None , offset = 1 ) :
2013-04-07 18:06:36 +00:00
import urllib2
#import easy to use xml parser called minidom:
from xml . dom . minidom import parseString
2014-06-09 08:03:10 +00:00
if mylar . COMICVINE_API == ' None ' or mylar . COMICVINE_API is None or mylar . COMICVINE_API == mylar . DEFAULT_CVAPI :
2014-06-09 07:55:05 +00:00
logger . warn ( ' You have not specified your own ComicVine API key - alot of things will be limited. Get your own @ http://api.comicvine.com. ' )
comicapi = mylar . DEFAULT_CVAPI
else :
comicapi = mylar . COMICVINE_API
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
if type == ' comic ' :
2014-02-26 19:48:50 +00:00
if not comicid . startswith ( ' 4050- ' ) : comicid = ' 4050- ' + comicid
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
PULLURL = mylar . CVURL + ' volume/ ' + str ( comicid ) + ' /?api_key= ' + str ( comicapi ) + ' &format=xml&field_list=name,count_of_issues,issues,start_year,site_detail_url,image,publisher,description,first_issue,deck,aliases '
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
elif type == ' issue ' :
if mylar . CV_ONLY :
cv_type = ' issues '
2013-04-08 16:31:41 +00:00
searchset = ' filter=volume: ' + str ( comicid ) + ' &field_list=cover_date,description,id,image,issue_number,name,date_last_updated,store_date '
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
else :
cv_type = ' volume/ ' + str ( comicid )
2014-02-26 19:48:50 +00:00
searchset = ' name,count_of_issues,issues,start_year,site_detail_url,image,publisher,description,store_date '
2013-05-01 18:13:07 +00:00
PULLURL = mylar . CVURL + str ( cv_type ) + ' /?api_key= ' + str ( comicapi ) + ' &format=xml& ' + str ( searchset ) + ' &offset= ' + str ( offset )
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
elif type == ' firstissue ' :
#this is used ONLY for CV_ONLY
2013-05-01 18:13:07 +00:00
PULLURL = mylar . CVURL + ' issues/?api_key= ' + str ( comicapi ) + ' &format=xml&filter=id: ' + str ( issueid ) + ' &field_list=cover_date '
elif type == ' storyarc ' :
PULLURL = mylar . CVURL + ' story_arc/?api_key= ' + str ( comicapi ) + ' &format=xml&filter=id: ' + str ( issueid ) + ' &field_list=cover_date '
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
FIX: (#746) updated autoProcessComics.py / ComicRN.py's which will now send proper completion messeages to clients, FIX: (#752) refresh series will now test if a series is 'out of whack' with it's numerical issue count (ie. 5/4) or it has no issue data due to a bad refresh / api maxing out and will adjust it's processing to accomodate either, IMP: (#750) Added ComicVine API Checker which will check API counts at regular intervals to inform/warn users of usage, as well as adding a screen-time display of API hits / mins used at the bottom of every page (refreshing/reloading pages will update counts), FIX: (#747)EOL normalization (dos2unix) on search.py - removed classes & exceptions as not being used, IMP: (#747) Skip processing issues with an invalid store date & issue date (thnx rupaschomaker), FIX: Removed strings when searching/logging torrents as was causing ascii errors especially with KAT, IMP: Added [META-TAGGING] to logging for meta-tagging module, IMP: Added ability in GUI to select CR or Cbl tags (or both) when writing metadata to cbz files, IMP: Improved support/usage with ComicTagger v1.1.15 which allows for personal CV API Key usage - if supplied to Mylar, will use when tagging with ComicTagger, IMP: Added Manual Search option to allow for individual searches of issues without changing initial status.
2014-06-18 19:58:19 +00:00
#CV API Check here.
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
if mylar . CVAPI_COUNT == 0 or mylar . CVAPI_COUNT > = mylar . CVAPI_MAX :
FIX: (#746) updated autoProcessComics.py / ComicRN.py's which will now send proper completion messeages to clients, FIX: (#752) refresh series will now test if a series is 'out of whack' with it's numerical issue count (ie. 5/4) or it has no issue data due to a bad refresh / api maxing out and will adjust it's processing to accomodate either, IMP: (#750) Added ComicVine API Checker which will check API counts at regular intervals to inform/warn users of usage, as well as adding a screen-time display of API hits / mins used at the bottom of every page (refreshing/reloading pages will update counts), FIX: (#747)EOL normalization (dos2unix) on search.py - removed classes & exceptions as not being used, IMP: (#747) Skip processing issues with an invalid store date & issue date (thnx rupaschomaker), FIX: Removed strings when searching/logging torrents as was causing ascii errors especially with KAT, IMP: Added [META-TAGGING] to logging for meta-tagging module, IMP: Added ability in GUI to select CR or Cbl tags (or both) when writing metadata to cbz files, IMP: Improved support/usage with ComicTagger v1.1.15 which allows for personal CV API Key usage - if supplied to Mylar, will use when tagging with ComicTagger, IMP: Added Manual Search option to allow for individual searches of issues without changing initial status.
2014-06-18 19:58:19 +00:00
cvapi_check ( )
2012-09-13 15:27:34 +00:00
#download the file:
file = urllib2 . urlopen ( PULLURL )
FIX: (#746) updated autoProcessComics.py / ComicRN.py's which will now send proper completion messeages to clients, FIX: (#752) refresh series will now test if a series is 'out of whack' with it's numerical issue count (ie. 5/4) or it has no issue data due to a bad refresh / api maxing out and will adjust it's processing to accomodate either, IMP: (#750) Added ComicVine API Checker which will check API counts at regular intervals to inform/warn users of usage, as well as adding a screen-time display of API hits / mins used at the bottom of every page (refreshing/reloading pages will update counts), FIX: (#747)EOL normalization (dos2unix) on search.py - removed classes & exceptions as not being used, IMP: (#747) Skip processing issues with an invalid store date & issue date (thnx rupaschomaker), FIX: Removed strings when searching/logging torrents as was causing ascii errors especially with KAT, IMP: Added [META-TAGGING] to logging for meta-tagging module, IMP: Added ability in GUI to select CR or Cbl tags (or both) when writing metadata to cbz files, IMP: Improved support/usage with ComicTagger v1.1.15 which allows for personal CV API Key usage - if supplied to Mylar, will use when tagging with ComicTagger, IMP: Added Manual Search option to allow for individual searches of issues without changing initial status.
2014-06-18 19:58:19 +00:00
#increment CV API counter.
mylar . CVAPI_COUNT + = 1
2012-09-13 15:27:34 +00:00
#convert to string:
data = file . read ( )
#close file because we dont need it anymore:
file . close ( )
#parse the xml you downloaded
dom = parseString ( data )
2013-04-07 18:06:36 +00:00
return dom
def getComic ( comicid , type , issueid = None ) :
if type == ' issue ' :
2013-04-08 16:31:41 +00:00
offset = 1
2013-04-07 18:06:36 +00:00
issue = { }
2013-04-08 16:31:41 +00:00
ndic = [ ]
issuechoice = [ ]
2013-04-07 18:06:36 +00:00
comicResults = [ ]
2013-04-08 16:31:41 +00:00
firstdate = ' 2099-00-00 '
2013-04-07 18:06:36 +00:00
#let's find out how many results we get from the query...
2013-04-07 19:18:26 +00:00
searched = pulldetails ( comicid , ' issue ' , None , 0 )
2013-04-07 18:06:36 +00:00
if searched is None : return False
totalResults = searched . getElementsByTagName ( ' number_of_total_results ' ) [ 0 ] . firstChild . wholeText
logger . fdebug ( " there are " + str ( totalResults ) + " search results... " )
if not totalResults :
return False
countResults = 0
while ( countResults < int ( totalResults ) ) :
logger . fdebug ( " querying " + str ( countResults ) )
if countResults > 0 :
#new api - have to change to page # instead of offset count
offsetcount = countResults
searched = pulldetails ( comicid , ' issue ' , None , offsetcount )
2013-04-08 16:31:41 +00:00
issuechoice , tmpdate = GetIssuesInfo ( comicid , searched )
if tmpdate < firstdate :
firstdate = tmpdate
ndic = ndic + issuechoice
2013-04-07 18:06:36 +00:00
#search results are limited to 100 and by pagination now...let's account for this.
countResults = countResults + 100
2013-04-08 16:31:41 +00:00
issue [ ' issuechoice ' ] = ndic
issue [ ' firstdate ' ] = firstdate
2013-04-07 18:06:36 +00:00
return issue
elif type == ' comic ' :
2013-04-08 16:31:41 +00:00
dom = pulldetails ( comicid , ' comic ' , None , 1 )
2013-04-07 18:06:36 +00:00
return GetComicInfo ( comicid , dom )
elif type == ' firstissue ' :
2013-04-08 16:31:41 +00:00
dom = pulldetails ( comicid , ' firstissue ' , issueid , 1 )
2013-04-07 18:06:36 +00:00
return GetFirstIssue ( issueid , dom )
2012-09-13 15:27:34 +00:00
def GetComicInfo ( comicid , dom ) :
2012-09-24 05:17:29 +00:00
2012-09-13 15:27:34 +00:00
#comicvine isn't as up-to-date with issue counts..
#so this can get really buggered, really fast.
2012-09-24 05:17:29 +00:00
tracks = dom . getElementsByTagName ( ' issue ' )
2012-10-30 10:43:01 +00:00
try :
cntit = dom . getElementsByTagName ( ' count_of_issues ' ) [ 0 ] . firstChild . wholeText
except :
cntit = len ( tracks )
2012-09-13 15:27:34 +00:00
trackcnt = len ( tracks )
2013-01-03 18:26:39 +00:00
logger . fdebug ( " number of issues I counted: " + str ( trackcnt ) )
logger . fdebug ( " number of issues CV says it has: " + str ( cntit ) )
2012-09-24 05:17:29 +00:00
# if the two don't match, use trackcnt as count_of_issues might be not upto-date for some reason
if int ( trackcnt ) != int ( cntit ) :
cntit = trackcnt
vari = " yes "
else : vari = " no "
2013-01-03 18:26:39 +00:00
logger . fdebug ( " vari is set to: " + str ( vari ) )
2012-09-24 05:17:29 +00:00
#if str(trackcnt) != str(int(cntit)+2):
# cntit = int(cntit) + 1
2012-09-13 15:27:34 +00:00
comic = { }
comicchoice = [ ]
cntit = int ( cntit )
2012-09-24 05:17:29 +00:00
#retrieve the first xml tag (<tag>data</tag>)
#that the parser finds with name tagName:
2014-06-15 05:00:34 +00:00
# to return the parent name of the <name> node : dom.getElementsByTagName('name')[0].parentNode.nodeName
# where [0] denotes the number of the name field(s)
# where nodeName denotes the parentNode : ComicName = results, publisher = publisher, issues = issue
2014-06-09 18:34:53 +00:00
try :
2014-06-15 05:00:34 +00:00
names = len ( dom . getElementsByTagName ( ' name ' ) )
n = 0
while ( n < names ) :
if dom . getElementsByTagName ( ' name ' ) [ n ] . parentNode . nodeName == ' results ' :
try :
comic [ ' ComicName ' ] = dom . getElementsByTagName ( ' name ' ) [ n ] . firstChild . wholeText
comic [ ' ComicName ' ] = comic [ ' ComicName ' ] . rstrip ( )
except :
logger . error ( ' There was a problem retrieving the given data from ComicVine. Ensure that www.comicvine.com is accessible AND that you have provided your OWN ComicVine API key. ' )
return
elif dom . getElementsByTagName ( ' name ' ) [ n ] . parentNode . nodeName == ' publisher ' :
try :
comic [ ' ComicPublisher ' ] = dom . getElementsByTagName ( ' name ' ) [ n ] . firstChild . wholeText
except :
comic [ ' ComicPublisher ' ] = " Unknown "
n + = 1
2014-06-09 18:34:53 +00:00
except :
2014-06-15 05:00:34 +00:00
logger . warn ( ' Something went wrong retrieving from ComicVine. Ensure your API is up-to-date and that comicvine is accessible ' )
2014-06-09 18:34:53 +00:00
return
2014-06-15 05:00:34 +00:00
2013-03-12 16:13:43 +00:00
try :
comic [ ' ComicYear ' ] = dom . getElementsByTagName ( ' start_year ' ) [ 0 ] . firstChild . wholeText
except :
comic [ ' ComicYear ' ] = ' 0000 '
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
comic [ ' ComicURL ' ] = dom . getElementsByTagName ( ' site_detail_url ' ) [ trackcnt ] . firstChild . wholeText
2014-02-26 19:48:50 +00:00
desdeck = 0
2013-03-11 17:25:45 +00:00
#the description field actually holds the Volume# - so let's grab it
try :
2013-07-01 05:19:15 +00:00
descchunk = dom . getElementsByTagName ( ' description ' ) [ 0 ] . firstChild . wholeText
2014-02-26 19:48:50 +00:00
comic_desc = drophtml ( descchunk )
desdeck + = 1
2013-03-11 17:25:45 +00:00
except :
2014-02-26 19:48:50 +00:00
comic_desc = ' None '
#sometimes the deck has volume labels
try :
deckchunk = dom . getElementsByTagName ( ' deck ' ) [ 0 ] . firstChild . wholeText
comic_deck = deckchunk
desdeck + = 1
except :
comic_deck = ' None '
2014-06-02 19:02:28 +00:00
try :
comic [ ' Aliases ' ] = dom . getElementsByTagName ( ' aliases ' ) [ 0 ] . firstChild . wholeText
#logger.fdebug('Aliases: ' + str(aliases))
except :
comic [ ' Aliases ' ] = ' None '
2014-02-26 19:48:50 +00:00
comic [ ' ComicVersion ' ] = ' noversion '
#logger.info('comic_desc:' + comic_desc)
#logger.info('comic_deck:' + comic_deck)
#logger.info('desdeck: ' + str(desdeck))
while ( desdeck > 0 ) :
if desdeck == 1 :
if comic_desc == ' None ' :
comicDes = comic_deck [ : 30 ]
else :
#extract the first 60 characters
comicDes = comic_desc [ : 60 ] . replace ( ' New 52 ' , ' ' )
elif desdeck == 2 :
#extract the characters from the deck
comicDes = comic_deck [ : 30 ] . replace ( ' New 52 ' , ' ' )
else :
break
i = 0
while ( i < 2 ) :
if ' volume ' in comicDes . lower ( ) :
#found volume - let's grab it.
v_find = comicDes . lower ( ) . find ( ' volume ' )
#arbitrarily grab the next 10 chars (6 for volume + 1 for space + 3 for the actual vol #)
#increased to 10 to allow for text numbering (+5 max)
#sometimes it's volume 5 and ocassionally it's fifth volume.
if i == 0 :
vfind = comicDes [ v_find : v_find + 15 ] #if it's volume 5 format
2014-04-21 03:59:55 +00:00
basenums = { ' zero ' : ' 0 ' , ' one ' : ' 1 ' , ' two ' : ' 2 ' , ' three ' : ' 3 ' , ' four ' : ' 4 ' , ' five ' : ' 5 ' , ' six ' : ' 6 ' , ' seven ' : ' 7 ' , ' eight ' : ' 8 ' , ' nine ' : ' 9 ' , ' ten ' : ' 10 ' , ' i ' : ' 1 ' , ' ii ' : ' 2 ' , ' iii ' : ' 3 ' , ' iv ' : ' 4 ' , ' v ' : ' 5 ' }
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
logger . fdebug ( ' volume X format - ' + str ( i ) + ' : ' + vfind )
2014-02-26 19:48:50 +00:00
else :
vfind = comicDes [ : v_find ] # if it's fifth volume format
2014-04-21 03:59:55 +00:00
basenums = { ' zero ' : ' 0 ' , ' first ' : ' 1 ' , ' second ' : ' 2 ' , ' third ' : ' 3 ' , ' fourth ' : ' 4 ' , ' fifth ' : ' 5 ' , ' sixth ' : ' 6 ' , ' seventh ' : ' 7 ' , ' eighth ' : ' 8 ' , ' nineth ' : ' 9 ' , ' tenth ' : ' 10 ' , ' i ' : ' 1 ' , ' ii ' : ' 2 ' , ' iii ' : ' 3 ' , ' iv ' : ' 4 ' , ' v ' : ' 5 ' }
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
logger . fdebug ( ' X volume format - ' + str ( i ) + ' : ' + vfind )
2014-02-26 19:48:50 +00:00
volconv = ' '
for nums in basenums :
if nums in vfind . lower ( ) :
sconv = basenums [ nums ]
vfind = re . sub ( nums , sconv , vfind . lower ( ) )
break
2014-04-21 03:59:55 +00:00
#logger.info('volconv: ' + str(volconv))
2014-02-26 19:48:50 +00:00
#now we attempt to find the character position after the word 'volume'
if i == 0 :
volthis = vfind . lower ( ) . find ( ' volume ' )
volthis = volthis + 6 # add on the actual word to the position so that we can grab the subsequent digit
vfind = vfind [ volthis : volthis + 4 ] #grab the next 4 characters ;)
elif i == 1 :
volthis = vfind . lower ( ) . find ( ' volume ' )
vfind = vfind [ volthis - 4 : volthis ] #grab the next 4 characters ;)
if ' ( ' in vfind :
#bracket detected in versioning'
vfindit = re . findall ( ' [^()]+ ' , vfind )
vfind = vfindit [ 0 ]
vf = re . findall ( ' [^<>]+ ' , vfind )
ledigit = re . sub ( " [^0-9] " , " " , vf [ 0 ] )
if ledigit != ' ' :
comic [ ' ComicVersion ' ] = ledigit
2014-05-29 18:05:11 +00:00
logger . fdebug ( " Volume information found! Adding to series record : volume " + comic [ ' ComicVersion ' ] )
2014-02-26 19:48:50 +00:00
break
i + = 1
else :
i + = 1
if comic [ ' ComicVersion ' ] == ' noversion ' :
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
logger . fdebug ( ' comic[ComicVersion]: ' + str ( comic [ ' ComicVersion ' ] ) )
2014-02-26 19:48:50 +00:00
desdeck - = 1
else :
break
2013-03-11 17:25:45 +00:00
2012-09-24 05:17:29 +00:00
if vari == " yes " :
comic [ ' ComicIssues ' ] = str ( cntit )
else :
comic [ ' ComicIssues ' ] = dom . getElementsByTagName ( ' count_of_issues ' ) [ 0 ] . firstChild . wholeText
2014-06-02 19:02:28 +00:00
2012-09-24 05:17:29 +00:00
comic [ ' ComicImage ' ] = dom . getElementsByTagName ( ' super_url ' ) [ 0 ] . firstChild . wholeText
2014-06-02 19:02:28 +00:00
comic [ ' ComicImageALT ' ] = dom . getElementsByTagName ( ' small_url ' ) [ 0 ] . firstChild . wholeText
2013-05-09 02:35:12 +00:00
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
comic [ ' FirstIssueID ' ] = dom . getElementsByTagName ( ' id ' ) [ 0 ] . firstChild . wholeText
2012-09-13 15:27:34 +00:00
2013-04-08 16:31:41 +00:00
# print ("fistIss:" + str(comic['FirstIssueID']))
2013-03-11 17:25:45 +00:00
# comicchoice.append({
# 'ComicName': comic['ComicName'],
# 'ComicYear': comic['ComicYear'],
# 'Comicid': comicid,
# 'ComicURL': comic['ComicURL'],
# 'ComicIssues': comic['ComicIssues'],
# 'ComicImage': comic['ComicImage'],
# 'ComicVolume': ParseVol,
# 'ComicPublisher': comic['ComicPublisher']
# })
# comic['comicchoice'] = comicchoice
2012-09-13 15:27:34 +00:00
return comic
2013-04-08 16:31:41 +00:00
def GetIssuesInfo ( comicid , dom ) :
2012-09-13 15:27:34 +00:00
subtracks = dom . getElementsByTagName ( ' issue ' )
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
if not mylar . CV_ONLY :
cntiss = dom . getElementsByTagName ( ' count_of_issues ' ) [ 0 ] . firstChild . wholeText
logger . fdebug ( " issues I ' ve counted: " + str ( len ( subtracks ) ) )
logger . fdebug ( " issues CV says it has: " + str ( int ( cntiss ) ) )
if int ( len ( subtracks ) ) != int ( cntiss ) :
logger . fdebug ( " CV ' s count is wrong, I counted different...going with my count for physicals " + str ( len ( subtracks ) ) )
cntiss = len ( subtracks ) # assume count of issues is wrong, go with ACTUAL physical api count
cntiss = int ( cntiss )
n = cntiss - 1
else :
2013-04-07 19:18:26 +00:00
n = int ( len ( subtracks ) )
2013-04-08 16:31:41 +00:00
tempissue = { }
issuech = [ ]
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
firstdate = ' 2099-00-00 '
2012-09-13 15:27:34 +00:00
for subtrack in subtracks :
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
if not mylar . CV_ONLY :
if ( dom . getElementsByTagName ( ' name ' ) [ n ] . firstChild ) is not None :
issue [ ' Issue_Name ' ] = dom . getElementsByTagName ( ' name ' ) [ n ] . firstChild . wholeText
else :
issue [ ' Issue_Name ' ] = ' None '
2013-01-03 18:26:39 +00:00
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
issue [ ' Issue_ID ' ] = dom . getElementsByTagName ( ' id ' ) [ n ] . firstChild . wholeText
issue [ ' Issue_Number ' ] = dom . getElementsByTagName ( ' issue_number ' ) [ n ] . firstChild . wholeText
2013-04-08 16:31:41 +00:00
issuech . append ( {
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
' Issue_ID ' : issue [ ' Issue_ID ' ] ,
' Issue_Number ' : issue [ ' Issue_Number ' ] ,
' Issue_Name ' : issue [ ' Issue_Name ' ]
} )
else :
try :
2013-04-08 16:31:41 +00:00
tempissue [ ' Issue_Name ' ] = subtrack . getElementsByTagName ( ' name ' ) [ 0 ] . firstChild . wholeText
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
except :
2013-04-08 16:31:41 +00:00
tempissue [ ' Issue_Name ' ] = ' None '
tempissue [ ' Issue_ID ' ] = subtrack . getElementsByTagName ( ' id ' ) [ 0 ] . firstChild . wholeText
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
try :
2013-04-08 16:31:41 +00:00
tempissue [ ' CoverDate ' ] = subtrack . getElementsByTagName ( ' cover_date ' ) [ 0 ] . firstChild . wholeText
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
except :
2013-04-08 16:31:41 +00:00
tempissue [ ' CoverDate ' ] = ' 0000-00-00 '
2014-02-26 19:48:50 +00:00
try :
tempissue [ ' StoreDate ' ] = subtrack . getElementsByTagName ( ' store_date ' ) [ 0 ] . firstChild . wholeText
except :
tempissue [ ' StoreDate ' ] = ' 0000-00-00 '
2013-04-08 16:31:41 +00:00
tempissue [ ' Issue_Number ' ] = subtrack . getElementsByTagName ( ' issue_number ' ) [ 0 ] . firstChild . wholeText
issuech . append ( {
2014-02-26 19:48:50 +00:00
' Comic_ID ' : comicid ,
2013-04-08 16:31:41 +00:00
' Issue_ID ' : tempissue [ ' Issue_ID ' ] ,
' Issue_Number ' : tempissue [ ' Issue_Number ' ] ,
' Issue_Date ' : tempissue [ ' CoverDate ' ] ,
2014-02-26 19:48:50 +00:00
' Store_Date ' : tempissue [ ' StoreDate ' ] ,
2013-04-08 16:31:41 +00:00
' Issue_Name ' : tempissue [ ' Issue_Name ' ]
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
} )
2013-04-08 16:31:41 +00:00
if tempissue [ ' CoverDate ' ] < firstdate and tempissue [ ' CoverDate ' ] != ' 0000-00-00 ' :
firstdate = tempissue [ ' CoverDate ' ]
2012-09-13 15:27:34 +00:00
n - = 1
2013-04-07 19:18:26 +00:00
2013-04-08 16:31:41 +00:00
#issue['firstdate'] = firstdate
return issuech , firstdate
2012-09-13 15:27:34 +00:00
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
def GetFirstIssue ( issueid , dom ) :
#if the Series Year doesn't exist, get the first issue and take the date from that
try :
first_year = dom . getElementsByTagName ( ' cover_date ' ) [ 0 ] . firstChild . wholeText
except :
first_year = ' 0000 '
return first_year
the_year = first_year [ : 4 ]
the_month = first_year [ 5 : 7 ]
the_date = the_year + ' - ' + the_month
return the_year
2013-07-01 05:19:15 +00:00
def drophtml ( html ) :
from bs4 import BeautifulSoup
soup = BeautifulSoup ( html )
text_parts = soup . findAll ( text = True )
2013-07-10 01:45:10 +00:00
#print ''.join(text_parts)
2013-07-01 05:19:15 +00:00
return ' ' . join ( text_parts )