mirror of
https://github.com/evilhero/mylar
synced 2024-12-21 23:32:23 +00:00
FIX:(#599) 'Newer version available, you're 0 commits behind' error, FIX:(#572) On Windows systems, when metatagging enabled would not delete temporary files (Thanks uspider7), IMP: Removed redudant looping code from cmtagmylar module, FIX: Annuals now will display correctly without destroying table layout after changing any issue status on screen, IMP: Added .NOW to issue scanner checks, FIX: When selecting one-off from Weekly Pull-list and not on watchlist, would error out as no year provided
This commit is contained in:
parent
c93386586a
commit
b27584af81
7 changed files with 150 additions and 195 deletions
|
@ -419,7 +419,7 @@
|
|||
</div>
|
||||
|
||||
|
||||
<table id="annual_table" class="display">
|
||||
<table class="display_no_select" id="annual_table">
|
||||
|
||||
|
||||
<!-- <div class="ui-widget">
|
||||
|
|
|
@ -94,26 +94,38 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
|||
shutil.rmtree( comicpath )
|
||||
os.makedirs( comicpath )
|
||||
|
||||
# make a list of all CBR and CBZ files in downloadpath
|
||||
if filename is None:
|
||||
filename_list = glob.glob( os.path.join( downloadpath, "*.cbz" ) )
|
||||
filename_list.extend( glob.glob( os.path.join( downloadpath, "*.cbr" ) ) )
|
||||
|
||||
## Takes all .cbr and .cbz files and dumps them to processing directory ##
|
||||
fcount = 1
|
||||
for f in filename_list:
|
||||
shutil.move( f, comicpath)
|
||||
if fcount > 1:
|
||||
logger.fdebug('More than one cbr/cbz within path, performing Post-Process on first file detected: ' + f)
|
||||
break
|
||||
shutil.move( f, comicpath )
|
||||
filename = f #just the filename itself
|
||||
fcount+=1
|
||||
else:
|
||||
shutil.move( filename, comicpath )
|
||||
|
||||
## Changes filetype extensions when needed ##
|
||||
cbr_list = glob.glob( os.path.join( comicpath, "*.cbr" ) )
|
||||
for f in cbr_list:
|
||||
if zipfile.is_zipfile( f ):
|
||||
base = os.path.splitext( f )[0]
|
||||
shutil.move( f, base + ".cbz" )
|
||||
logger.fdebug('{0}: renaming {1} to be a cbz'.format( scriptname, os.path.basename( f ) ))
|
||||
filename = os.path.split(filename)[1] # just the filename itself
|
||||
#print comicpath
|
||||
#print os.path.join( comicpath, filename )
|
||||
if filename.endswith('.cbr'):
|
||||
f = os.path.join( comicpath, filename )
|
||||
if zipfile.is_zipfile( f ):
|
||||
#print "zipfile detected"
|
||||
base = os.path.splitext( f )[0]
|
||||
#print base
|
||||
#print f
|
||||
shutil.move( f, base + ".cbz" )
|
||||
logger.fdebug('{0}: renaming {1} to be a cbz'.format( scriptname, os.path.basename( f ) ))
|
||||
|
||||
if file_extension_fixing:
|
||||
cbz_list = glob.glob( os.path.join( comicpath, "*.cbz" ) )
|
||||
for f in cbz_list:
|
||||
if file_extension_fixing:
|
||||
if filename.endswith('.cbz'):
|
||||
f = os.path.join( comicpath, filename )
|
||||
|
||||
if os.path.isfile( f ):
|
||||
try:
|
||||
rar_test_cmd_output = "is not RAR archive" #default, in case of error
|
||||
rar_test_cmd_output = subprocess.check_output( [ unrar_cmd, "t", f ] )
|
||||
|
@ -123,190 +135,102 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
|||
base = os.path.splitext( f )[0]
|
||||
shutil.move( f, base + ".cbr" )
|
||||
logger.fdebug('{0}: renaming {1} to be a cbr'.format( scriptname, os.path.basename( f ) ))
|
||||
|
||||
# Now rename all CBR files to RAR
|
||||
cbr_list = glob.glob( os.path.join( comicpath, "*.cbr" ) )
|
||||
for f in cbr_list:
|
||||
base = os.path.splitext( f )[0]
|
||||
shutil.move( f, base + ".rar" )
|
||||
|
||||
# Now rename all CBR files to RAR
|
||||
if filename.endswith('.cbr'):
|
||||
f = os.path.join( comicpath, filename)
|
||||
base = os.path.splitext( f )[0]
|
||||
baserar = base + ".rar"
|
||||
shutil.move( f, baserar )
|
||||
|
||||
## Changes any cbr files to cbz files for insertion of metadata ##
|
||||
if file_conversion:
|
||||
rar_list = glob.glob( os.path.join( comicpath, "*.rar" ) )
|
||||
for f in rar_list:
|
||||
logger.fdebug('{0}: converting {1} to be zip format'.format( scriptname, os.path.basename( f ) ))
|
||||
basename = os.path.splitext( f )[0]
|
||||
zipname = basename + ".cbz"
|
||||
|
||||
# Move into the folder where we will be unrar-ing things
|
||||
os.makedirs( unrar_folder )
|
||||
os.chdir( unrar_folder )
|
||||
|
||||
# Extract and zip up
|
||||
try:
|
||||
output = check_output( [ unrar_cmd, "x", f ] )
|
||||
#subprocess.Popen( [ unrar_cmd, "x", f ] ).communicate()
|
||||
except CalledProcessError as e:
|
||||
if e.returncode == 3:
|
||||
logger.fdebug('[Unrar Error 3] - Broken Archive.')
|
||||
elif e.returncode == 1:
|
||||
logger.fdebug('[Unrar Error 1] - No files to extract.')
|
||||
logger.fdebug('Marking this as an incomplete download.')
|
||||
return "unrar error"
|
||||
|
||||
shutil.make_archive( basename, "zip", unrar_folder )
|
||||
|
||||
# get out of unrar folder and clean up
|
||||
os.chdir( comicpath )
|
||||
shutil.rmtree( unrar_folder )
|
||||
|
||||
## Changes zip to cbz
|
||||
zip_list = glob.glob( os.path.join( comicpath, "*.zip" ) )
|
||||
for f in zip_list:
|
||||
base = os.path.splitext( f )[0]
|
||||
shutil.move( f, base + ".cbz" )
|
||||
|
||||
## Tag each CBZ, and move it back to original directory ##
|
||||
cbz_list = glob.glob( os.path.join( comicpath, "*.cbz" ) )
|
||||
for f in cbz_list:
|
||||
if issueid is None:
|
||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cr", "-f", "-o", "--verbose", "--nooverwrite", f ] ).communicate()
|
||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cbl", "-f", "-o", "--verbose", "--nooverwrite", f ] ).communicate()
|
||||
else:
|
||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cr", "-o", "--id", issueid, "--verbose", "--nooverwrite", f ] ).communicate()
|
||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cbl", "-o", "--id", issueid, "--verbose", "--nooverwrite", f ] ).communicate()
|
||||
shutil.move( f, downloadpath )
|
||||
return
|
||||
|
||||
else:
|
||||
shutil.move( filename, comicpath)
|
||||
|
||||
filename = os.path.split(filename)[1] # just the filename itself
|
||||
print comicpath
|
||||
print os.path.join( comicpath, filename )
|
||||
if filename.endswith('.cbr'):
|
||||
f = os.path.join( comicpath, filename )
|
||||
if zipfile.is_zipfile( f ):
|
||||
print "zipfile detected"
|
||||
base = os.path.splitext( f )[0]
|
||||
print base
|
||||
print f
|
||||
shutil.move( f, base + ".cbz" )
|
||||
logger.fdebug('{0}: renaming {1} to be a cbz'.format( scriptname, os.path.basename( f ) ))
|
||||
logger.fdebug('{0}: converting {1} to be zip format'.format( scriptname, os.path.basename( f ) ))
|
||||
basename = os.path.splitext( f )[0]
|
||||
zipname = basename + ".cbz"
|
||||
|
||||
if file_extension_fixing:
|
||||
if filename.endswith('.cbz'):
|
||||
f = os.path.join( comicpath, filename )
|
||||
# Move into the folder where we will be unrar-ing things
|
||||
os.makedirs( unrar_folder )
|
||||
os.chdir( unrar_folder )
|
||||
|
||||
if os.path.isfile( f ):
|
||||
try:
|
||||
rar_test_cmd_output = "is not RAR archive" #default, in case of error
|
||||
rar_test_cmd_output = subprocess.check_output( [ unrar_cmd, "t", f ] )
|
||||
except:
|
||||
pass
|
||||
if not "is not RAR archive" in rar_test_cmd_output:
|
||||
base = os.path.splitext( f )[0]
|
||||
shutil.move( f, base + ".cbr" )
|
||||
logger.fdebug('{0}: renaming {1} to be a cbr'.format( scriptname, os.path.basename( f ) ))
|
||||
# Extract and zip up
|
||||
logger.fdebug('{0}: Comicpath is ' + baserar) #os.path.join(comicpath,basename))
|
||||
logger.fdebug('{0}: Unrar is ' + unrar_folder )
|
||||
try:
|
||||
#subprocess.Popen( [ unrar_cmd, "x", os.path.join(comicpath,basename) ] ).communicate()
|
||||
output = check_output( [ unrar_cmd, "x", baserar ] ) #os.path.join(comicpath,basename) ] )
|
||||
except CalledProcessError as e:
|
||||
if e.returncode == 3:
|
||||
logger.fdebug('[Unrar Error 3] - Broken Archive.')
|
||||
elif e.returncode == 1:
|
||||
logger.fdebug('[Unrar Error 1] - No files to extract.')
|
||||
logger.fdebug('Marking this as an incomplete download.')
|
||||
return "unrar error"
|
||||
|
||||
# Now rename all CBR files to RAR
|
||||
if filename.endswith('.cbr'):
|
||||
f = os.path.join( comicpath, filename)
|
||||
base = os.path.splitext( f )[0]
|
||||
baserar = base + ".rar"
|
||||
shutil.move( f, baserar )
|
||||
shutil.make_archive( basename, "zip", unrar_folder )
|
||||
|
||||
## Changes any cbr files to cbz files for insertion of metadata ##
|
||||
if file_conversion:
|
||||
f = os.path.join( comicpath, filename )
|
||||
logger.fdebug('{0}: converting {1} to be zip format'.format( scriptname, os.path.basename( f ) ))
|
||||
basename = os.path.splitext( f )[0]
|
||||
zipname = basename + ".cbz"
|
||||
# get out of unrar folder and clean up
|
||||
os.chdir( comicpath )
|
||||
shutil.rmtree( unrar_folder )
|
||||
|
||||
# Move into the folder where we will be unrar-ing things
|
||||
os.makedirs( unrar_folder )
|
||||
os.chdir( unrar_folder )
|
||||
|
||||
# Extract and zip up
|
||||
logger.fdebug('{0}: Comicpath is ' + baserar) #os.path.join(comicpath,basename))
|
||||
logger.fdebug('{0}: Unrar is ' + unrar_folder )
|
||||
try:
|
||||
#subprocess.Popen( [ unrar_cmd, "x", os.path.join(comicpath,basename) ] ).communicate()
|
||||
output = check_output( [ unrar_cmd, "x", baserar ] ) #os.path.join(comicpath,basename) ] )
|
||||
except CalledProcessError as e:
|
||||
if e.returncode == 3:
|
||||
logger.fdebug('[Unrar Error 3] - Broken Archive.')
|
||||
elif e.returncode == 1:
|
||||
logger.fdebug('[Unrar Error 1] - No files to extract.')
|
||||
logger.fdebug('Marking this as an incomplete download.')
|
||||
return "unrar error"
|
||||
|
||||
shutil.make_archive( basename, "zip", unrar_folder )
|
||||
|
||||
# get out of unrar folder and clean up
|
||||
os.chdir( comicpath )
|
||||
shutil.rmtree( unrar_folder )
|
||||
|
||||
## Changes zip to cbz
|
||||
## Changes zip to cbz
|
||||
|
||||
f = os.path.join( comicpath, os.path.splitext(filename)[0] + ".zip" )
|
||||
print "zipfile" + f
|
||||
try:
|
||||
with open(f): pass
|
||||
except:
|
||||
logger.fdebug('No zip file present')
|
||||
return "fail"
|
||||
base = os.path.splitext( f )[0]
|
||||
shutil.move( f, base + ".cbz" )
|
||||
nfilename = base + ".cbz"
|
||||
else:
|
||||
logger.fdebug('filename:' + filename)
|
||||
nfilename = filename
|
||||
f = os.path.join( comicpath, os.path.splitext(filename)[0] + ".zip" )
|
||||
#print "zipfile" + f
|
||||
try:
|
||||
with open(f): pass
|
||||
except:
|
||||
logger.fdebug('No zip file present')
|
||||
return "fail"
|
||||
base = os.path.splitext( f )[0]
|
||||
shutil.move( f, base + ".cbz" )
|
||||
nfilename = base + ".cbz"
|
||||
else:
|
||||
logger.fdebug('filename:' + filename)
|
||||
nfilename = filename
|
||||
|
||||
if os.path.isfile( nfilename ):
|
||||
logger.fdebug('file exists in given location already.')
|
||||
file_dir, file_n = os.path.split(nfilename)
|
||||
else:
|
||||
#remove the IssueID from the path
|
||||
file_dir = re.sub(issueid, '', comicpath)
|
||||
file_n = os.path.split(nfilename)[1]
|
||||
logger.fdebug('converted directory: ' + str(file_dir))
|
||||
logger.fdebug('converted filename: ' + str(file_n))
|
||||
logger.fdebug('destination path: ' + os.path.join(dirName,file_n))
|
||||
logger.fdebug('dirName: ' + dirName)
|
||||
logger.fdebug('absDirName: ' + os.path.abspath(dirName))
|
||||
## Tag each CBZ, and move it back to original directory ##
|
||||
if issueid is None:
|
||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cr", "-f", "-o", "--verbose", "--nooverwrite", nfilename ] ).communicate()
|
||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cbl", "-f", "-o", "--verbose", "--nooverwrite", nfilename ] ).communicate()
|
||||
else:
|
||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cr", "-o", "--id", issueid, "--verbose", "--nooverwrite", nfilename ] ).communicate()
|
||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cbl", "-o", "--id", issueid, "--verbose", "--nooverwrite", nfilename ] ).communicate()
|
||||
if os.path.isfile( nfilename ):
|
||||
logger.fdebug('file exists in given location already.')
|
||||
file_dir, file_n = os.path.split(nfilename)
|
||||
else:
|
||||
#remove the IssueID from the path
|
||||
file_dir = re.sub(issueid, '', comicpath)
|
||||
file_n = os.path.split(nfilename)[1]
|
||||
logger.fdebug('converted directory: ' + str(file_dir))
|
||||
logger.fdebug('converted filename: ' + str(file_n))
|
||||
logger.fdebug('destination path: ' + os.path.join(dirName,file_n))
|
||||
logger.fdebug('dirName: ' + dirName)
|
||||
logger.fdebug('absDirName: ' + os.path.abspath(dirName))
|
||||
## Tag each CBZ, and move it back to original directory ##
|
||||
if issueid is None:
|
||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cr", "-f", "-o", "--verbose", "--nooverwrite", nfilename ] ).communicate()
|
||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cbl", "-f", "-o", "--verbose", "--nooverwrite", nfilename ] ).communicate()
|
||||
else:
|
||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cr", "-o", "--id", issueid, "--verbose", "--nooverwrite", nfilename ] ).communicate()
|
||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cbl", "-o", "--id", issueid, "--verbose", "--nooverwrite", nfilename ] ).communicate()
|
||||
|
||||
if os.path.exists(os.path.join(os.path.abspath(dirName),file_n)):
|
||||
logger.fdebug('Unable to move - file already exists.')
|
||||
else:
|
||||
shutil.move( os.path.join(comicpath, nfilename), os.path.join(os.path.abspath(dirName),file_n))
|
||||
#shutil.move( nfilename, os.path.join(os.path.abspath(dirName),file_n))
|
||||
logger.fdebug('Sucessfully moved file from temporary path.')
|
||||
i = 0
|
||||
if os.path.exists(os.path.join(os.path.abspath(dirName),file_n)):
|
||||
logger.fdebug('Unable to move - file already exists.')
|
||||
else:
|
||||
shutil.move( os.path.join(comicpath, nfilename), os.path.join(os.path.abspath(dirName),file_n))
|
||||
#shutil.move( nfilename, os.path.join(os.path.abspath(dirName),file_n))
|
||||
logger.fdebug('Sucessfully moved file from temporary path.')
|
||||
i = 0
|
||||
|
||||
while i < 10:
|
||||
try:
|
||||
shutil.rmtree( comicpath )
|
||||
except:
|
||||
time.sleep(.1)
|
||||
else:
|
||||
return os.path.join(os.path.abspath(dirName), file_n)
|
||||
i+=1
|
||||
os.chdir( mylar.PROG_DIR )
|
||||
|
||||
logger.fdebug('Failed to remove temporary path : ' + str(comicpath))
|
||||
while i < 10:
|
||||
try:
|
||||
logger.fdebug('Attempting to remove: ' + comicpath)
|
||||
shutil.rmtree( comicpath )
|
||||
except:
|
||||
time.sleep(.1)
|
||||
else:
|
||||
return os.path.join(os.path.abspath(dirName), file_n)
|
||||
i+=1
|
||||
|
||||
return os.path.join(os.path.abspath(dirName),file_n)
|
||||
logger.fdebug('Failed to remove temporary path : ' + str(comicpath))
|
||||
|
||||
## Clean up temp directory ##
|
||||
return os.path.join(os.path.abspath(dirName),file_n)
|
||||
|
||||
#os.chdir( sabnzbdscriptpath )
|
||||
#shutil.rmtree( comicpath )
|
||||
|
||||
## Will Run Mylar Post=processing In Future ##
|
||||
|
|
|
@ -57,6 +57,8 @@ def listFiles(dir,watchcomic,AlternateSearch=None,manual=None,sarc=None):
|
|||
'\@']
|
||||
|
||||
issue_exceptions = ['AU',
|
||||
'.INH',
|
||||
'.NOW',
|
||||
'AI',
|
||||
'A',
|
||||
'B',
|
||||
|
@ -320,7 +322,7 @@ def listFiles(dir,watchcomic,AlternateSearch=None,manual=None,sarc=None):
|
|||
# logger.fdebug("removed title from name - is now : " + str(justthedigits))
|
||||
|
||||
justthedigits = justthedigits_1.split(' ', 1)[0]
|
||||
|
||||
|
||||
digitsvalid = "false"
|
||||
|
||||
for jdc in list(justthedigits):
|
||||
|
@ -354,8 +356,14 @@ def listFiles(dir,watchcomic,AlternateSearch=None,manual=None,sarc=None):
|
|||
logger.fdebug('DECIMAL ISSUE DETECTED [' + justthedigits + ']')
|
||||
else:
|
||||
for issexcept in issue_exceptions:
|
||||
decimalexcept = False
|
||||
if '.' in issexcept:
|
||||
decimalexcept = True
|
||||
issexcept = issexcept[1:] #remove the '.' from comparison...
|
||||
if issexcept.lower() in poss_alpha.lower() and len(poss_alpha) <= len(issexcept):
|
||||
justthedigits += poss_alpha
|
||||
if decimalexcept:
|
||||
issexcept = '.' + issexcept
|
||||
justthedigits += issexcept #poss_alpha
|
||||
logger.fdebug('ALPHANUMERIC EXCEPTION. COMBINING : [' + justthedigits + ']')
|
||||
digitsvalid = "true"
|
||||
break
|
||||
|
|
|
@ -638,6 +638,8 @@ def issuedigits(issnum):
|
|||
int_issnum = (int(issnum[:-2]) * 1000) + ord('a') + ord('i')
|
||||
elif 'inh' in issnum.lower():
|
||||
int_issnum = (int(issnum[:-4]) * 1000) + ord('i') + ord('n') + ord('h')
|
||||
elif 'now' in issnum.lower():
|
||||
int_issnum = (int(issnum[:-4]) * 1000) + ord('n') + ord('o') + ord('w')
|
||||
elif u'\xbd' in issnum:
|
||||
issnum = .5
|
||||
int_issnum = int(issnum) * 1000
|
||||
|
@ -659,7 +661,7 @@ def issuedigits(issnum):
|
|||
if len(decis) == 1:
|
||||
decisval = int(decis) * 10
|
||||
issaftdec = str(decisval)
|
||||
if len(decis) == 2:
|
||||
if len(decis) >= 2:
|
||||
decisval = int(decis)
|
||||
issaftdec = str(decisval)
|
||||
try:
|
||||
|
|
|
@ -624,6 +624,8 @@ def addComictoDB(comicid,mismatch=None,pullupd=None,imported=None,ogcname=None,c
|
|||
# print "ai:" + str(int_issnum)
|
||||
elif 'inh' in issnum.lower():
|
||||
int_issnum = (int(issnum[:-4]) * 1000) + ord('i') + ord('n') + ord('h')
|
||||
elif 'now' in issnum.lower():
|
||||
int_issnum = (int(issnum[:-4]) * 1000) + ord('n') + ord('o') + ord('w')
|
||||
elif u'\xbd' in issnum:
|
||||
issnum = .5
|
||||
int_issnum = int(issnum) * 1000
|
||||
|
@ -1209,9 +1211,7 @@ def GCDimport(gcomicid, pullupd=None,imported=None,ogcname=None):
|
|||
def issue_collection(issuedata,nostatus):
|
||||
myDB = db.DBConnection()
|
||||
|
||||
logger.info('issue collection...')
|
||||
if issuedata:
|
||||
#logger.info('issuedata exists')
|
||||
for issue in issuedata:
|
||||
|
||||
|
||||
|
@ -1226,7 +1226,6 @@ def issue_collection(issuedata,nostatus):
|
|||
|
||||
|
||||
if nostatus == 'False':
|
||||
#logger.info('issue')
|
||||
# check if the issue already exists
|
||||
iss_exists = myDB.action('SELECT * from issues WHERE IssueID=?', [issue['IssueID']]).fetchone()
|
||||
|
||||
|
|
|
@ -1013,7 +1013,11 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
D_ComicVersion = ComVersChk
|
||||
|
||||
F_ComicVersion = re.sub("[^0-9]", "", fndcomicversion)
|
||||
S_ComicVersion = str(SeriesYear)
|
||||
#if this is a one-off, SeriesYear will be None and cause errors.
|
||||
if SeriesYear is None:
|
||||
S_ComicVersion = 0
|
||||
else:
|
||||
S_ComicVersion = str(SeriesYear)
|
||||
logger.fdebug("FCVersion: " + str(F_ComicVersion))
|
||||
logger.fdebug("DCVersion: " + str(D_ComicVersion))
|
||||
logger.fdebug("SCVersion: " + str(S_ComicVersion))
|
||||
|
@ -1068,8 +1072,8 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
logger.fdebug("integer value of issue we are looking for : " + str(intIss))
|
||||
|
||||
fnd_iss_except = None
|
||||
comintIss = helpers.issuedigits(comic_iss)
|
||||
logger.fdebug("issue we found for is : " + str(comic_iss))
|
||||
comintIss = helpers.issuedigits(comic_iss)
|
||||
logger.fdebug("integer value of issue we are found : " + str(comintIss))
|
||||
|
||||
#issue comparison now as well
|
||||
|
|
|
@ -41,6 +41,8 @@ def solicit(month, year):
|
|||
else:
|
||||
datestring = str(month) + str(year)
|
||||
pagelinks = "http://www.comicbookresources.com/tag/solicits" + str(datestring)
|
||||
logger.info('datestring:' + datestring)
|
||||
logger.info('checking:' + pagelinks)
|
||||
pageresponse = urllib2.urlopen ( pagelinks )
|
||||
soup = BeautifulSoup (pageresponse)
|
||||
cntlinks = soup.findAll('h3')
|
||||
|
@ -155,11 +157,26 @@ def populate(link,publisher,shipdate):
|
|||
resultURL = []
|
||||
matched = "no"
|
||||
upcome = []
|
||||
get_next = False
|
||||
prev_chk = False
|
||||
|
||||
while (i < lenabc):
|
||||
titlet = abc[i] #iterate through the p pulling out only results.
|
||||
#print ("titlet: " + str(titlet))
|
||||
if "/news/preview2.php" in str(titlet):
|
||||
if "/prev_img.php?pid" in str(titlet):
|
||||
#solicits in 03-2014 have seperated <p> tags, so we need to take the subsequent <p>, not the initial.
|
||||
get_next = True
|
||||
i+=1
|
||||
continue
|
||||
elif "/news/preview2.php" in str(titlet):
|
||||
prev_chk = True
|
||||
get_next = False
|
||||
elif get_next == True:
|
||||
prev_chk = True
|
||||
else:
|
||||
prev_chk = False
|
||||
get_next = False
|
||||
if prev_chk == True:
|
||||
tempName = titlet.findNext(text=True)
|
||||
if ' TPB' not in tempName and ' HC' not in tempName and 'GN-TPB' not in tempName and 'for $1' not in tempName.lower() and 'subscription variant' not in tempName.lower():
|
||||
#print publisher + ' found upcoming'
|
||||
|
@ -234,7 +251,8 @@ def populate(link,publisher,shipdate):
|
|||
#print ('issue#: ' + re.sub('#', '', issue))
|
||||
#print ('extra info: ' + exinfo)
|
||||
else:
|
||||
print ('no issue # to retrieve.')
|
||||
pass
|
||||
#print ('no issue # to retrieve.')
|
||||
i+=1
|
||||
return upcome
|
||||
#end.
|
||||
|
|
Loading…
Reference in a new issue