2013-01-28 20:31:43 +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.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Mylar. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
from __future__ import with_statement
|
|
|
|
|
|
|
|
import os
|
|
|
|
import glob
|
|
|
|
import re
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
import mylar
|
|
|
|
from mylar import db, logger, helpers, importer, updater
|
|
|
|
|
|
|
|
# You can scan a single directory and append it to the current library by specifying append=True
|
|
|
|
def libraryScan(dir=None, append=False, ComicID=None, ComicName=None, cron=None):
|
|
|
|
|
|
|
|
if cron and not mylar.LIBRARYSCAN:
|
|
|
|
return
|
|
|
|
|
|
|
|
if not dir:
|
|
|
|
dir = mylar.COMIC_DIR
|
|
|
|
|
|
|
|
# If we're appending a dir, it's coming from the post processor which is
|
|
|
|
# already bytestring
|
|
|
|
if not append:
|
|
|
|
dir = dir.encode(mylar.SYS_ENCODING)
|
|
|
|
|
|
|
|
if not os.path.isdir(dir):
|
|
|
|
logger.warn('Cannot find directory: %s. Not scanning' % dir.decode(mylar.SYS_ENCODING, 'replace'))
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
logger.info('Scanning comic directory: %s' % dir.decode(mylar.SYS_ENCODING, 'replace'))
|
|
|
|
|
|
|
|
basedir = dir
|
|
|
|
|
|
|
|
comic_list = []
|
|
|
|
comiccnt = 0
|
|
|
|
extensions = ('cbr','cbz')
|
|
|
|
for r,d,f in os.walk(dir):
|
|
|
|
#for directory in d[:]:
|
|
|
|
# if directory.startswith("."):
|
|
|
|
# d.remove(directory)
|
|
|
|
for files in f:
|
|
|
|
if any(files.lower().endswith('.' + x.lower()) for x in extensions):
|
|
|
|
comic = files
|
|
|
|
comicpath = os.path.join(r, files)
|
|
|
|
comicsize = os.path.getsize(comicpath)
|
|
|
|
print "Comic: " + comic
|
|
|
|
print "Comic Path: " + comicpath
|
|
|
|
print "Comic Size: " + str(comicsize)
|
|
|
|
|
|
|
|
# We need the unicode path to use for logging, inserting into database
|
|
|
|
unicode_comic_path = comicpath.decode(mylar.SYS_ENCODING, 'replace')
|
|
|
|
|
|
|
|
comiccnt+=1
|
|
|
|
comic_dict = { 'ComicFilename': comic,
|
|
|
|
'ComicLocation': comicpath,
|
|
|
|
'ComicSize': comicsize,
|
|
|
|
'Unicode_ComicLocation': unicode_comic_path }
|
|
|
|
comic_list.append(comic_dict)
|
|
|
|
|
|
|
|
logger.info("I've found a total of " + str(comiccnt) + " comics....analyzing now")
|
2013-02-06 19:55:23 +00:00
|
|
|
logger.info("comiclist: " + str(comic_list))
|
2013-01-28 20:31:43 +00:00
|
|
|
myDB = db.DBConnection()
|
|
|
|
|
|
|
|
#let's load in the watchlist to see if we have any matches.
|
|
|
|
logger.info("loading in the watchlist to see if a series is being watched already...")
|
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
|
|
|
watchlist = myDB.select("SELECT * from comics")
|
2013-01-28 20:31:43 +00:00
|
|
|
ComicName = []
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
DisplayName = []
|
2013-01-28 20:31:43 +00:00
|
|
|
ComicYear = []
|
|
|
|
ComicPublisher = []
|
|
|
|
ComicTotal = []
|
|
|
|
ComicID = []
|
|
|
|
ComicLocation = []
|
|
|
|
|
|
|
|
AltName = []
|
|
|
|
watchcnt = 0
|
|
|
|
|
|
|
|
watch_kchoice = []
|
|
|
|
watchchoice = {}
|
|
|
|
import_by_comicids = []
|
|
|
|
import_comicids = {}
|
|
|
|
|
|
|
|
for watch in watchlist:
|
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
|
|
|
#use the comicname_filesafe to start
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
watchdisplaycomic = watch['ComicName'].encode('utf-8').strip() #re.sub('[\_\#\,\/\:\;\!\$\%\&\+\'\?\@]', ' ', watch['ComicName']).encode('utf-8').strip()
|
2013-01-28 20:31:43 +00:00
|
|
|
# let's clean up the name, just in case for comparison purposes...
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
watchcomic = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\&\+\'\?\@]', '', watch['ComicName_Filesafe']).encode('utf-8').strip()
|
2013-01-28 20:31:43 +00:00
|
|
|
#watchcomic = re.sub('\s+', ' ', str(watchcomic)).strip()
|
2013-02-09 03:34:02 +00:00
|
|
|
|
|
|
|
if ' the ' in watchcomic.lower():
|
|
|
|
#drop the 'the' from the watchcomic title for proper comparisons.
|
|
|
|
watchcomic = watchcomic[-4:]
|
|
|
|
|
2013-01-28 20:31:43 +00:00
|
|
|
alt_chk = "no" # alt-checker flag (default to no)
|
2013-02-09 03:34:02 +00:00
|
|
|
|
2013-01-28 20:31:43 +00:00
|
|
|
# account for alternate names as well
|
|
|
|
if watch['AlternateSearch'] is not None and watch['AlternateSearch'] is not 'None':
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
altcomic = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\&\+\'\?\@]', '', watch['AlternateSearch']).encode('utf-8').strip()
|
2013-01-28 20:31:43 +00:00
|
|
|
#altcomic = re.sub('\s+', ' ', str(altcomic)).strip()
|
|
|
|
AltName.append(altcomic)
|
|
|
|
alt_chk = "yes" # alt-checker flag
|
|
|
|
|
|
|
|
ComicName.append(watchcomic)
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
DisplayName.append(watchdisplaycomic)
|
2013-01-28 20:31:43 +00:00
|
|
|
ComicYear.append(watch['ComicYear'])
|
|
|
|
ComicPublisher.append(watch['ComicPublisher'])
|
|
|
|
ComicTotal.append(watch['Total'])
|
|
|
|
ComicID.append(watch['ComicID'])
|
|
|
|
ComicLocation.append(watch['ComicLocation'])
|
|
|
|
watchcnt+=1
|
|
|
|
|
|
|
|
logger.info("Successfully loaded " + str(watchcnt) + " series from your watchlist.")
|
|
|
|
|
|
|
|
ripperlist=['digital-',
|
|
|
|
'empire',
|
|
|
|
'dcp']
|
|
|
|
|
|
|
|
watchfound = 0
|
|
|
|
|
2014-02-26 19:48:50 +00:00
|
|
|
datelist = ['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec']
|
|
|
|
# datemonth = {'one':1,'two':2,'three':3,'four':4,'five':5,'six':6,'seven':7,'eight':8,'nine':9,'ten':10,'eleven':$
|
|
|
|
# #search for number as text, and change to numeric
|
|
|
|
# for numbs in basnumbs:
|
|
|
|
# #print ("numbs:" + str(numbs))
|
|
|
|
# if numbs in ComicName.lower():
|
|
|
|
# numconv = basnumbs[numbs]
|
|
|
|
# #print ("numconv: " + str(numconv))
|
|
|
|
|
|
|
|
|
2013-01-28 20:31:43 +00:00
|
|
|
for i in comic_list:
|
2013-02-06 19:55:23 +00:00
|
|
|
print i['ComicFilename']
|
2013-01-28 20:31:43 +00:00
|
|
|
|
2014-09-10 04:54:53 +00:00
|
|
|
#if mylar.IMP_METADATA:
|
|
|
|
#logger.info('metatagging checking enabled.')
|
|
|
|
#if read tags is enabled during import, check here.
|
|
|
|
#if i['ComicLocation'].endswith('.cbz'):
|
|
|
|
# logger.info('Attempting to read tags present in filename: ' + str(i['ComicLocation']))
|
|
|
|
# issueinfo = helpers.IssueDetails(i['ComicLocation'])
|
|
|
|
# if issueinfo is None:
|
|
|
|
# pass
|
|
|
|
# else:
|
|
|
|
# logger.info('Successfully retrieved some tags. Lets see what I can figure out.')
|
|
|
|
# comicname = issueinfo[0]['series']
|
|
|
|
# logger.fdebug('Series Name: ' + comicname)
|
|
|
|
# issue_number = issueinfo[0]['issue_number']
|
|
|
|
# logger.fdebug('Issue Number: ' + str(issue_number))
|
|
|
|
# issuetitle = issueinfo[0]['title']
|
|
|
|
# logger.fdebug('Issue Title: ' + issuetitle)
|
|
|
|
# issueyear = issueinfo[0]['year']
|
|
|
|
# logger.fdebug('Issue Year: ' + str(issueyear))
|
|
|
|
# # if used by ComicTagger, Notes field will have the IssueID.
|
|
|
|
# issuenotes = issueinfo[0]['notes']
|
|
|
|
# logger.fdebug('Notes: ' + issuenotes)
|
|
|
|
|
|
|
|
|
2013-01-28 20:31:43 +00:00
|
|
|
comfilename = i['ComicFilename']
|
|
|
|
comlocation = i['ComicLocation']
|
|
|
|
#let's clean up the filename for matching purposes
|
|
|
|
|
2013-03-29 04:02:35 +00:00
|
|
|
cfilename = re.sub('[\_\#\,\/\:\;\-\!\$\%\&\+\'\?\@]', ' ', comfilename)
|
2013-02-06 19:55:23 +00:00
|
|
|
#cfilename = re.sub('\s', '_', str(cfilename))
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
d_filename = re.sub('[\_\#\,\/\;\!\$\%\&\?\@]', ' ', comfilename)
|
|
|
|
d_filename = re.sub('[\:\-\+\']', '#', d_filename)
|
2013-01-28 20:31:43 +00:00
|
|
|
|
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
|
|
|
#strip extraspaces
|
|
|
|
d_filename = re.sub('\s+', ' ', d_filename)
|
|
|
|
cfilename = re.sub('\s+', ' ', cfilename)
|
|
|
|
|
2014-01-16 20:25:02 +00:00
|
|
|
#versioning - remove it
|
|
|
|
subsplit = cfilename.replace('_', ' ').split()
|
|
|
|
volno = None
|
|
|
|
volyr = None
|
|
|
|
for subit in subsplit:
|
|
|
|
if subit[0].lower() == 'v':
|
|
|
|
vfull = 0
|
|
|
|
if subit[1:].isdigit():
|
|
|
|
#if in format v1, v2009 etc...
|
|
|
|
if len(subit) > 3:
|
|
|
|
# if it's greater than 3 in length, then the format is Vyyyy
|
|
|
|
vfull = 1 # add on 1 character length to account for extra space
|
|
|
|
cfilename = re.sub(subit, '', cfilename)
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
d_filename = re.sub(subit, '', d_filename)
|
2014-01-16 20:25:02 +00:00
|
|
|
volno = re.sub("[^0-9]", " ", subit)
|
|
|
|
elif subit.lower()[:3] == 'vol':
|
|
|
|
#if in format vol.2013 etc
|
|
|
|
#because the '.' in Vol. gets removed, let's loop thru again after the Vol hit to remove it entirely
|
|
|
|
logger.fdebug('volume indicator detected as version #:' + str(subit))
|
|
|
|
cfilename = re.sub(subit, '', cfilename)
|
2014-02-26 19:48:50 +00:00
|
|
|
cfilename = " ".join(cfilename.split())
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
d_filename = re.sub(subit, '', d_filename)
|
|
|
|
d_filename = " ".join(d_filename.split())
|
2014-02-26 19:48:50 +00:00
|
|
|
volyr = re.sub("[^0-9]", " ", subit).strip()
|
|
|
|
logger.fdebug('volume year set as : ' + str(volyr))
|
2013-01-28 20:31:43 +00:00
|
|
|
cm_cn = 0
|
|
|
|
|
2014-01-16 20:25:02 +00:00
|
|
|
#we need to track the counter to make sure we are comparing the right array parts
|
2013-01-28 20:31:43 +00:00
|
|
|
#this takes care of the brackets :)
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
m = re.findall('[^()]+', d_filename) #cfilename)
|
2013-01-28 20:31:43 +00:00
|
|
|
lenm = len(m)
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug("there are " + str(lenm) + " words.")
|
2013-01-28 20:31:43 +00:00
|
|
|
cnt = 0
|
|
|
|
yearmatch = "false"
|
|
|
|
foundonwatch = "False"
|
2013-04-26 03:45:02 +00:00
|
|
|
issue = 999999
|
2013-01-28 20:31:43 +00:00
|
|
|
|
2014-01-16 20:25:02 +00:00
|
|
|
|
2013-01-28 20:31:43 +00:00
|
|
|
while (cnt < lenm):
|
|
|
|
if m[cnt] is None: break
|
|
|
|
if m[cnt] == ' ':
|
|
|
|
pass
|
|
|
|
else:
|
2013-03-29 04:02:35 +00:00
|
|
|
logger.fdebug(str(cnt) + ". Bracket Word: " + m[cnt])
|
2013-01-28 20:31:43 +00:00
|
|
|
if cnt == 0:
|
|
|
|
comic_andiss = m[cnt]
|
2013-03-29 04:02:35 +00:00
|
|
|
logger.fdebug("Comic: " + comic_andiss)
|
2013-02-06 19:55:23 +00:00
|
|
|
# if it's not in the standard format this will bork.
|
|
|
|
# let's try to accomodate (somehow).
|
|
|
|
# first remove the extension (if any)
|
|
|
|
extensions = ('cbr', 'cbz')
|
|
|
|
if comic_andiss.lower().endswith(extensions):
|
|
|
|
comic_andiss = comic_andiss[:-4]
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug("removed extension from filename.")
|
2013-02-06 19:55:23 +00:00
|
|
|
#now we have to break up the string regardless of formatting.
|
|
|
|
#let's force the spaces.
|
|
|
|
comic_andiss = re.sub('_', ' ', comic_andiss)
|
|
|
|
cs = comic_andiss.split()
|
|
|
|
cs_len = len(cs)
|
|
|
|
cn = ''
|
|
|
|
ydetected = 'no'
|
|
|
|
idetected = 'no'
|
2013-02-14 18:56:55 +00:00
|
|
|
decimaldetect = 'no'
|
2013-02-06 19:55:23 +00:00
|
|
|
for i in reversed(xrange(len(cs))):
|
|
|
|
#start at the end.
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug("word: " + str(cs[i]))
|
2013-03-29 04:02:35 +00:00
|
|
|
#assume once we find issue - everything prior is the actual title
|
|
|
|
#idetected = no will ignore everything so it will assume all title
|
|
|
|
if cs[i][:-2] == '19' or cs[i][:-2] == '20' and idetected == 'no':
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug("year detected: " + str(cs[i]))
|
2013-02-06 19:55:23 +00:00
|
|
|
ydetected = 'yes'
|
|
|
|
result_comyear = cs[i]
|
2013-02-14 18:56:55 +00:00
|
|
|
elif cs[i].isdigit() and idetected == 'no' or '.' in cs[i]:
|
|
|
|
if '.' in cs[i]:
|
|
|
|
#make sure it's a number on either side of decimal and assume decimal issue.
|
|
|
|
decst = cs[i].find('.')
|
|
|
|
dec_st = cs[i][:decst]
|
|
|
|
dec_en = cs[i][decst+1:]
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug("st: " + str(dec_st))
|
|
|
|
logger.fdebug("en: " + str(dec_en))
|
2013-02-14 18:56:55 +00:00
|
|
|
if dec_st.isdigit() and dec_en.isdigit():
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug("decimal issue detected...adjusting.")
|
2013-02-14 18:56:55 +00:00
|
|
|
issue = dec_st + "." + dec_en
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug("issue detected: " + str(issue))
|
2013-02-14 18:56:55 +00:00
|
|
|
idetected = 'yes'
|
|
|
|
else:
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug("false decimal represent. Chunking to extra word.")
|
2013-02-14 18:56:55 +00:00
|
|
|
cn = cn + cs[i] + " "
|
|
|
|
break
|
2014-09-10 06:37:05 +00:00
|
|
|
issue = cs[i]
|
|
|
|
logger.fdebug("issue detected : " + str(issue))
|
|
|
|
idetected = 'yes'
|
|
|
|
|
2013-02-14 18:56:55 +00:00
|
|
|
elif '\#' in cs[i] or decimaldetect == 'yes':
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug("issue detected: " + str(cs[i]))
|
2013-02-06 19:55:23 +00:00
|
|
|
idetected = 'yes'
|
|
|
|
else: cn = cn + cs[i] + " "
|
|
|
|
if ydetected == 'no':
|
|
|
|
#assume no year given in filename...
|
|
|
|
result_comyear = "0000"
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug("cm?: " + str(cn))
|
2013-04-26 03:45:02 +00:00
|
|
|
if issue is not '999999':
|
|
|
|
comiss = issue
|
|
|
|
else:
|
|
|
|
logger.ERROR("Invalid Issue number (none present) for " + comfilename)
|
|
|
|
break
|
2013-02-06 19:55:23 +00:00
|
|
|
cnsplit = cn.split()
|
|
|
|
cname = ''
|
|
|
|
findcn = 0
|
|
|
|
while (findcn < len(cnsplit)):
|
|
|
|
cname = cname + cs[findcn] + " "
|
|
|
|
findcn+=1
|
2013-02-14 18:56:55 +00:00
|
|
|
cname = cname[:len(cname)-1] # drop the end space...
|
2013-03-29 04:02:35 +00:00
|
|
|
print ("assuming name is : " + cname)
|
2013-02-14 18:56:55 +00:00
|
|
|
com_NAME = cname
|
2013-03-29 04:02:35 +00:00
|
|
|
print ("com_NAME : " + com_NAME)
|
2013-02-06 19:55:23 +00:00
|
|
|
yearmatch = "True"
|
2013-04-22 03:11:12 +00:00
|
|
|
else:
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('checking ' + m[cnt])
|
2013-04-22 03:11:12 +00:00
|
|
|
# we're assuming that the year is in brackets (and it should be damnit)
|
|
|
|
if m[cnt][:-2] == '19' or m[cnt][:-2] == '20':
|
|
|
|
print ("year detected: " + str(m[cnt]))
|
|
|
|
ydetected = 'yes'
|
|
|
|
result_comyear = m[cnt]
|
2014-02-26 19:48:50 +00:00
|
|
|
elif m[cnt][:3].lower() in datelist:
|
|
|
|
logger.fdebug('possible issue date format given - verifying')
|
|
|
|
#if the date of the issue is given as (Jan 2010) or (January 2010) let's adjust.
|
|
|
|
#keeping in mind that ',' and '.' are already stripped from the string
|
|
|
|
if m[cnt][-4:].isdigit():
|
|
|
|
ydetected = 'yes'
|
|
|
|
result_comyear = m[cnt][-4:]
|
|
|
|
logger.fdebug('Valid Issue year of ' + str(result_comyear) + 'detected in format of ' + str(m[cnt]))
|
2013-01-28 20:31:43 +00:00
|
|
|
cnt+=1
|
|
|
|
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
displength = len(cname)
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
logger.fdebug('cname length : ' + str(displength) + ' --- ' + str(cname))
|
|
|
|
logger.fdebug('d_filename is : ' + d_filename)
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
charcount = d_filename.count('#')
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
logger.fdebug('charcount is : ' + str(charcount))
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
if charcount > 0:
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
logger.fdebug('entering loop')
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
for i,m in enumerate(re.finditer('\#', d_filename)):
|
|
|
|
if m.end() <= displength:
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
logger.fdebug(comfilename[m.start():m.end()])
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
# find occurance in c_filename, then replace into d_filname so special characters are brought across
|
|
|
|
newchar = comfilename[m.start():m.end()]
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
logger.fdebug('newchar:' + str(newchar))
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
d_filename = d_filename[:m.start()] + str(newchar) + d_filename[m.end():]
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
logger.fdebug('d_filename:' + str(d_filename))
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
|
|
|
|
dispname = d_filename[:displength]
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
logger.fdebug('dispname : ' + dispname)
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
|
2013-01-28 20:31:43 +00:00
|
|
|
splitit = []
|
|
|
|
watchcomic_split = []
|
2014-01-16 20:25:02 +00:00
|
|
|
logger.fdebug("filename comic and issue: " + comic_andiss)
|
|
|
|
|
2013-01-28 20:31:43 +00:00
|
|
|
#changed this from '' to ' '
|
2014-01-16 20:25:02 +00:00
|
|
|
comic_iss_b4 = re.sub('[\-\:\,]', ' ', comic_andiss)
|
2013-01-28 20:31:43 +00:00
|
|
|
comic_iss = comic_iss_b4.replace('.',' ')
|
2014-01-16 20:25:02 +00:00
|
|
|
comic_iss = re.sub('[\s+]', ' ', comic_iss).strip()
|
|
|
|
logger.fdebug("adjusted comic and issue: " + str(comic_iss))
|
2013-02-09 03:34:02 +00:00
|
|
|
#remove 'the' from here for proper comparisons.
|
|
|
|
if ' the ' in comic_iss.lower():
|
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
|
|
|
comic_iss = re.sub('\\bthe\\b','', comic_iss).strip()
|
2013-01-28 20:31:43 +00:00
|
|
|
splitit = comic_iss.split(None)
|
|
|
|
logger.fdebug("adjusting from: " + str(comic_iss_b4) + " to: " + str(comic_iss))
|
|
|
|
#here we cycle through the Watchlist looking for a match.
|
|
|
|
while (cm_cn < watchcnt):
|
|
|
|
#setup the watchlist
|
|
|
|
comname = ComicName[cm_cn]
|
|
|
|
comyear = ComicYear[cm_cn]
|
|
|
|
compub = ComicPublisher[cm_cn]
|
|
|
|
comtotal = ComicTotal[cm_cn]
|
|
|
|
comicid = ComicID[cm_cn]
|
|
|
|
watch_location = ComicLocation[cm_cn]
|
|
|
|
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
# there shouldn't be an issue in the comic now, so let's just assume it's all gravy.
|
2013-02-14 18:56:55 +00:00
|
|
|
splitst = len(splitit)
|
2013-03-29 04:02:35 +00:00
|
|
|
watchcomic_split = helpers.cleanName(comname)
|
2013-01-28 20:31:43 +00:00
|
|
|
watchcomic_split = re.sub('[\-\:\,\.]', ' ', watchcomic_split).split(None)
|
|
|
|
|
|
|
|
logger.fdebug(str(splitit) + " file series word count: " + str(splitst))
|
|
|
|
logger.fdebug(str(watchcomic_split) + " watchlist word count: " + str(len(watchcomic_split)))
|
|
|
|
if (splitst) != len(watchcomic_split):
|
|
|
|
logger.fdebug("incorrect comic lengths...not a match")
|
2013-02-09 03:34:02 +00:00
|
|
|
# if str(splitit[0]).lower() == "the":
|
|
|
|
# logger.fdebug("THE word detected...attempting to adjust pattern matching")
|
|
|
|
# splitit[0] = splitit[4:]
|
2013-01-28 20:31:43 +00:00
|
|
|
else:
|
|
|
|
logger.fdebug("length match..proceeding")
|
|
|
|
n = 0
|
|
|
|
scount = 0
|
|
|
|
logger.fdebug("search-length: " + str(splitst))
|
|
|
|
logger.fdebug("Watchlist-length: " + str(len(watchcomic_split)))
|
|
|
|
while ( n <= (splitst)-1 ):
|
|
|
|
logger.fdebug("splitit: " + str(splitit[n]))
|
|
|
|
if n < (splitst) and n < len(watchcomic_split):
|
|
|
|
logger.fdebug(str(n) + " Comparing: " + str(watchcomic_split[n]) + " .to. " + str(splitit[n]))
|
|
|
|
if '+' in watchcomic_split[n]:
|
|
|
|
watchcomic_split[n] = re.sub('+', '', str(watchcomic_split[n]))
|
|
|
|
if str(watchcomic_split[n].lower()) in str(splitit[n].lower()) and len(watchcomic_split[n]) >= len(splitit[n]):
|
|
|
|
logger.fdebug("word matched on : " + str(splitit[n]))
|
|
|
|
scount+=1
|
|
|
|
#elif ':' in splitit[n] or '-' in splitit[n]:
|
|
|
|
# splitrep = splitit[n].replace('-', '')
|
|
|
|
# print ("non-character keyword...skipped on " + splitit[n])
|
2013-02-06 19:55:23 +00:00
|
|
|
elif str(splitit[n]).lower().startswith('v'):
|
2013-01-28 20:31:43 +00:00
|
|
|
logger.fdebug("possible versioning..checking")
|
|
|
|
#we hit a versioning # - account for it
|
|
|
|
if splitit[n][1:].isdigit():
|
|
|
|
comicversion = str(splitit[n])
|
|
|
|
logger.fdebug("version found: " + str(comicversion))
|
|
|
|
else:
|
|
|
|
logger.fdebug("Comic / Issue section")
|
|
|
|
if splitit[n].isdigit():
|
|
|
|
logger.fdebug("issue detected")
|
|
|
|
else:
|
|
|
|
logger.fdebug("non-match for: "+ str(splitit[n]))
|
|
|
|
pass
|
|
|
|
n+=1
|
|
|
|
#set the match threshold to 80% (for now)
|
|
|
|
# if it's less than 80% consider it a non-match and discard.
|
|
|
|
#splitit has to splitit-1 because last position is issue.
|
|
|
|
wordcnt = int(scount)
|
|
|
|
logger.fdebug("scount:" + str(wordcnt))
|
|
|
|
totalcnt = int(splitst)
|
|
|
|
logger.fdebug("splitit-len:" + str(totalcnt))
|
|
|
|
spercent = (wordcnt/totalcnt) * 100
|
|
|
|
logger.fdebug("we got " + str(spercent) + " percent.")
|
|
|
|
if int(spercent) >= 80:
|
|
|
|
logger.fdebug("it's a go captain... - we matched " + str(spercent) + "%!")
|
|
|
|
logger.fdebug("this should be a match!")
|
2013-02-14 18:56:55 +00:00
|
|
|
logger.fdebug("issue we found for is : " + str(comiss))
|
|
|
|
#set the year to the series we just found ;)
|
|
|
|
result_comyear = comyear
|
2013-01-28 20:31:43 +00:00
|
|
|
#issue comparison now as well
|
2013-03-29 04:02:35 +00:00
|
|
|
logger.info(u"Found " + comname + " (" + str(comyear) + ") issue: " + str(comiss))
|
2013-02-13 01:27:24 +00:00
|
|
|
watchmatch = str(comicid)
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
dispname = DisplayName[cm_cn]
|
2013-01-28 20:31:43 +00:00
|
|
|
foundonwatch = "True"
|
|
|
|
break
|
|
|
|
elif int(spercent) < 80:
|
|
|
|
logger.fdebug("failure - we only got " + str(spercent) + "% right!")
|
|
|
|
cm_cn+=1
|
|
|
|
|
|
|
|
if foundonwatch == "False":
|
2013-02-13 01:27:24 +00:00
|
|
|
watchmatch = None
|
2013-01-28 20:31:43 +00:00
|
|
|
#---if it's not a match - send it to the importer.
|
2013-02-13 01:27:24 +00:00
|
|
|
n = 0
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
|
2014-01-16 20:25:02 +00:00
|
|
|
if volyr is None:
|
|
|
|
if result_comyear is None:
|
|
|
|
result_comyear = '0000' #no year in filename basically.
|
|
|
|
else:
|
|
|
|
if result_comyear is None:
|
|
|
|
result_comyear = volyr
|
2014-02-26 19:48:50 +00:00
|
|
|
if volno is None:
|
|
|
|
if volyr is None:
|
|
|
|
vol_label = None
|
|
|
|
else:
|
|
|
|
vol_label = volyr
|
|
|
|
else:
|
|
|
|
vol_label = volno
|
2014-01-16 20:25:02 +00:00
|
|
|
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
logger.fdebug("adding " + com_NAME + " to the import-queue!")
|
|
|
|
impid = dispname + '-' + str(result_comyear) + '-' + str(comiss) #com_NAME + "-" + str(result_comyear) + "-" + str(comiss)
|
|
|
|
logger.fdebug("impid: " + str(impid))
|
2013-02-13 01:27:24 +00:00
|
|
|
import_by_comicids.append({
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
"impid" : impid,
|
|
|
|
"watchmatch" : watchmatch,
|
|
|
|
"displayname" : dispname,
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
"comicname" : dispname, #com_NAME,
|
IMP: Removed unneeded code from several modules, IMP:(#659) Subdirectories now will be scanned in properly when in series directories, FIX:(#635)(#658) Moved code from html into module to allow for better integration and further templating needs, IMP: Added ability for mylar to auto-grab SABnzbd API when provided with user/pass, IMP: Test SABnzbd button works again - will auto-rollback to NZBKey usage, IMP: Added counts to Upcoming page, IMP: Added some more detailed parsing to the ImportResults, IMP: ImportResults will now show proper series title, IMP: Improved some logic when determining if a new weekly issue is on a watchlist if a rebooted series, IMP: A bunch of smaller fixes, and some various code tweaks...
2014-04-02 19:08:59 +00:00
|
|
|
"comicyear" : result_comyear,
|
|
|
|
"volume" : vol_label,
|
2013-02-13 01:27:24 +00:00
|
|
|
"comfilename" : comfilename,
|
|
|
|
"comlocation" : comlocation.decode(mylar.SYS_ENCODING)
|
|
|
|
})
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
logger.fdebug('import_by_ids: ' + str(import_by_comicids))
|
2013-01-28 20:31:43 +00:00
|
|
|
|
|
|
|
if len(watch_kchoice) > 0:
|
|
|
|
watchchoice['watchlist'] = watch_kchoice
|
|
|
|
print ("watchchoice: " + str(watchchoice))
|
|
|
|
|
|
|
|
logger.info("I have found " + str(watchfound) + " out of " + str(comiccnt) + " comics for series that are being watched.")
|
|
|
|
wat = 0
|
|
|
|
comicids = []
|
|
|
|
|
|
|
|
if watchfound > 0:
|
|
|
|
if mylar.IMP_MOVE:
|
|
|
|
logger.info("You checked off Move Files...so that's what I'm going to do")
|
|
|
|
#check to see if Move Files is enabled.
|
|
|
|
#if not being moved, set the archive bit.
|
|
|
|
print("Moving files into appropriate directory")
|
|
|
|
while (wat < watchfound):
|
|
|
|
watch_the_list = watchchoice['watchlist'][wat]
|
|
|
|
watch_comlocation = watch_the_list['ComicLocation']
|
|
|
|
watch_comicid = watch_the_list['ComicID']
|
|
|
|
watch_comicname = watch_the_list['ComicName']
|
|
|
|
watch_comicyear = watch_the_list['ComicYear']
|
|
|
|
watch_comiciss = watch_the_list['ComicIssue']
|
|
|
|
print ("ComicLocation: " + str(watch_comlocation))
|
|
|
|
orig_comlocation = watch_the_list['OriginalLocation']
|
|
|
|
orig_filename = watch_the_list['OriginalFilename']
|
|
|
|
print ("Orig. Location: " + str(orig_comlocation))
|
|
|
|
print ("Orig. Filename: " + str(orig_filename))
|
|
|
|
#before moving check to see if Rename to Mylar structure is enabled.
|
|
|
|
if mylar.IMP_RENAME:
|
|
|
|
print("Renaming files according to configuration details : " + str(mylar.FILE_FORMAT))
|
|
|
|
renameit = helpers.rename_param(watch_comicid, watch_comicname, watch_comicyear, watch_comiciss)
|
|
|
|
nfilename = renameit['nfilename']
|
|
|
|
|
|
|
|
dst_path = os.path.join(watch_comlocation,nfilename)
|
|
|
|
if str(watch_comicid) not in comicids:
|
|
|
|
comicids.append(watch_comicid)
|
|
|
|
else:
|
|
|
|
print("Renaming files not enabled, keeping original filename(s)")
|
|
|
|
dst_path = os.path.join(watch_comlocation,orig_filename)
|
|
|
|
|
|
|
|
#os.rename(os.path.join(self.nzb_folder, str(ofilename)), os.path.join(self.nzb_folder,str(nfilename + ext)))
|
|
|
|
#src = os.path.join(, str(nfilename + ext))
|
|
|
|
print ("I'm going to move " + str(orig_comlocation) + " to .." + str(dst_path))
|
|
|
|
try:
|
|
|
|
shutil.move(orig_comlocation, dst_path)
|
|
|
|
except (OSError, IOError):
|
|
|
|
logger.info("Failed to move directory - check directories and manually re-run.")
|
|
|
|
wat+=1
|
|
|
|
else:
|
|
|
|
# if move files isn't enabled, let's set all found comics to Archive status :)
|
|
|
|
while (wat < watchfound):
|
|
|
|
watch_the_list = watchchoice['watchlist'][wat]
|
|
|
|
watch_comicid = watch_the_list['ComicID']
|
|
|
|
watch_issue = watch_the_list['ComicIssue']
|
|
|
|
print ("ComicID: " + str(watch_comicid))
|
|
|
|
print ("Issue#: " + str(watch_issue))
|
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
|
|
|
issuechk = myDB.selectone("SELECT * from issues where ComicID=? AND INT_IssueNumber=?", [watch_comicid, watch_issue]).fetchone()
|
2013-01-28 20:31:43 +00:00
|
|
|
if issuechk is None:
|
|
|
|
print ("no matching issues for this comic#")
|
|
|
|
else:
|
|
|
|
print("...Existing status: " + str(issuechk['Status']))
|
|
|
|
control = {"IssueID": issuechk['IssueID']}
|
|
|
|
values = { "Status": "Archived"}
|
|
|
|
print ("...changing status of " + str(issuechk['Issue_Number']) + " to Archived ")
|
|
|
|
myDB.upsert("issues", values, control)
|
|
|
|
if str(watch_comicid) not in comicids:
|
|
|
|
comicids.append(watch_comicid)
|
|
|
|
wat+=1
|
|
|
|
if comicids is None: pass
|
|
|
|
else:
|
|
|
|
c_upd = len(comicids)
|
|
|
|
c = 0
|
|
|
|
while (c < c_upd ):
|
|
|
|
print ("Rescanning.. " + str(c))
|
|
|
|
updater.forceRescan(c)
|
|
|
|
if not len(import_by_comicids):
|
|
|
|
return "Completed"
|
|
|
|
if len(import_by_comicids) > 0:
|
|
|
|
import_comicids['comic_info'] = import_by_comicids
|
|
|
|
print ("import comicids: " + str(import_by_comicids))
|
2013-02-06 19:55:23 +00:00
|
|
|
return import_comicids, len(import_by_comicids)
|
2014-09-10 04:54:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
def scanLibrary(scan=None, queue=None):
|
|
|
|
valreturn = []
|
|
|
|
if scan:
|
|
|
|
try:
|
|
|
|
soma,noids = libraryScan()
|
|
|
|
except Exception, e:
|
|
|
|
logger.error('Unable to complete the scan: %s' % e)
|
|
|
|
return
|
|
|
|
if soma == "Completed":
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
logger.info('Sucessfully completed import.')
|
2014-09-10 04:54:53 +00:00
|
|
|
else:
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
logger.info('Starting mass importing...' + str(noids) + ' records.')
|
2014-09-10 04:54:53 +00:00
|
|
|
#this is what it should do...
|
|
|
|
#store soma (the list of comic_details from importing) into sql table so import can be whenever
|
|
|
|
#display webpage showing results
|
|
|
|
#allow user to select comic to add (one at a time)
|
|
|
|
#call addComic off of the webpage to initiate the add.
|
|
|
|
#return to result page to finish or continue adding.
|
|
|
|
#....
|
|
|
|
#threading.Thread(target=self.searchit).start()
|
|
|
|
#threadthis = threadit.ThreadUrl()
|
|
|
|
#result = threadthis.main(soma)
|
|
|
|
myDB = db.DBConnection()
|
|
|
|
sl = 0
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
logger.fdebug("number of records: " + str(noids))
|
2014-09-10 04:54:53 +00:00
|
|
|
while (sl < int(noids)):
|
|
|
|
soma_sl = soma['comic_info'][sl]
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
logger.fdebug("soma_sl: " + str(soma_sl))
|
|
|
|
logger.fdebug("comicname: " + soma_sl['comicname'].encode('utf-8'))
|
|
|
|
logger.fdebug("filename: " + soma_sl['comfilename'].encode('utf-8'))
|
2014-09-10 04:54:53 +00:00
|
|
|
controlValue = {"impID": soma_sl['impid']}
|
|
|
|
newValue = {"ComicYear": soma_sl['comicyear'],
|
|
|
|
"Status": "Not Imported",
|
|
|
|
"ComicName": soma_sl['comicname'].encode('utf-8'),
|
|
|
|
"DisplayName": soma_sl['displayname'].encode('utf-8'),
|
|
|
|
"ComicFilename": soma_sl['comfilename'].encode('utf-8'),
|
|
|
|
"ComicLocation": soma_sl['comlocation'].encode('utf-8'),
|
|
|
|
"ImportDate": helpers.today(),
|
|
|
|
"WatchMatch": soma_sl['watchmatch']}
|
|
|
|
myDB.upsert("importresults", newValue, controlValue)
|
|
|
|
sl+=1
|
|
|
|
# because we could be adding volumes/series that span years, we need to account for this
|
|
|
|
# add the year to the db under the term, valid-years
|
|
|
|
# add the issue to the db under the term, min-issue
|
|
|
|
|
|
|
|
#locate metadata here.
|
|
|
|
# unzip -z filename.cbz will show the comment field of the zip which contains the metadata.
|
|
|
|
|
|
|
|
#self.importResults()
|
|
|
|
valreturn.append({"somevalue" : 'self.ie',
|
|
|
|
"result" : 'success'})
|
|
|
|
return queue.put(valreturn)
|
|
|
|
#raise cherrypy.HTTPRedirect("importResults")
|
|
|
|
|