2012-09-13 15:27:34 +00:00
|
|
|
#/usr/bin/env python
|
|
|
|
# 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/>.
|
|
|
|
|
|
|
|
import os
|
|
|
|
import os.path
|
2014-05-29 18:05:11 +00:00
|
|
|
import zlib
|
2012-09-13 15:27:34 +00:00
|
|
|
import pprint
|
|
|
|
import subprocess
|
2012-12-31 16:52:16 +00:00
|
|
|
import re
|
2014-05-26 18:11:39 +00:00
|
|
|
#import logger
|
2013-04-22 03:43:57 +00:00
|
|
|
import mylar
|
2014-05-26 18:11:39 +00:00
|
|
|
from mylar import logger, helpers
|
|
|
|
import unicodedata
|
2013-04-22 17:12:29 +00:00
|
|
|
import sys
|
2014-03-21 18:48:25 +00:00
|
|
|
import platform
|
2012-09-13 15:27:34 +00:00
|
|
|
|
|
|
|
def file2comicmatch(watchmatch):
|
|
|
|
#print ("match: " + str(watchmatch))
|
|
|
|
pass
|
|
|
|
|
2014-02-26 19:48:50 +00:00
|
|
|
def listFiles(dir,watchcomic,Publisher,AlternateSearch=None,manual=None,sarc=None):
|
2013-08-11 05:31:41 +00:00
|
|
|
|
2013-01-07 20:35:17 +00:00
|
|
|
# use AlternateSearch to check for filenames that follow that naming pattern
|
|
|
|
# ie. Star Trek TNG Doctor Who Assimilation won't get hits as the
|
|
|
|
# checker looks for Star Trek TNG Doctor Who Assimilation2 (according to CV)
|
2013-03-08 01:36:36 +00:00
|
|
|
|
|
|
|
# we need to convert to ascii, as watchcomic is utf-8 and special chars f'it up
|
2014-05-26 18:11:39 +00:00
|
|
|
u_watchcomic = unicodedata.normalize('NFKD', watchcomic).encode('ASCII', 'ignore') #watchcomic.encode('ascii', 'ignore').strip()
|
|
|
|
logger.fdebug('[FILECHECKER] comic: ' + u_watchcomic)
|
2012-09-13 15:27:34 +00:00
|
|
|
basedir = dir
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] Looking in: ' + dir)
|
2012-09-13 15:27:34 +00:00
|
|
|
watchmatch = {}
|
|
|
|
comiclist = []
|
|
|
|
comiccnt = 0
|
2013-07-06 02:42:58 +00:00
|
|
|
not_these = ['#',
|
2013-05-15 09:09:43 +00:00
|
|
|
',',
|
2013-05-09 02:22:47 +00:00
|
|
|
'\/',
|
2013-05-25 06:18:00 +00:00
|
|
|
':',
|
2013-05-09 02:22:47 +00:00
|
|
|
'\;',
|
|
|
|
'.',
|
2013-05-15 09:09:43 +00:00
|
|
|
'-',
|
2013-09-18 04:49:24 +00:00
|
|
|
'!',
|
2013-05-09 02:22:47 +00:00
|
|
|
'\$',
|
|
|
|
'\%',
|
|
|
|
'\+',
|
|
|
|
'\'',
|
|
|
|
'\?',
|
|
|
|
'\@']
|
|
|
|
|
2013-08-05 05:50:38 +00:00
|
|
|
issue_exceptions = ['AU',
|
2013-12-30 19:30:50 +00:00
|
|
|
'.INH',
|
|
|
|
'.NOW',
|
2013-08-05 05:50:38 +00:00
|
|
|
'AI',
|
|
|
|
'A',
|
|
|
|
'B',
|
|
|
|
'C']
|
2013-05-09 02:22:47 +00:00
|
|
|
|
2014-02-26 19:48:50 +00:00
|
|
|
extensions = ('.cbr', '.cbz')
|
|
|
|
|
2014-03-19 19:04:00 +00:00
|
|
|
# #get the entire tree here
|
|
|
|
dirlist = traverse_directories(basedir)
|
|
|
|
|
|
|
|
# for item in os.listdir(basedir):
|
|
|
|
for fname in dirlist:
|
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
|
|
|
moddir = None
|
2014-03-19 19:04:00 +00:00
|
|
|
# at a later point, we should store the basedir and scan it in for additional info, since some users
|
|
|
|
# have their structure setup as 'Batman v2 (2011)/Batman #1.cbz' or 'Batman/V2-(2011)/Batman #1.cbz'
|
|
|
|
if fname['directory'] == '':
|
|
|
|
basedir = dir
|
|
|
|
else:
|
2014-03-21 18:48:25 +00:00
|
|
|
basedir = fname['directory']
|
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 it's a subdir, strip out the main dir and retain the remainder for the filechecker to find it.
|
|
|
|
#start at position 1 so the initial slash is removed since it's a sub, and os.path.join will choke.
|
|
|
|
moddir = basedir.replace(dir,'')[1:].rstrip()
|
2014-03-21 18:48:25 +00:00
|
|
|
|
2014-03-19 19:04:00 +00:00
|
|
|
item = fname['filename']
|
2014-05-29 18:05:11 +00:00
|
|
|
|
|
|
|
#for mac OS metadata ignoring.
|
|
|
|
if item.startswith('._'):
|
|
|
|
logger.info('ignoring os metadata for ' + item)
|
|
|
|
continue
|
2014-03-19 19:04:00 +00:00
|
|
|
|
2013-07-30 04:57:37 +00:00
|
|
|
if item == 'cover.jpg' or item == 'cvinfo': continue
|
2014-04-14 18:10:10 +00:00
|
|
|
if not item.lower().endswith(extensions):
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] filename not a valid cbr/cbz - ignoring: ' + item)
|
|
|
|
continue
|
|
|
|
|
2012-09-13 15:27:34 +00:00
|
|
|
#print item
|
2012-12-31 16:52:16 +00:00
|
|
|
#subname = os.path.join(basedir, item)
|
|
|
|
subname = item
|
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
|
|
|
subname = re.sub('\_', ' ', subname)
|
2013-09-09 04:39:08 +00:00
|
|
|
|
2014-03-19 19:04:00 +00:00
|
|
|
#Remove html code for ( )
|
|
|
|
subname = re.sub(r'%28', '(', subname)
|
|
|
|
subname = re.sub(r'%29', ')', subname)
|
|
|
|
|
2013-02-20 19:34:55 +00:00
|
|
|
#versioning - remove it
|
2013-08-11 05:31:41 +00:00
|
|
|
subsplit = subname.replace('_', ' ').split()
|
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
|
|
|
volrem = None
|
2013-02-20 19:34:55 +00:00
|
|
|
for subit in subsplit:
|
2013-08-11 05:31:41 +00:00
|
|
|
if subit[0].lower() == 'v':
|
2013-05-09 02:22:47 +00:00
|
|
|
vfull = 0
|
2013-02-20 19:34:55 +00:00
|
|
|
if subit[1:].isdigit():
|
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
|
|
|
#if in format v1, v2009 etc...
|
2013-05-09 02:22:47 +00:00
|
|
|
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
|
2013-08-11 05:31:41 +00:00
|
|
|
subname = re.sub(subit, '', subname)
|
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
|
|
|
volrem = subit
|
2013-08-11 05:31:41 +00:00
|
|
|
elif subit.lower()[:3] == 'vol':
|
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
|
|
|
#if in format vol.2013 etc
|
|
|
|
#because the '.' in Vol. gets removed, let's loop thru again after the Vol hit to remove it entirely
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] volume indicator detected as version #:' + str(subit))
|
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
|
|
|
subname = re.sub(subit, '', subname)
|
|
|
|
volrem = subit
|
2013-05-09 02:22:47 +00:00
|
|
|
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
#check if a year is present in series title (ie. spider-man 2099)
|
2014-03-19 19:04:00 +00:00
|
|
|
#also check if decimal present in series title (ie. batman beyond 2.0)
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
numberinseries = 'False'
|
2014-03-19 19:04:00 +00:00
|
|
|
decimalinseries = 'False'
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
|
|
|
|
for i in watchcomic.split():
|
|
|
|
if ('20' in i or '19' in i):
|
|
|
|
if i.isdigit():
|
|
|
|
numberinseries = 'True'
|
|
|
|
else:
|
|
|
|
find20 = i.find('20')
|
|
|
|
if find20:
|
|
|
|
stf = i[find20:4].strip()
|
|
|
|
find19 = i.find('19')
|
|
|
|
if find19:
|
|
|
|
stf = i[find19:4].strip()
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] stf is : ' + str(stf))
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
if stf.isdigit():
|
|
|
|
numberinseries = 'True'
|
2014-03-19 19:04:00 +00:00
|
|
|
if ('.' in i):
|
|
|
|
try:
|
|
|
|
float(i)
|
|
|
|
decimalinseries = 'True'
|
|
|
|
std = i
|
|
|
|
logger.fdebug('[FILECHECKER] std is : ' + str(std))
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
|
|
|
|
logger.fdebug('[FILECHECKER] numberinseries: ' + str(numberinseries))
|
|
|
|
logger.fdebug('[FILECHECKER] decimalinseries: ' + str(decimalinseries))
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
|
2013-05-15 09:09:43 +00:00
|
|
|
#remove the brackets..
|
2013-08-07 06:27:12 +00:00
|
|
|
subnm = re.findall('[^()]+', subname)
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] subnm len : ' + str(len(subnm)))
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
if len(subnm) == 1:
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] ' + str(len(subnm)) + ': detected invalid filename - attempting to detect year to continue')
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
#if the series has digits this f's it up.
|
2014-03-19 19:04:00 +00:00
|
|
|
if numberinseries == 'True' or decimalinseries == 'True':
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
#we need to remove the series from the subname and then search the remainder.
|
2014-04-14 18:10:10 +00:00
|
|
|
watchname = re.sub('[\:\;\!\'\/\?\+\=\_\%\.]', '', watchcomic) #remove spec chars for watchcomic match.
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] watch-cleaned: ' + str(watchname))
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
subthis = re.sub('.cbr', '', subname)
|
|
|
|
subthis = re.sub('.cbz', '', subthis)
|
2014-04-14 18:10:10 +00:00
|
|
|
subthis = re.sub('[\:\;\!\'\/\?\+\=\_\%\.]', '', subthis)
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] sub-cleaned: ' + str(subthis))
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
subthis = subthis[len(watchname):] #remove watchcomic
|
|
|
|
#we need to now check the remainder of the string for digits assuming it's a possible year
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] new subname: ' + str(subthis))
|
2014-03-19 19:04:00 +00:00
|
|
|
subname = re.sub('(.*)[\s+|_+](19\d{2}|20\d{2})(.*)', '\\1 (\\2) \\3', subthis)
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
subname = watchcomic + subname
|
|
|
|
subnm = re.findall('[^()]+', subname)
|
|
|
|
else:
|
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
|
|
|
subit = re.sub('(.*)[\s+|_+](19\d{2}|20\d{2})(.*)', '\\1 \\3 (\\2)', subname).replace('( )', '')
|
2014-02-26 19:48:50 +00:00
|
|
|
subthis2 = re.sub('.cbr', '', subit)
|
|
|
|
subthis1 = re.sub('.cbz', '', subthis2)
|
2014-04-14 18:10:10 +00:00
|
|
|
subname = re.sub('[\:\;\!\'\/\?\+\=\_\%]', '', subthis1)
|
FIX:(#663) Weekly pull list would crash on issues with decimal places if series on watchlist, FIX: Error logging when performing search, FIX:(#662) Removed 'Test SABnzbd button' as was causing configuration saving issues. Can still be used by url : /SABtest, IMP: Added more logic checking to weeklypull list when comparing series for matches (to ensure an issue is part of a given series), IMP: Removed dead references to nzbx as a provider, FIX: If issue had no leading 0 in a decimal issue, mylar would crash, FIX: None status would occur when refreshing a series and more than one issue was being pulled in for data, IMP: When using manual post-processing, if issue date was near end/start of year issue comparison would fail. Comparison by month now added, FIX: file checking - if decimal in issue and no year present, would skip issue, FIX: manual post-processing - would fail/skip if no year provided for issue within filename, FIX: Manual Annual Add option will only be available if annuals_on=1 within the config.ini now
2014-04-07 16:20:05 +00:00
|
|
|
#if '.' appears more than once at this point, then it's being used in place of spaces.
|
|
|
|
#if '.' only appears once at this point, it's a decimal issue (since decimalinseries is False within this else stmt).
|
|
|
|
if len(str(subname.count('.'))) == 1:
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
logger.fdebug('[FILECHECKER] decimal issue detected, not removing decimals')
|
FIX:(#663) Weekly pull list would crash on issues with decimal places if series on watchlist, FIX: Error logging when performing search, FIX:(#662) Removed 'Test SABnzbd button' as was causing configuration saving issues. Can still be used by url : /SABtest, IMP: Added more logic checking to weeklypull list when comparing series for matches (to ensure an issue is part of a given series), IMP: Removed dead references to nzbx as a provider, FIX: If issue had no leading 0 in a decimal issue, mylar would crash, FIX: None status would occur when refreshing a series and more than one issue was being pulled in for data, IMP: When using manual post-processing, if issue date was near end/start of year issue comparison would fail. Comparison by month now added, FIX: file checking - if decimal in issue and no year present, would skip issue, FIX: manual post-processing - would fail/skip if no year provided for issue within filename, FIX: Manual Annual Add option will only be available if annuals_on=1 within the config.ini now
2014-04-07 16:20:05 +00:00
|
|
|
else:
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
logger.fdebug('[FILECHECKER] more than one decimal detected, and the series does not have decimals - assuming in place of spaces.')
|
FIX:(#663) Weekly pull list would crash on issues with decimal places if series on watchlist, FIX: Error logging when performing search, FIX:(#662) Removed 'Test SABnzbd button' as was causing configuration saving issues. Can still be used by url : /SABtest, IMP: Added more logic checking to weeklypull list when comparing series for matches (to ensure an issue is part of a given series), IMP: Removed dead references to nzbx as a provider, FIX: If issue had no leading 0 in a decimal issue, mylar would crash, FIX: None status would occur when refreshing a series and more than one issue was being pulled in for data, IMP: When using manual post-processing, if issue date was near end/start of year issue comparison would fail. Comparison by month now added, FIX: file checking - if decimal in issue and no year present, would skip issue, FIX: manual post-processing - would fail/skip if no year provided for issue within filename, FIX: Manual Annual Add option will only be available if annuals_on=1 within the config.ini now
2014-04-07 16:20:05 +00:00
|
|
|
subname = re.sub('[\.]', '', subname)
|
|
|
|
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
subnm = re.findall('[^()]+', subname)
|
2014-03-19 19:04:00 +00:00
|
|
|
|
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
|
|
|
subsplit = subname.replace('_', ' ').split()
|
2014-02-26 19:48:50 +00:00
|
|
|
|
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
|
|
|
if sarc is None:
|
|
|
|
if Publisher.lower() in re.sub('_', ' ', subname.lower()):
|
|
|
|
#if the Publisher is given within the title or filename even (for some reason, some people
|
|
|
|
#have this to distinguish different titles), let's remove it entirely.
|
|
|
|
lenm = len(subnm)
|
2014-02-26 19:48:50 +00:00
|
|
|
|
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
|
|
|
cnt = 0
|
|
|
|
pub_removed = None
|
|
|
|
|
|
|
|
while (cnt < lenm):
|
|
|
|
submod = re.sub('_', ' ', subnm[cnt])
|
|
|
|
if submod is None: break
|
|
|
|
if submod == ' ':
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
logger.fdebug('[FILECHECKER] ' + str(cnt) + ". Bracket Word: " + str(submod))
|
|
|
|
|
|
|
|
if Publisher.lower() in submod.lower() and cnt >= 1:
|
|
|
|
logger.fdebug('[FILECHECKER] Publisher detected within title : ' + str(submod))
|
|
|
|
logger.fdebug('[FILECHECKER] cnt is : ' + str(cnt) + ' --- Publisher is: ' + Publisher)
|
|
|
|
#-strip publisher if exists here-
|
|
|
|
pub_removed = submod
|
|
|
|
logger.fdebug('[FILECHECKER] removing publisher from title')
|
|
|
|
subname_pubremoved = re.sub(pub_removed, '', subname)
|
|
|
|
logger.fdebug('[FILECHECKER] pubremoved : ' + str(subname_pubremoved))
|
|
|
|
subname_pubremoved = re.sub('\(\)', '', subname_pubremoved) #remove empty brackets
|
|
|
|
subname_pubremoved = re.sub('\s+', ' ', subname_pubremoved) #remove spaces > 1
|
|
|
|
logger.fdebug('[FILECHECKER] blank brackets removed: ' + str(subname_pubremoved))
|
|
|
|
subnm = re.findall('[^()]+', subname_pubremoved)
|
|
|
|
break
|
|
|
|
cnt+=1
|
2014-03-19 19:04:00 +00:00
|
|
|
|
|
|
|
#If the Year comes before the Issue # the subname is passed with no Issue number.
|
|
|
|
#This logic checks for numbers before the extension in the format of 1 01 001
|
|
|
|
#and adds to the subname. (Cases where comic name is $Series_$Year_$Issue)
|
|
|
|
if len(subnm) > 1:
|
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
|
|
|
if (re.search('(19\d{2}|20\d{2})',subnm[1]) is not None):
|
2014-05-26 18:32:44 +00:00
|
|
|
logger.fdebug('[FILECHECKER] subnm0: ' + str(subnm[0]))
|
|
|
|
logger.fdebug('[FILECHECKER] subnm1: ' + str(subnm[1]))
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
# logger.fdebug('subnm2: ' + str(subnm[2]))
|
|
|
|
subname = str(subnm[0]).lstrip() + ' (' + str(subnm[1]).strip() + ') '
|
|
|
|
subnm = re.findall('[^()]+', subname) # we need to regenerate this here.
|
|
|
|
|
|
|
|
subname = subnm[0]
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
|
|
|
|
if len(subnm):
|
|
|
|
# if it still has no year (brackets), check setting and either assume no year needed.
|
|
|
|
subname = subname
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] subname no brackets: ' + str(subname))
|
2013-05-09 02:22:47 +00:00
|
|
|
nonocount = 0
|
2013-07-01 05:19:15 +00:00
|
|
|
charpos = 0
|
|
|
|
detneg = "no"
|
2014-01-16 20:25:02 +00:00
|
|
|
leavehyphen = False
|
2014-01-31 06:36:58 +00:00
|
|
|
should_restart = True
|
2014-04-14 18:10:10 +00:00
|
|
|
lenwatch = len(watchcomic) # because subname gets replaced dynamically, the length will change and things go wrong.
|
2014-01-31 06:36:58 +00:00
|
|
|
while should_restart:
|
|
|
|
should_restart = False
|
|
|
|
for nono in not_these:
|
|
|
|
if nono in subname:
|
|
|
|
subcnt = subname.count(nono)
|
|
|
|
charpos = indices(subname,nono) # will return a list of char positions in subname
|
|
|
|
#print "charpos: " + str(charpos)
|
|
|
|
if nono == '-':
|
|
|
|
i=0
|
|
|
|
while (i < len(charpos)):
|
|
|
|
for i,j in enumerate(charpos):
|
|
|
|
if j+2 > len(subname):
|
|
|
|
sublimit = subname[j+1:]
|
|
|
|
else:
|
|
|
|
sublimit = subname[j+1:j+2]
|
|
|
|
if sublimit.isdigit():
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] possible negative issue detected.')
|
2014-01-31 06:36:58 +00:00
|
|
|
nonocount = nonocount + subcnt - 1
|
|
|
|
detneg = "yes"
|
2014-04-14 18:10:10 +00:00
|
|
|
elif '-' in watchcomic and j < lenwatch:
|
|
|
|
lenwatch -=1
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] - appears in series title.')
|
|
|
|
logger.fdebug('[FILECHECKER] up to - :' + subname[:j+1].replace('-', ' '))
|
|
|
|
logger.fdebug('[FILECHECKER] after - :' + subname[j+1:])
|
2014-03-19 19:04:00 +00:00
|
|
|
subname = subname[:j+1].replace('-', '') + subname[j+1:]
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] new subname is : ' + str(subname))
|
2014-01-31 06:36:58 +00:00
|
|
|
should_restart = True
|
|
|
|
leavehyphen = True
|
|
|
|
i+=1
|
2014-04-14 18:10:10 +00:00
|
|
|
if detneg == "no" and leavehyphen == False:
|
2014-01-31 06:36:58 +00:00
|
|
|
subname = re.sub(str(nono), ' ', subname)
|
|
|
|
nonocount = nonocount + subcnt
|
2014-02-26 19:48:50 +00:00
|
|
|
#logger.fdebug('[FILECHECKER] (str(nono) + " detected " + str(subcnt) + " times.")
|
2013-05-09 02:22:47 +00:00
|
|
|
# segment '.' having a . by itself will denote the entire string which we don't want
|
2014-01-31 06:36:58 +00:00
|
|
|
elif nono == '.':
|
|
|
|
x = 0
|
|
|
|
fndit = 0
|
|
|
|
dcspace = 0
|
|
|
|
while x < subcnt:
|
|
|
|
fndit = subname.find(nono, fndit)
|
|
|
|
if subname[fndit-1:fndit].isdigit() and subname[fndit+1:fndit+2].isdigit():
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] decimal issue detected.')
|
2014-01-31 06:36:58 +00:00
|
|
|
dcspace+=1
|
|
|
|
x+=1
|
|
|
|
if dcspace == 1:
|
|
|
|
nonocount = nonocount + subcnt + dcspace
|
|
|
|
else:
|
|
|
|
subname = re.sub('\.', ' ', subname)
|
|
|
|
nonocount = nonocount + subcnt - 1 #(remove the extension from the length)
|
2013-08-04 05:57:21 +00:00
|
|
|
else:
|
2014-01-31 06:36:58 +00:00
|
|
|
#this is new - if it's a symbol seperated by a space on each side it drags in an extra char.
|
|
|
|
x = 0
|
|
|
|
fndit = 0
|
|
|
|
blspc = 0
|
|
|
|
while x < subcnt:
|
|
|
|
fndit = subname.find(nono, fndit)
|
|
|
|
#print ("space before check: " + str(subname[fndit-1:fndit]))
|
|
|
|
#print ("space after check: " + str(subname[fndit+1:fndit+2]))
|
|
|
|
if subname[fndit-1:fndit] == ' ' and subname[fndit+1:fndit+2] == ' ':
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] blankspace detected before and after ' + str(nono))
|
2014-01-31 06:36:58 +00:00
|
|
|
blspc+=1
|
|
|
|
x+=1
|
|
|
|
subname = re.sub(str(nono), ' ', subname)
|
|
|
|
nonocount = nonocount + subcnt + blspc
|
2013-05-09 02:22:47 +00:00
|
|
|
#subname = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\+\'\?\@]',' ', subname)
|
2014-03-19 19:04:00 +00:00
|
|
|
if decimalinseries == 'True':
|
|
|
|
modwatchcomic = re.sub('[\_\#\,\/\:\;\!\$\%\'\?\@]', ' ', u_watchcomic)
|
|
|
|
else:
|
|
|
|
modwatchcomic = re.sub('[\_\#\,\/\:\;\.\!\$\%\'\?\@]', ' ', u_watchcomic)
|
|
|
|
modwatchcomic = re.sub('[\-]', '', modwatchcomic) #trying this too - 2014-03-01
|
2014-01-16 20:25:02 +00:00
|
|
|
#if leavehyphen == False:
|
2014-02-26 19:48:50 +00:00
|
|
|
# logger.fdebug('[FILECHECKER] ('removing hyphen for comparisons')
|
2014-01-16 20:25:02 +00:00
|
|
|
# modwatchcomic = re.sub('-', ' ', modwatchcomic)
|
|
|
|
# subname = re.sub('-', ' ', subname)
|
2013-04-23 15:19:07 +00:00
|
|
|
detectand = False
|
2014-03-19 19:04:00 +00:00
|
|
|
detectthe_mod = False
|
|
|
|
detectthe_sub = False
|
2013-04-22 03:11:12 +00:00
|
|
|
modwatchcomic = re.sub('\&', ' and ', modwatchcomic)
|
2014-03-19 19:04:00 +00:00
|
|
|
if ' the ' in modwatchcomic.lower() or modwatchcomic.lower().startswith('the '):
|
2013-07-30 04:57:37 +00:00
|
|
|
modwatchcomic = re.sub("\\bthe\\b", "", modwatchcomic.lower())
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] new modwatchcomic: ' + str(modwatchcomic))
|
2014-03-19 19:04:00 +00:00
|
|
|
detectthe_mod = True
|
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
|
|
|
modwatchcomic = re.sub('\s+', ' ', str(modwatchcomic)).strip()
|
2013-04-23 15:19:07 +00:00
|
|
|
if '&' in subname:
|
|
|
|
subname = re.sub('\&', ' and ', subname)
|
|
|
|
detectand = True
|
2014-03-19 19:04:00 +00:00
|
|
|
if ' the ' in subname.lower() or subname.lower().startswith('the '):
|
2013-07-30 04:57:37 +00:00
|
|
|
subname = re.sub("\\bthe\\b", "", subname.lower())
|
2014-03-19 19:04:00 +00:00
|
|
|
detectthe_sub = True
|
2013-01-05 03:00:13 +00:00
|
|
|
subname = re.sub('\s+', ' ', str(subname)).strip()
|
2013-07-30 04:57:37 +00:00
|
|
|
|
|
|
|
AS_Alt = []
|
2013-01-07 20:35:17 +00:00
|
|
|
if AlternateSearch is not None:
|
2013-07-30 04:57:37 +00:00
|
|
|
chkthealt = AlternateSearch.split('##')
|
|
|
|
if chkthealt == 0:
|
|
|
|
AS_Alternate = AlternateSearch
|
|
|
|
for calt in chkthealt:
|
|
|
|
AS_Alternate = re.sub('##','',calt)
|
|
|
|
#same = encode.
|
|
|
|
u_altsearchcomic = AS_Alternate.encode('ascii', 'ignore').strip()
|
2014-03-19 19:04:00 +00:00
|
|
|
altsearchcomic = re.sub('[\_\#\,\/\:\;\.\!\$\%\+\'\?\@]', ' ', u_altsearchcomic)
|
|
|
|
altsearchcomic = re.sub('[\-]', '', altsearchcomic)
|
2013-08-06 03:20:09 +00:00
|
|
|
altsearchcomic = re.sub('\&', ' and ', altsearchcomic)
|
2013-07-30 04:57:37 +00:00
|
|
|
altsearchcomic = re.sub('\s+', ' ', str(altsearchcomic)).strip()
|
|
|
|
AS_Alt.append(altsearchcomic)
|
2013-01-07 20:35:17 +00:00
|
|
|
else:
|
|
|
|
#create random characters so it will never match.
|
|
|
|
altsearchcomic = "127372873872871091383 abdkhjhskjhkjdhakajhf"
|
2013-07-30 04:57:37 +00:00
|
|
|
AS_Alt.append(altsearchcomic)
|
2012-12-31 16:52:16 +00:00
|
|
|
#if '_' in subname:
|
|
|
|
# subname = subname.replace('_', ' ')
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] watchcomic:' + str(modwatchcomic) + ' ..comparing to found file: ' + str(subname))
|
2013-08-06 03:20:09 +00:00
|
|
|
if modwatchcomic.lower() in subname.lower() or any(x.lower() in subname.lower() for x in AS_Alt):#altsearchcomic.lower() in subname.lower():
|
2012-09-13 15:27:34 +00:00
|
|
|
comicpath = os.path.join(basedir, item)
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] ' + modwatchcomic + ' - watchlist match on : ' + comicpath)
|
2012-09-13 15:27:34 +00:00
|
|
|
comicsize = os.path.getsize(comicpath)
|
|
|
|
#print ("Comicsize:" + str(comicsize))
|
|
|
|
comiccnt+=1
|
2013-07-01 05:19:15 +00:00
|
|
|
|
|
|
|
stann = 0
|
|
|
|
if 'annual' in subname.lower():
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] Annual detected - proceeding')
|
2013-07-01 05:19:15 +00:00
|
|
|
jtd_len = subname.lower().find('annual')
|
2013-07-30 04:57:37 +00:00
|
|
|
cchk = modwatchcomic
|
2013-07-01 05:19:15 +00:00
|
|
|
else:
|
|
|
|
if modwatchcomic.lower() in subname.lower():
|
2013-07-30 04:57:37 +00:00
|
|
|
cchk = modwatchcomic
|
|
|
|
else:
|
2013-08-06 03:20:09 +00:00
|
|
|
cchk_ls = [x for x in AS_Alt if x.lower() in subname.lower()]
|
2013-07-30 04:57:37 +00:00
|
|
|
cchk = cchk_ls[0]
|
|
|
|
#print "something: " + str(cchk)
|
|
|
|
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] we should remove ' + str(nonocount) + ' characters')
|
2013-07-01 05:19:15 +00:00
|
|
|
|
2013-07-30 04:57:37 +00:00
|
|
|
findtitlepos = subname.find('-')
|
|
|
|
if charpos != 0:
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] detected ' + str(len(charpos)) + ' special characters')
|
2013-07-30 04:57:37 +00:00
|
|
|
i=0
|
|
|
|
while (i < len(charpos)):
|
|
|
|
for i,j in enumerate(charpos):
|
2014-04-14 18:10:10 +00:00
|
|
|
#logger.fdebug('i,j:' + str(i) + ',' + str(j))
|
|
|
|
#logger.fdebug(str(len(subname)) + ' - subname: ' + subname)
|
|
|
|
#logger.fdebug("digitchk: " + str(subname[j:]))
|
2013-07-30 04:57:37 +00:00
|
|
|
if j >= len(subname):
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] end reached. ignoring remainder.')
|
2013-07-30 04:57:37 +00:00
|
|
|
break
|
|
|
|
elif subname[j:] == '-':
|
2014-04-14 18:10:10 +00:00
|
|
|
if j <= len(subname) and subname[j+1].isdigit():
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] negative issue detected.')
|
2013-07-30 04:57:37 +00:00
|
|
|
#detneg = "yes"
|
|
|
|
elif j > findtitlepos:
|
|
|
|
if subname[j:] == '#':
|
2014-04-14 18:10:10 +00:00
|
|
|
if subname[j+1].isdigit():
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] # detected denoting issue#, ignoring.')
|
2013-07-30 04:57:37 +00:00
|
|
|
else:
|
2013-07-06 02:42:58 +00:00
|
|
|
nonocount-=1
|
2014-04-14 18:10:10 +00:00
|
|
|
elif '-' in watchcomic and j < len(watchcomic):
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] - appears in series title, ignoring.')
|
2013-07-30 04:57:37 +00:00
|
|
|
else:
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] special character appears outside of title - ignoring @ position: ' + str(charpos[i]))
|
2013-07-30 04:57:37 +00:00
|
|
|
nonocount-=1
|
|
|
|
i+=1
|
2013-07-01 05:19:15 +00:00
|
|
|
|
2013-07-30 04:57:37 +00:00
|
|
|
#remove versioning here
|
|
|
|
if volrem != None:
|
2013-08-05 05:50:38 +00:00
|
|
|
jtd_len = len(cchk)# + len(volrem)# + nonocount + 1 #1 is to account for space btwn comic and vol #
|
2013-07-30 04:57:37 +00:00
|
|
|
else:
|
2013-08-05 05:50:38 +00:00
|
|
|
jtd_len = len(cchk)# + nonocount
|
2013-04-23 15:19:07 +00:00
|
|
|
|
2013-09-18 04:49:24 +00:00
|
|
|
if sarc and mylar.READ2FILENAME:
|
|
|
|
removest = subname.find(' ') # the - gets removed above so we test for the first blank space...
|
|
|
|
if subname[:removest].isdigit():
|
|
|
|
jtd_len += removest + 1 # +1 to account for space in place of -
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] adjusted jtd_len to : ' + str(removest) + ' because of story-arc reading order tags')
|
2013-09-18 04:49:24 +00:00
|
|
|
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] nonocount [' + str(nonocount) + '] cchk [' + cchk + '] length [' + str(len(cchk)) + ']')
|
2013-08-05 05:50:38 +00:00
|
|
|
|
|
|
|
#if detectand:
|
|
|
|
# jtd_len = jtd_len - 2 # char substitution diff between & and 'and' = 2 chars
|
2014-03-19 19:04:00 +00:00
|
|
|
#if detectthe_mod == True and detectthe_sub == False:
|
|
|
|
#jtd_len = jtd_len - 3 # char subsitiution diff between 'the' and '' = 3 chars
|
2013-08-05 05:50:38 +00:00
|
|
|
|
|
|
|
#justthedigits = item[jtd_len:]
|
|
|
|
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] final jtd_len to prune [' + str(jtd_len) + ']')
|
|
|
|
logger.fdebug('[FILECHECKER] before title removed from FILENAME [' + str(item) + ']')
|
|
|
|
logger.fdebug('[FILECHECKER] after title removed from FILENAME [' + str(item[jtd_len:]) + ']')
|
|
|
|
logger.fdebug('[FILECHECKER] creating just the digits using SUBNAME, pruning first [' + str(jtd_len) + '] chars from [' + subname + ']')
|
2013-08-05 05:50:38 +00:00
|
|
|
|
2013-09-09 04:39:08 +00:00
|
|
|
justthedigits_1 = subname[jtd_len:].strip()
|
2013-08-05 05:50:38 +00:00
|
|
|
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] after title removed from SUBNAME [' + justthedigits_1 + ']')
|
2013-04-23 15:19:07 +00:00
|
|
|
|
2013-07-01 05:19:15 +00:00
|
|
|
#remove the title if it appears
|
2013-08-05 05:50:38 +00:00
|
|
|
#findtitle = justthedigits.find('-')
|
|
|
|
#if findtitle > 0 and detneg == "no":
|
|
|
|
# justthedigits = justthedigits[:findtitle]
|
2014-02-26 19:48:50 +00:00
|
|
|
# logger.fdebug('[FILECHECKER] ("removed title from name - is now : " + str(justthedigits))
|
2013-08-05 05:50:38 +00:00
|
|
|
|
2013-09-09 04:39:08 +00:00
|
|
|
justthedigits = justthedigits_1.split(' ', 1)[0]
|
2013-12-30 19:30:50 +00:00
|
|
|
|
2013-09-18 04:49:24 +00:00
|
|
|
digitsvalid = "false"
|
|
|
|
|
2013-12-11 18:18:13 +00:00
|
|
|
for jdc in list(justthedigits):
|
2014-02-26 19:48:50 +00:00
|
|
|
#logger.fdebug('[FILECHECKER] ('jdc:' + str(jdc))
|
2013-12-11 18:18:13 +00:00
|
|
|
if not jdc.isdigit():
|
2014-02-26 19:48:50 +00:00
|
|
|
#logger.fdebug('[FILECHECKER] ('alpha')
|
2013-12-11 18:18:13 +00:00
|
|
|
jdc_start = justthedigits.find(jdc)
|
|
|
|
alpha_isschk = justthedigits[jdc_start:]
|
2014-02-26 19:48:50 +00:00
|
|
|
#logger.fdebug('[FILECHECKER] ('alpha_isschk:' + str(alpha_isschk))
|
2013-12-11 18:18:13 +00:00
|
|
|
for issexcept in issue_exceptions:
|
|
|
|
if issexcept.lower() in alpha_isschk.lower() and len(alpha_isschk) <= len(issexcept):
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] ALPHANUMERIC EXCEPTION : [' + justthedigits + ']')
|
2013-12-11 18:18:13 +00:00
|
|
|
digitsvalid = "true"
|
|
|
|
break
|
|
|
|
if digitsvalid == "true": break
|
|
|
|
|
2013-09-09 04:39:08 +00:00
|
|
|
try:
|
|
|
|
tmpthedigits = justthedigits_1.split(' ', 1)[1]
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] If the series has a decimal, this should be a number [' + tmpthedigits + ']')
|
2013-09-09 04:39:08 +00:00
|
|
|
if 'cbr' in tmpthedigits.lower() or 'cbz' in tmpthedigits.lower():
|
|
|
|
tmpthedigits = tmpthedigits[:-3].strip()
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] Removed extension - now we should just have a number [' + tmpthedigits + ']')
|
2013-09-09 04:39:08 +00:00
|
|
|
poss_alpha = tmpthedigits
|
|
|
|
if poss_alpha.isdigit():
|
2013-09-05 02:36:41 +00:00
|
|
|
digitsvalid = "true"
|
2013-09-09 04:39:08 +00:00
|
|
|
if justthedigits.lower() == 'annual':
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] ANNUAL DETECTED [' + poss_alpha + ']')
|
2013-09-09 04:39:08 +00:00
|
|
|
justthedigits += ' ' + poss_alpha
|
|
|
|
else:
|
|
|
|
justthedigits += '.' + poss_alpha
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] DECIMAL ISSUE DETECTED [' + justthedigits + ']')
|
2013-09-05 02:36:41 +00:00
|
|
|
else:
|
2013-09-09 04:39:08 +00:00
|
|
|
for issexcept in issue_exceptions:
|
2013-12-30 19:30:50 +00:00
|
|
|
decimalexcept = False
|
|
|
|
if '.' in issexcept:
|
|
|
|
decimalexcept = True
|
|
|
|
issexcept = issexcept[1:] #remove the '.' from comparison...
|
2013-09-09 04:39:08 +00:00
|
|
|
if issexcept.lower() in poss_alpha.lower() and len(poss_alpha) <= len(issexcept):
|
2013-12-30 19:30:50 +00:00
|
|
|
if decimalexcept:
|
|
|
|
issexcept = '.' + issexcept
|
|
|
|
justthedigits += issexcept #poss_alpha
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] ALPHANUMERIC EXCEPTION. COMBINING : [' + justthedigits + ']')
|
2013-09-09 04:39:08 +00:00
|
|
|
digitsvalid = "true"
|
|
|
|
break
|
|
|
|
except:
|
|
|
|
tmpthedigits = None
|
2013-08-21 02:33:57 +00:00
|
|
|
|
2013-09-09 04:39:08 +00:00
|
|
|
# justthedigits = justthedigits.split(' ', 1)[0]
|
|
|
|
|
|
|
|
#if the issue has an alphanumeric (issue_exceptions, join it and push it through)
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] JUSTTHEDIGITS [' + justthedigits + ']' )
|
2014-02-01 19:50:48 +00:00
|
|
|
if digitsvalid == "true":
|
|
|
|
pass
|
2013-09-18 04:49:24 +00:00
|
|
|
else:
|
2014-02-01 19:50:48 +00:00
|
|
|
if justthedigits.isdigit():
|
|
|
|
digitsvalid = "true"
|
2014-01-31 06:36:58 +00:00
|
|
|
else:
|
2014-02-01 19:50:48 +00:00
|
|
|
if '.' in justthedigits:
|
|
|
|
tmpdec = justthedigits.find('.')
|
|
|
|
b4dec = justthedigits[:tmpdec]
|
|
|
|
a4dec = justthedigits[tmpdec+1:]
|
|
|
|
if a4dec.isdigit() and b4dec.isdigit():
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] DECIMAL ISSUE DETECTED')
|
2014-01-31 06:36:58 +00:00
|
|
|
digitsvalid = "true"
|
2014-02-01 19:50:48 +00:00
|
|
|
else:
|
|
|
|
try:
|
|
|
|
x = float(justthedigits)
|
|
|
|
#validity check
|
|
|
|
if x < 0:
|
2014-03-23 07:10:23 +00:00
|
|
|
logger.fdebug("I've encountered a negative issue #: " + str(justthedigits) + ". Trying to accomodate.")
|
2014-02-01 19:50:48 +00:00
|
|
|
digitsvalid = "true"
|
|
|
|
else: raise ValueError
|
|
|
|
except ValueError, e:
|
2014-03-23 07:10:23 +00:00
|
|
|
logger.fdebug('Probably due to an incorrect match - I cannot determine the issue number from given issue #: ' + str(justthedigits))
|
2014-01-31 06:36:58 +00:00
|
|
|
|
|
|
|
|
2013-09-09 04:39:08 +00:00
|
|
|
# else:
|
2014-02-26 19:48:50 +00:00
|
|
|
# logger.fdebug('[FILECHECKER] NO DECIMALS DETECTED')
|
2013-09-09 04:39:08 +00:00
|
|
|
# digitsvalid = "false"
|
|
|
|
|
|
|
|
# if justthedigits.lower() == 'annual':
|
2014-02-26 19:48:50 +00:00
|
|
|
# logger.fdebug('[FILECHECKER] ANNUAL [' + tmpthedigits.split(' ', 1)[1] + ']')
|
2013-09-09 04:39:08 +00:00
|
|
|
# justthedigits += ' ' + tmpthedigits.split(' ', 1)[1]
|
|
|
|
# digitsvalid = "true"
|
|
|
|
# else:
|
|
|
|
# try:
|
|
|
|
# if tmpthedigits.isdigit(): #.split(' ', 1)[1] is not None:
|
|
|
|
# poss_alpha = tmpthedigits#.split(' ', 1)[1]
|
|
|
|
# if poss_alpha.isdigit():
|
|
|
|
# digitsvalid = "true"
|
|
|
|
# justthedigits += '.' + poss_alpha
|
2014-02-26 19:48:50 +00:00
|
|
|
# logger.fdebug('[FILECHECKER] DECIMAL ISSUE DETECTED [' + justthedigits + ']')
|
2013-09-09 04:39:08 +00:00
|
|
|
# for issexcept in issue_exceptions:
|
|
|
|
# if issexcept.lower() in poss_alpha.lower() and len(poss_alpha) <= len(issexcept):
|
|
|
|
# justthedigits += poss_alpha
|
2014-02-26 19:48:50 +00:00
|
|
|
# logger.fdebug('[FILECHECKER] ALPHANUMERIC EXCEPTION. COMBINING : [' + justthedigits + ']')
|
2013-09-09 04:39:08 +00:00
|
|
|
# digitsvalid = "true"
|
|
|
|
# break
|
|
|
|
# except:
|
|
|
|
# pass
|
2013-08-05 05:50:38 +00:00
|
|
|
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] final justthedigits [' + justthedigits + ']')
|
2013-08-21 02:33:57 +00:00
|
|
|
if digitsvalid == "false":
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] Issue number not properly detected...ignoring.')
|
IMP: Added ForceRSS Check and Test SABnzbd Connection buttons in Config, FIX: If Annuals not enabled, would error on home screen, IMP: updated mylar.init.d (thnx Kalinon), FIX: Manual Post-Processing fix for Manual Run (thnx Kalinon), IMP: Library Monitor working (check folder every X minutes and Post-Process), IMP: Future Upcoming introduction, IMP: Experimental search better handling of year inclusions, FIX: Filechecker will now pick up series with years in the series title accordingly, FIX: Torrent seedbox sending would lockup occassionally when attempting to send torrent file, FIX: malformed image url on some series, IMP: Moved issue updating to a seperate function, IMP: When series was refreshed, would download the last issue (or few issues depending on date), regardless of status, IMP: When series is volume 1 or volume label doesn't exist, either assume V1 or remove volume requirements to improve matching hits, IMP: StoryArcs will now check in StoryArc folder for existing issues and change status in StoryArc accordingly...
2013-11-28 15:48:59 +00:00
|
|
|
comiccnt -=1 # remove the entry from the list count as it was incorrrectly tallied.
|
2013-08-21 02:33:57 +00:00
|
|
|
continue
|
|
|
|
|
2013-08-05 05:50:38 +00:00
|
|
|
|
2013-08-21 02:33:57 +00:00
|
|
|
if manual is not None:
|
2013-08-11 05:31:41 +00:00
|
|
|
#this is needed for Manual Run to determine matches
|
|
|
|
#without this Batman will match on Batman Incorporated, and Batman and Robin, etc..
|
2013-09-09 04:39:08 +00:00
|
|
|
|
|
|
|
# in case it matches on an Alternate Search pattern, set modwatchcomic to the cchk value
|
|
|
|
modwatchcomic = cchk
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] cchk = ' + cchk.lower())
|
|
|
|
logger.fdebug('[FILECHECKER] modwatchcomic = ' + modwatchcomic.lower())
|
|
|
|
logger.fdebug('[FILECHECKER] subname = ' + subname.lower())
|
2013-08-21 02:33:57 +00:00
|
|
|
comyear = manual['SeriesYear']
|
|
|
|
issuetotal = manual['Total']
|
2013-09-18 04:49:24 +00:00
|
|
|
comicvolume = manual['ComicVersion']
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] SeriesYear: ' + str(comyear))
|
|
|
|
logger.fdebug('[FILECHECKER] IssueTotal: ' + str(issuetotal))
|
|
|
|
logger.fdebug('[FILECHECKER] Comic Volume: ' + str(comicvolume))
|
|
|
|
logger.fdebug('[FILECHECKER] volume detected: ' + str(volrem))
|
|
|
|
|
|
|
|
if comicvolume:
|
|
|
|
ComVersChk = re.sub("[^0-9]", "", comicvolume)
|
|
|
|
if ComVersChk == '' or ComVersChk == '1':
|
|
|
|
ComVersChk = 0
|
|
|
|
else:
|
|
|
|
ComVersChk = 0
|
|
|
|
|
|
|
|
# even if it's a V1, we need to pull the date for the given issue ID and get the publication year
|
|
|
|
# for the issue. Because even if it's a V1, if there are additional Volumes then it's possible that
|
|
|
|
# it will take the incorrect series. (ie. Detective Comics (1937) & Detective Comics (2011).
|
|
|
|
# If issue #28 (2013) is found, it exists in both series, and because DC 1937 is a V1, it will bypass
|
|
|
|
# the year check which will result in the incorrect series being picked (1937)
|
|
|
|
|
2013-08-21 02:33:57 +00:00
|
|
|
|
|
|
|
#set the issue/year threshold here.
|
|
|
|
# 2013 - (24issues/12) = 2011.
|
2013-09-18 04:49:24 +00:00
|
|
|
#minyear = int(comyear) - (int(issuetotal) / 12)
|
2014-02-26 19:48:50 +00:00
|
|
|
|
2013-09-18 04:49:24 +00:00
|
|
|
maxyear = manual['LatestDate'][:4] # yyyy-mm-dd
|
|
|
|
|
2013-08-21 02:33:57 +00:00
|
|
|
#subnm defined at being of module.
|
|
|
|
len_sm = len(subnm)
|
|
|
|
|
|
|
|
#print ("there are " + str(lenm) + " words.")
|
|
|
|
cnt = 0
|
2014-02-26 19:48:50 +00:00
|
|
|
yearmatch = "none"
|
2013-09-18 04:49:24 +00:00
|
|
|
vers4year = "no"
|
|
|
|
vers4vol = "no"
|
|
|
|
|
|
|
|
for ct in subsplit:
|
|
|
|
if ct.lower().startswith('v') and ct[1:].isdigit():
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] possible versioning..checking')
|
2013-09-18 04:49:24 +00:00
|
|
|
#we hit a versioning # - account for it
|
|
|
|
if ct[1:].isdigit():
|
|
|
|
if len(ct[1:]) == 4: #v2013
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] Version detected as ' + str(ct))
|
2013-09-18 04:49:24 +00:00
|
|
|
vers4year = "yes" #re.sub("[^0-9]", " ", str(ct)) #remove the v
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
if len(ct) < 4:
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] Version detected as ' + str(ct))
|
2013-09-18 04:49:24 +00:00
|
|
|
vers4vol = str(ct)
|
|
|
|
break
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] false version detection..ignoring.')
|
2013-09-18 04:49:24 +00:00
|
|
|
|
2014-02-26 19:48:50 +00:00
|
|
|
versionmatch = "false"
|
2013-09-18 04:49:24 +00:00
|
|
|
if vers4year is not "no" or vers4vol is not "no":
|
|
|
|
|
|
|
|
if comicvolume: #is not "None" and comicvolume is not None:
|
|
|
|
D_ComicVersion = re.sub("[^0-9]", "", comicvolume)
|
|
|
|
if D_ComicVersion == '':
|
|
|
|
D_ComicVersion = 0
|
|
|
|
else:
|
|
|
|
D_ComicVersion = 0
|
2013-08-21 02:33:57 +00:00
|
|
|
|
2013-09-18 04:49:24 +00:00
|
|
|
F_ComicVersion = re.sub("[^0-9]", "", volrem)
|
|
|
|
S_ComicVersion = str(comyear)
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] FCVersion: ' + str(F_ComicVersion))
|
|
|
|
logger.fdebug('[FILECHECKER] DCVersion: ' + str(D_ComicVersion))
|
|
|
|
logger.fdebug('[FILECHECKER] SCVersion: ' + str(S_ComicVersion))
|
2013-09-18 04:49:24 +00:00
|
|
|
|
|
|
|
#if annualize == "true" and int(ComicYear) == int(F_ComicVersion):
|
2014-02-26 19:48:50 +00:00
|
|
|
# logger.fdebug('[FILECHECKER] ("We matched on versions for annuals " + str(volrem))
|
2013-09-18 04:49:24 +00:00
|
|
|
|
|
|
|
if int(F_ComicVersion) == int(D_ComicVersion) or int(F_ComicVersion) == int(S_ComicVersion):
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] We matched on versions...' + str(volrem))
|
|
|
|
versionmatch = "true"
|
2013-08-21 02:33:57 +00:00
|
|
|
else:
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] Versions wrong. Ignoring possible match.')
|
2013-09-18 04:49:24 +00:00
|
|
|
|
FIX:(#663) Weekly pull list would crash on issues with decimal places if series on watchlist, FIX: Error logging when performing search, FIX:(#662) Removed 'Test SABnzbd button' as was causing configuration saving issues. Can still be used by url : /SABtest, IMP: Added more logic checking to weeklypull list when comparing series for matches (to ensure an issue is part of a given series), IMP: Removed dead references to nzbx as a provider, FIX: If issue had no leading 0 in a decimal issue, mylar would crash, FIX: None status would occur when refreshing a series and more than one issue was being pulled in for data, IMP: When using manual post-processing, if issue date was near end/start of year issue comparison would fail. Comparison by month now added, FIX: file checking - if decimal in issue and no year present, would skip issue, FIX: manual post-processing - would fail/skip if no year provided for issue within filename, FIX: Manual Annual Add option will only be available if annuals_on=1 within the config.ini now
2014-04-07 16:20:05 +00:00
|
|
|
result_comyear = None
|
2014-02-26 19:48:50 +00:00
|
|
|
while (cnt < len_sm):
|
|
|
|
if subnm[cnt] is None: break
|
|
|
|
if subnm[cnt] == ' ':
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
logger.fdebug('[FILECHECKER] ' + str(cnt) + ' Bracket Word: ' + str(subnm[cnt]))
|
|
|
|
|
|
|
|
#if ComVersChk == 0:
|
|
|
|
# logger.fdebug('[FILECHECKER] Series version detected as V1 (only series in existance with that title). Bypassing year check')
|
|
|
|
# yearmatch = "true"
|
|
|
|
# break
|
|
|
|
if subnm[cnt][:-2] == '19' or subnm[cnt][:-2] == '20':
|
|
|
|
logger.fdebug('[FILECHECKER] year detected: ' + str(subnm[cnt]))
|
|
|
|
result_comyear = subnm[cnt]
|
|
|
|
if int(result_comyear) <= int(maxyear):
|
|
|
|
logger.fdebug('[FILECHECKER] ' + str(result_comyear) + ' is within the series range of ' + str(comyear) + '-' + str(maxyear))
|
|
|
|
#still possible for incorrect match if multiple reboots of series end/start in same year
|
|
|
|
yearmatch = "true"
|
|
|
|
break
|
2013-08-21 02:33:57 +00:00
|
|
|
else:
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] ' + str(result_comyear) + ' - not right - year not within series range of ' + str(comyear) + '-' + str(maxyear))
|
|
|
|
yearmatch = "false"
|
|
|
|
break
|
|
|
|
cnt+=1
|
|
|
|
if versionmatch == "false":
|
|
|
|
if yearmatch == "false":
|
|
|
|
logger.fdebug('[FILECHECKER] Failed to match on both version and issue year.')
|
|
|
|
continue
|
|
|
|
else:
|
|
|
|
logger.fdebug('[FILECHECKER] Matched on versions, not on year - continuing.')
|
|
|
|
else:
|
|
|
|
if yearmatch == "false":
|
|
|
|
logger.fdebug('[FILECHECKER] Matched on version, but not on year - continuing.')
|
|
|
|
else:
|
|
|
|
logger.fdebug('[FILECHECKER] Matched on both version, and issue year - continuing.')
|
|
|
|
|
|
|
|
if yearmatch == "none":
|
|
|
|
if ComVersChk == 0:
|
|
|
|
logger.fdebug('[FILECHECKER] Series version detected as V1 (only series in existance with that title). Bypassing year check.')
|
|
|
|
yearmatch = "true"
|
|
|
|
else:
|
|
|
|
continue
|
2013-08-11 05:31:41 +00:00
|
|
|
|
2014-01-16 20:25:02 +00:00
|
|
|
if 'annual' in subname.lower():
|
|
|
|
subname = re.sub('annual', '', subname.lower())
|
|
|
|
subname = re.sub('\s+', ' ', subname)
|
2014-03-21 18:48:25 +00:00
|
|
|
#if the sub has an annual, let's remove it from the modwatch as well
|
|
|
|
modwatchcomic = re.sub('annual', '', modwatchcomic.lower())
|
2014-01-16 20:25:02 +00:00
|
|
|
|
2013-08-11 05:31:41 +00:00
|
|
|
#tmpitem = item[:jtd_len]
|
|
|
|
# if it's an alphanumeric with a space, rejoin, so we can remove it cleanly just below this.
|
|
|
|
substring_removal = None
|
|
|
|
poss_alpha = subname.split(' ')[-1:]
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] poss_alpha: ' + str(poss_alpha))
|
|
|
|
logger.fdebug('[FILECHECKER] lenalpha: ' + str(len(''.join(poss_alpha))))
|
2013-08-11 05:31:41 +00:00
|
|
|
for issexcept in issue_exceptions:
|
|
|
|
if issexcept.lower()in str(poss_alpha).lower() and len(''.join(poss_alpha)) <= len(issexcept):
|
|
|
|
#get the last 2 words so that we can remove them cleanly
|
|
|
|
substring_removal = ' '.join(subname.split(' ')[-2:])
|
|
|
|
substring_join = ''.join(subname.split(' ')[-2:])
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] substring_removal: ' + str(substring_removal))
|
|
|
|
logger.fdebug('[FILECHECKER] substring_join: ' + str(substring_join))
|
2013-08-11 05:31:41 +00:00
|
|
|
break
|
|
|
|
|
|
|
|
if substring_removal is not None:
|
|
|
|
sub_removed = subname.replace('_', ' ').replace(substring_removal, substring_join)
|
|
|
|
else:
|
|
|
|
sub_removed = subname.replace('_', ' ')
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] sub_removed: ' + str(sub_removed))
|
2013-08-11 05:31:41 +00:00
|
|
|
split_sub = sub_removed.rsplit(' ',1)[0].split(' ') #removes last word (assuming it's the issue#)
|
|
|
|
split_mod = modwatchcomic.replace('_', ' ').split() #batman
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] split_sub: ' + str(split_sub))
|
|
|
|
logger.fdebug('[FILECHECKER] split_mod: ' + str(split_mod))
|
2013-08-11 05:31:41 +00:00
|
|
|
|
|
|
|
x = len(split_sub)-1
|
|
|
|
scnt = 0
|
|
|
|
if x > len(split_mod)-1:
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] number of words do not match...aborting.')
|
2013-08-11 05:31:41 +00:00
|
|
|
else:
|
|
|
|
while ( x > -1 ):
|
2014-03-19 19:04:00 +00:00
|
|
|
logger.fdebug(str(split_sub[x]) + ' comparing to ' + str(split_mod[x]))
|
2013-08-11 05:31:41 +00:00
|
|
|
if str(split_sub[x]).lower() == str(split_mod[x]).lower():
|
|
|
|
scnt+=1
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] word match exact. ' + str(scnt) + '/' + str(len(split_mod)))
|
2013-08-11 05:31:41 +00:00
|
|
|
x-=1
|
|
|
|
|
|
|
|
wordcnt = int(scnt)
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] scnt:' + str(scnt))
|
2013-08-11 05:31:41 +00:00
|
|
|
totalcnt = int(len(split_mod))
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] split_mod length:' + str(totalcnt))
|
2013-08-11 05:31:41 +00:00
|
|
|
try:
|
|
|
|
spercent = (wordcnt/totalcnt) * 100
|
|
|
|
except ZeroDivisionError:
|
|
|
|
spercent = 0
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] we got ' + str(spercent) + ' percent.')
|
2013-08-11 05:31:41 +00:00
|
|
|
if int(spercent) >= 80:
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] this should be considered an exact match.Justthedigits:' + justthedigits)
|
2013-08-11 05:31:41 +00:00
|
|
|
else:
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] failure - not an exact match.')
|
2013-08-11 05:31:41 +00:00
|
|
|
continue
|
2013-07-01 05:19:15 +00:00
|
|
|
|
2014-02-26 19:48:50 +00:00
|
|
|
if manual:
|
2014-03-19 19:04:00 +00:00
|
|
|
#print item
|
|
|
|
#print comicpath
|
|
|
|
#print comicsize
|
|
|
|
#print result_comyear
|
|
|
|
#print justthedigits
|
2014-02-26 19:48:50 +00:00
|
|
|
comiclist.append({
|
|
|
|
'ComicFilename': item,
|
|
|
|
'ComicLocation': comicpath,
|
|
|
|
'ComicSize': comicsize,
|
|
|
|
'ComicYear': result_comyear,
|
|
|
|
'JusttheDigits': justthedigits
|
|
|
|
})
|
2014-03-19 19:04:00 +00:00
|
|
|
#print('appended.')
|
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
|
|
|
# watchmatch['comiclist'] = comiclist
|
|
|
|
# break
|
2014-02-26 19:48:50 +00:00
|
|
|
else:
|
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 moddir is not None:
|
|
|
|
item = os.path.join(moddir, item)
|
2014-02-26 19:48:50 +00:00
|
|
|
comiclist.append({
|
|
|
|
'ComicFilename': item,
|
|
|
|
'ComicLocation': comicpath,
|
|
|
|
'ComicSize': comicsize,
|
|
|
|
'JusttheDigits': justthedigits
|
|
|
|
})
|
2014-05-29 18:05:11 +00:00
|
|
|
#crcvalue = crc(comicpath)
|
|
|
|
#logger.fdebug('[FILECHECKER] CRC is calculated as ' + str(crcvalue) + ' for : ' + item)
|
2012-09-13 15:27:34 +00:00
|
|
|
watchmatch['comiclist'] = comiclist
|
|
|
|
else:
|
2014-05-29 18:05:11 +00:00
|
|
|
#directory found - ignoring
|
2012-09-13 15:27:34 +00:00
|
|
|
pass
|
2014-01-16 20:25:02 +00:00
|
|
|
|
2014-02-26 19:48:50 +00:00
|
|
|
logger.fdebug('[FILECHECKER] you have a total of ' + str(comiccnt) + ' ' + watchcomic + ' comics')
|
2012-09-13 15:27:34 +00:00
|
|
|
watchmatch['comiccount'] = comiccnt
|
|
|
|
return watchmatch
|
2013-04-22 03:43:57 +00:00
|
|
|
|
|
|
|
def validateAndCreateDirectory(dir, create=False):
|
|
|
|
if os.path.exists(dir):
|
2013-08-19 06:14:47 +00:00
|
|
|
logger.info('Found comic directory: ' + dir)
|
2013-04-22 03:43:57 +00:00
|
|
|
return True
|
|
|
|
else:
|
2013-08-19 06:14:47 +00:00
|
|
|
logger.warn('Could not find comic directory: ' + dir)
|
2013-04-22 03:43:57 +00:00
|
|
|
if create:
|
|
|
|
if dir.strip():
|
2013-08-19 06:14:47 +00:00
|
|
|
logger.info('Creating comic directory (' + str(mylar.CHMOD_DIR) + ') : ' + dir)
|
2013-04-22 03:43:57 +00:00
|
|
|
try:
|
2013-04-22 17:12:29 +00:00
|
|
|
permission = int(mylar.CHMOD_DIR, 8)
|
|
|
|
os.umask(0) # this is probably redudant, but it doesn't hurt to clear the umask here.
|
2014-03-26 18:04:33 +00:00
|
|
|
os.makedirs(dir.rstrip(), permission )
|
2013-04-22 03:43:57 +00:00
|
|
|
except OSError:
|
|
|
|
raise SystemExit('Could not create data directory: ' + mylar.DATA_DIR + '. Exiting....')
|
|
|
|
return True
|
|
|
|
else:
|
2013-08-19 06:14:47 +00:00
|
|
|
logger.warn('Provided directory is blank, aborting')
|
2013-04-22 03:43:57 +00:00
|
|
|
return False
|
|
|
|
return False
|
2013-07-01 05:19:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
def indices(string, char):
|
|
|
|
return [ i for i,c in enumerate(string) if c == char ]
|
|
|
|
|
2014-03-19 19:04:00 +00:00
|
|
|
def traverse_directories(dir):
|
|
|
|
filelist = []
|
|
|
|
|
|
|
|
for (dirname, subs, files) in os.walk(dir):
|
2014-03-21 18:48:25 +00:00
|
|
|
|
2014-03-19 19:04:00 +00:00
|
|
|
for fname in files:
|
2014-03-21 18:48:25 +00:00
|
|
|
if dirname == dir:
|
|
|
|
direc = ''
|
|
|
|
else:
|
|
|
|
direc = dirname
|
|
|
|
|
2014-03-19 19:04:00 +00:00
|
|
|
filelist.append({"directory": direc,
|
2014-03-21 18:48:25 +00:00
|
|
|
"filename": fname})
|
2014-03-19 19:04:00 +00:00
|
|
|
|
|
|
|
logger.fdebug('there are ' + str(len(filelist)) + ' files.')
|
|
|
|
#logger.fdeubg(filelist)
|
|
|
|
|
|
|
|
return filelist
|
2014-05-29 18:05:11 +00:00
|
|
|
|
|
|
|
def crc(filename):
|
|
|
|
#memory in lieu of speed (line by line)
|
|
|
|
#prev = 0
|
|
|
|
#for eachLine in open(filename,"rb"):
|
|
|
|
# prev = zlib.crc32(eachLine, prev)
|
|
|
|
#return "%X"%(prev & 0xFFFFFFFF)
|
|
|
|
|
|
|
|
#speed in lieu of memory (file into memory entirely)
|
|
|
|
return "%X" % (zlib.crc32(open(filename,"rb").read()) & 0xFFFFFFFF)
|