2012-09-13 15:27:34 +00:00
# This file is part of Mylar.
#
# Mylar is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# 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 time
from operator import itemgetter
import datetime
import re
2013-07-30 04:57:37 +00:00
import platform
2013-01-13 18:08:21 +00:00
import itertools
2013-02-13 01:27:24 +00:00
import os
2012-09-13 15:27:34 +00:00
import mylar
def multikeysort ( items , columns ) :
2015-05-22 08:32:51 +00:00
comparers = [ ( ( itemgetter ( col [ 1 : ] . strip ( ) ) , - 1 ) if col . startswith ( ' - ' ) else ( itemgetter ( col . strip ( ) ) , 1 ) ) for col in columns ]
2012-09-13 15:27:34 +00:00
def comparer ( left , right ) :
for fn , mult in comparers :
result = cmp ( fn ( left ) , fn ( right ) )
if result :
return mult * result
else :
return 0
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
return sorted ( items , cmp = comparer )
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
def checked ( variable ) :
if variable :
return ' Checked '
else :
return ' '
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
def radio ( variable , pos ) :
if variable == pos :
return ' Checked '
else :
return ' '
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
def latinToAscii ( unicrap ) :
"""
From couch potato
"""
2015-05-22 08:32:51 +00:00
xlate = { 0xc0 : ' A ' , 0xc1 : ' A ' , 0xc2 : ' A ' , 0xc3 : ' A ' , 0xc4 : ' A ' , 0xc5 : ' A ' ,
0xc6 : ' Ae ' , 0xc7 : ' C ' ,
0xc8 : ' E ' , 0xc9 : ' E ' , 0xca : ' E ' , 0xcb : ' E ' , 0x86 : ' e ' ,
0xcc : ' I ' , 0xcd : ' I ' , 0xce : ' I ' , 0xcf : ' I ' ,
0xd0 : ' Th ' , 0xd1 : ' N ' ,
0xd2 : ' O ' , 0xd3 : ' O ' , 0xd4 : ' O ' , 0xd5 : ' O ' , 0xd6 : ' O ' , 0xd8 : ' O ' ,
0xd9 : ' U ' , 0xda : ' U ' , 0xdb : ' U ' , 0xdc : ' U ' ,
0xdd : ' Y ' , 0xde : ' th ' , 0xdf : ' ss ' ,
0xe0 : ' a ' , 0xe1 : ' a ' , 0xe2 : ' a ' , 0xe3 : ' a ' , 0xe4 : ' a ' , 0xe5 : ' a ' ,
0xe6 : ' ae ' , 0xe7 : ' c ' ,
0xe8 : ' e ' , 0xe9 : ' e ' , 0xea : ' e ' , 0xeb : ' e ' , 0x0259 : ' e ' ,
0xec : ' i ' , 0xed : ' i ' , 0xee : ' i ' , 0xef : ' i ' ,
0xf0 : ' th ' , 0xf1 : ' n ' ,
0xf2 : ' o ' , 0xf3 : ' o ' , 0xf4 : ' o ' , 0xf5 : ' o ' , 0xf6 : ' o ' , 0xf8 : ' o ' ,
0xf9 : ' u ' , 0xfa : ' u ' , 0xfb : ' u ' , 0xfc : ' u ' ,
0xfd : ' y ' , 0xfe : ' th ' , 0xff : ' y ' ,
0xa1 : ' ! ' , 0xa2 : ' {cent} ' , 0xa3 : ' {pound} ' , 0xa4 : ' {currency} ' ,
0xa5 : ' {yen} ' , 0xa6 : ' | ' , 0xa7 : ' {section} ' , 0xa8 : ' {umlaut} ' ,
0xa9 : ' {C} ' , 0xaa : ' { ^a} ' , 0xab : ' << ' , 0xac : ' {not} ' ,
0xad : ' - ' , 0xae : ' {R} ' , 0xaf : ' _ ' , 0xb0 : ' {degrees} ' ,
0xb1 : ' { +/-} ' , 0xb2 : ' { ^2} ' , 0xb3 : ' { ^3} ' , 0xb4 : " ' " ,
0xb5 : ' {micro} ' , 0xb6 : ' {paragraph} ' , 0xb7 : ' * ' , 0xb8 : ' {cedilla} ' ,
0xb9 : ' { ^1} ' , 0xba : ' { ^o} ' , 0xbb : ' >> ' ,
0xbc : ' { 1/4} ' , 0xbd : ' { 1/2} ' , 0xbe : ' { 3/4} ' , 0xbf : ' ? ' ,
0xd7 : ' * ' , 0xf7 : ' / '
2012-09-13 15:27:34 +00:00
}
r = ' '
for i in unicrap :
if xlate . has_key ( ord ( i ) ) :
r + = xlate [ ord ( i ) ]
elif ord ( i ) > = 0x80 :
pass
else :
r + = str ( i )
return r
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
def convert_milliseconds ( ms ) :
2015-05-22 08:32:51 +00:00
seconds = ms / 1000
2012-09-13 15:27:34 +00:00
gmtime = time . gmtime ( seconds )
if seconds > 3600 :
minutes = time . strftime ( " % H: % M: % S " , gmtime )
else :
minutes = time . strftime ( " % M: % S " , gmtime )
return minutes
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
def convert_seconds ( s ) :
gmtime = time . gmtime ( s )
if s > 3600 :
minutes = time . strftime ( " % H: % M: % S " , gmtime )
else :
minutes = time . strftime ( " % M: % S " , gmtime )
return minutes
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
def today ( ) :
today = datetime . date . today ( )
yyyymmdd = datetime . date . isoformat ( today )
return yyyymmdd
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
def now ( ) :
now = datetime . datetime . now ( )
return now . strftime ( " % Y- % m- %d % H: % M: % S " )
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
def bytes_to_mb ( bytes ) :
2015-05-22 08:32:51 +00:00
mb = int ( bytes ) / 1048576
2012-09-13 15:27:34 +00:00
size = ' %.1f MB ' % mb
return size
2013-02-25 15:36:43 +00:00
def human_size ( size_bytes ) :
"""
format a size in bytes into a ' human ' file size , e . g . bytes , KB , MB , GB , TB , PB
Note that bytes / KB will be reported in whole numbers but MB and above will have greater precision
e . g . 1 byte , 43 bytes , 443 KB , 4.3 MB , 4.43 GB , etc
"""
if size_bytes == 1 :
# because I really hate unnecessary plurals
return " 1 byte "
2015-05-22 08:32:51 +00:00
suffixes_table = [ ( ' bytes ' , 0 ) , ( ' KB ' , 0 ) , ( ' MB ' , 1 ) , ( ' GB ' , 2 ) , ( ' TB ' , 2 ) , ( ' PB ' , 2 ) ]
2013-02-25 15:36:43 +00:00
2013-02-27 16:12:33 +00:00
num = float ( 0 if size_bytes is None else size_bytes )
2013-02-25 15:36:43 +00:00
for suffix , precision in suffixes_table :
if num < 1024.0 :
break
num / = 1024.0
if precision == 0 :
formatted_size = " %d " % num
else :
formatted_size = str ( round ( num , ndigits = precision ) )
return " %s %s " % ( formatted_size , suffix )
2013-07-11 03:37:52 +00:00
def human2bytes ( s ) :
"""
>> > human2bytes ( ' 1M ' )
1048576
>> > human2bytes ( ' 1G ' )
1073741824
"""
symbols = ( ' B ' , ' K ' , ' M ' , ' G ' , ' T ' , ' P ' , ' E ' , ' Z ' , ' Y ' )
letter = s [ - 1 : ] . strip ( ) . upper ( )
num = s [ : - 1 ]
assert num . isdigit ( ) and letter in symbols
num = float ( num )
2015-05-22 08:32:51 +00:00
prefix = { symbols [ 0 ] : 1 }
2013-07-11 03:37:52 +00:00
for i , s in enumerate ( symbols [ 1 : ] ) :
2015-05-22 08:32:51 +00:00
prefix [ s ] = 1 << ( i + 1 ) * 10
2013-07-11 03:37:52 +00:00
return int ( num * prefix [ letter ] )
2012-09-13 15:27:34 +00:00
def replace_all ( text , dic ) :
for i , j in dic . iteritems ( ) :
text = text . replace ( i , j )
2014-09-08 08:35:15 +00:00
return text . rstrip ( )
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
def cleanName ( string ) :
pass1 = latinToAscii ( string ) . lower ( )
out_string = re . sub ( ' [ \ / \ @ \ # \ $ \ % \ ^ \ * \ + \" \ [ \ ] \ { \ } \ < \ > \ = \ _] ' , ' ' , pass1 ) . encode ( ' utf-8 ' )
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
return out_string
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
def cleanTitle ( title ) :
title = re . sub ( ' [ \ . \ - \ / \ _] ' , ' ' , title ) . lower ( )
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
# Strip out extra whitespace
title = ' ' . join ( title . split ( ) )
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
title = title . title ( )
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
return title
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
def extract_logline ( s ) :
# Default log format
pattern = re . compile ( r ' (?P<timestamp>.*?) \ s \ - \ s(?P<level>.*?) \ s* \ : \ : \ s(?P<thread>.*?) \ s \ : \ s(?P<message>.*) ' , re . VERBOSE )
match = pattern . match ( s )
if match :
timestamp = match . group ( " timestamp " )
level = match . group ( " level " )
thread = match . group ( " thread " )
message = match . group ( " message " )
return ( timestamp , level , thread , message )
else :
return None
2015-05-22 08:32:51 +00:00
2012-09-13 15:27:34 +00:00
def is_number ( s ) :
try :
float ( s )
return True
except ValueError :
return False
2012-12-31 16:52:16 +00:00
def decimal_issue ( iss ) :
iss_find = iss . find ( ' . ' )
2013-04-02 08:56:24 +00:00
dec_except = None
2013-03-11 17:25:45 +00:00
if iss_find == - 1 :
#no matches for a decimal, assume we're converting from decimal to int.
2013-04-02 08:56:24 +00:00
#match for special issues with alphanumeric numbering...
if ' au ' in iss . lower ( ) :
dec_except = ' AU '
decex = iss . lower ( ) . find ( ' au ' )
deciss = int ( iss [ : decex ] ) * 1000
else :
deciss = int ( iss ) * 1000
2012-12-31 16:52:16 +00:00
else :
2013-03-11 17:25:45 +00:00
iss_b4dec = iss [ : iss_find ]
2015-05-22 08:32:51 +00:00
iss_decval = iss [ iss_find + 1 : ]
2013-03-11 17:25:45 +00:00
if int ( iss_decval ) == 0 :
iss = iss_b4dec
issdec = int ( iss_decval )
2012-12-31 16:52:16 +00:00
else :
2013-03-11 17:25:45 +00:00
if len ( iss_decval ) == 1 :
iss = iss_b4dec + " . " + iss_decval
issdec = int ( iss_decval ) * 10
else :
iss = iss_b4dec + " . " + iss_decval . rstrip ( ' 0 ' )
issdec = int ( iss_decval . rstrip ( ' 0 ' ) ) * 10
deciss = ( int ( iss_b4dec ) * 1000 ) + issdec
2013-04-02 08:56:24 +00:00
return deciss , dec_except
2013-01-28 20:31:43 +00:00
2015-06-30 20:21:26 +00:00
def rename_param ( comicid , comicname , issue , ofilename , comicyear = None , issueid = None , annualize = None , arc = False ) :
2013-07-30 04:57:37 +00:00
import db , logger
2013-01-28 20:31:43 +00:00
myDB = db . DBConnection ( )
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' comicid: ' + str ( comicid ) )
logger . fdebug ( ' issue#: ' + str ( issue ) )
2013-02-13 01:27:24 +00:00
# the issue here is a non-decimalized version, we need to see if it's got a decimal and if not, add '.00'
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
# iss_find = issue.find('.')
# if iss_find < 0:
# # no decimal in issue number
# iss = str(int(issue)) + ".00"
# else:
# iss_b4dec = issue[:iss_find]
# iss_decval = issue[iss_find+1:]
# if len(str(int(iss_decval))) == 1:
# iss = str(int(iss_b4dec)) + "." + str(int(iss_decval)*10)
# else:
# if issue.endswith(".00"):
# iss = issue
# else:
# iss = str(int(iss_b4dec)) + "." + iss_decval
# issue = iss
# print ("converted issue#: " + str(issue))
2014-01-16 20:25:02 +00:00
logger . fdebug ( ' issueid: ' + str ( issueid ) )
2013-01-28 20:31:43 +00:00
if issueid is None :
2014-01-16 20:25:02 +00:00
logger . fdebug ( ' annualize is ' + str ( annualize ) )
2015-06-30 20:21:26 +00:00
if arc :
#this has to be adjusted to be able to include story arc issues that span multiple arcs
chkissue = myDB . selectone ( " SELECT * from readinglist WHERE ComicID=? AND Issue_Number=? " , [ comicid , issue ] ) . fetchone ( )
2014-01-16 20:25:02 +00:00
else :
2015-06-30 20:21:26 +00:00
if annualize is None :
chkissue = myDB . selectone ( " SELECT * from issues WHERE ComicID=? AND Issue_Number=? " , [ comicid , issue ] ) . fetchone ( )
else :
chkissue = myDB . selectone ( " SELECT * from annuals WHERE ComicID=? AND Issue_Number=? " , [ comicid , issue ] ) . fetchone ( )
2014-01-16 20:25:02 +00:00
2013-01-28 20:31:43 +00:00
if chkissue is None :
2013-04-26 03:45:02 +00:00
#rechk chkissue against int value of issue #
2015-06-30 20:21:26 +00:00
if arc :
chkissue = myDB . selectone ( " SELECT * from readinglist WHERE ComicID=? AND Int_IssueNumber=? " , [ comicid , issuedigits ( issue ) ] ) . fetchone ( )
else :
chkissue = myDB . selectone ( " SELECT * from issues WHERE ComicID=? AND Int_IssueNumber=? " , [ comicid , issuedigits ( issue ) ] ) . fetchone ( )
if annualize :
chkissue = myDB . selectone ( " SELECT * from annuals WHERE ComicID=? AND Int_IssueNumber=? " , [ comicid , issuedigits ( issue ) ] ) . fetchone ( )
2013-04-26 03:45:02 +00:00
if chkissue is None :
2014-01-16 20:25:02 +00:00
if chkissue is None :
logger . error ( ' Invalid Issue_Number - please validate. ' )
return
2013-04-26 03:45:02 +00:00
else :
2013-08-19 06:14:47 +00:00
logger . info ( ' Int Issue_number compare found. continuing... ' )
2015-05-22 08:32:51 +00:00
issueid = chkissue [ ' IssueID ' ]
2013-01-28 20:31:43 +00:00
else :
issueid = chkissue [ ' IssueID ' ]
#use issueid to get publisher, series, year, issue number
2014-01-16 20:25:02 +00:00
logger . fdebug ( ' issueid is now : ' + str ( issueid ) )
2015-06-30 20:21:26 +00:00
if arc :
issuenzb = myDB . selectone ( " SELECT * from readinglist WHERE ComicID=? AND IssueID=? AND StoryArc=? " , [ comicid , issueid , arc ] ) . fetchone ( )
else :
issuenzb = myDB . selectone ( " SELECT * from issues WHERE ComicID=? AND IssueID=? " , [ comicid , issueid ] ) . fetchone ( )
2014-01-16 20:25:02 +00:00
if issuenzb is None :
2015-06-30 20:21:26 +00:00
logger . fdebug ( ' not an issue, checking against annuals ' )
issuenzb = myDB . selectone ( " SELECT * from annuals WHERE ComicID=? AND IssueID=? " , [ comicid , issueid ] ) . fetchone ( )
if issuenzb is None :
logger . fdebug ( ' Unable to rename - cannot locate issue id within db ' )
return
else :
annualize = True
if issuenzb is None :
logger . fdebug ( ' Unable to rename - cannot locate issue id within db ' )
return
#remap the variables to a common factor.
if arc :
issuenum = issuenzb [ ' IssueNumber ' ]
issuedate = issuenzb [ ' IssueDate ' ]
publisher = issuenzb [ ' IssuePublisher ' ]
series = issuenzb [ ' ComicName ' ]
seriesfilename = series #Alternate FileNaming is not available with story arcs.
seriesyear = issuenzb [ ' SeriesYear ' ]
arcdir = filesafe ( issuenzb [ ' StoryArc ' ] )
if mylar . REPLACE_SPACES :
arcdir = arcdir . replace ( ' ' , mylar . REPLACE_CHAR )
if mylar . STORYARCDIR :
storyarcd = os . path . join ( mylar . DESTINATION_DIR , " StoryArcs " , arcdir )
logger . fdebug ( ' Story Arc Directory set to : ' + storyarcd )
else :
logger . fdebug ( ' Story Arc Directory set to : ' + mylar . GRABBAG_DIR )
storyarcd = os . path . join ( mylar . DESTINATION_DIR , mylar . GRABBAG_DIR )
comlocation = storyarcd
comversion = None #need to populate this.
else :
issuenum = issuenzb [ ' Issue_Number ' ]
issuedate = issuenzb [ ' IssueDate ' ]
comicnzb = myDB . selectone ( " SELECT * from comics WHERE comicid=? " , [ comicid ] ) . fetchone ( )
publisher = comicnzb [ ' ComicPublisher ' ]
series = comicnzb [ ' ComicName ' ]
if comicnzb [ ' AlternateFileName ' ] is None or comicnzb [ ' AlternateFileName ' ] == ' None ' :
seriesfilename = series
2014-01-16 20:25:02 +00:00
else :
2015-06-30 20:21:26 +00:00
seriesfilename = comicnzb [ ' AlternateFileName ' ]
logger . fdebug ( ' Alternate File Naming has been enabled for this series. Will rename series title to : ' + seriesfilename )
seriesyear = comicnzb [ ' ComicYear ' ]
comlocation = comicnzb [ ' ComicLocation ' ]
comversion = comicnzb [ ' ComicVersion ' ]
2013-01-28 20:31:43 +00:00
#comicid = issuenzb['ComicID']
#issueno = str(issuenum).split('.')[0]
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
issue_except = ' None '
2015-01-19 18:41:18 +00:00
issue_exceptions = [ ' AU ' ,
' INH ' ,
' NOW ' ,
' AI ' ,
' A ' ,
' B ' ,
' C ' ,
' X ' ,
' O ' ]
2015-05-22 08:32:51 +00:00
valid_spaces = ( ' . ' , ' - ' )
2015-01-19 18:41:18 +00:00
for issexcept in issue_exceptions :
if issexcept . lower ( ) in issuenum . lower ( ) :
logger . fdebug ( ' ALPHANUMERIC EXCEPTION : [ ' + issexcept + ' ] ' )
if any ( v in issuenum for v in valid_spaces ) :
logger . fdebug ( ' character space denoted as : ' + iss_space )
else :
logger . fdebug ( ' character space not denoted. ' )
2015-05-22 08:32:51 +00:00
iss_space = ' '
# if issexcept == 'INH':
2015-01-19 18:41:18 +00:00
# issue_except = '.INH'
if issexcept == ' NOW ' :
if ' ! ' in issuenum : issuenum = re . sub ( ' \ ! ' , ' ' , issuenum )
# issue_except = '.NOW'
issue_except = iss_space + issexcept
logger . fdebug ( ' issue_except denoted as : ' + issue_except )
issuenum = re . sub ( " [^0-9] " , " " , issuenum )
break
2014-09-10 04:21:58 +00:00
2015-01-19 18:41:18 +00:00
# if 'au' in issuenum.lower() and issuenum[:1].isdigit():
# issue_except = ' AU'
# elif 'ai' in issuenum.lower() and issuenum[:1].isdigit():
# issuenum = re.sub("[^0-9]", "", issuenum)
# issue_except = ' AI'
# elif 'inh' in issuenum.lower() and issuenum[:1].isdigit():
# issuenum = re.sub("[^0-9]", "", issuenum)
# issue_except = '.INH'
# elif 'now' in issuenum.lower() and issuenum[:1].isdigit():
# if '!' in issuenum: issuenum = re.sub('\!', '', issuenum)
# issuenum = re.sub("[^0-9]", "", issuenum)
# issue_except = '.NOW'
2015-05-22 08:32:51 +00:00
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
if ' . ' in issuenum :
iss_find = issuenum . find ( ' . ' )
iss_b4dec = issuenum [ : iss_find ]
2015-05-22 08:32:51 +00:00
iss_decval = issuenum [ iss_find + 1 : ]
if iss_decval . endswith ( ' . ' ) :
2015-01-24 08:33:54 +00:00
iss_decval = iss_decval [ : - 1 ]
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 int ( iss_decval ) == 0 :
iss = iss_b4dec
issdec = int ( iss_decval )
issueno = str ( iss )
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' Issue Number: ' + str ( issueno ) )
2013-01-28 20:31:43 +00:00
else :
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 len ( iss_decval ) == 1 :
iss = iss_b4dec + " . " + iss_decval
issdec = int ( iss_decval ) * 10
else :
iss = iss_b4dec + " . " + iss_decval . rstrip ( ' 0 ' )
issdec = int ( iss_decval . rstrip ( ' 0 ' ) ) * 10
issueno = iss_b4dec
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' Issue Number: ' + str ( iss ) )
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
else :
iss = issuenum
issueno = str ( iss )
2014-01-16 20:25:02 +00:00
logger . fdebug ( ' iss: ' + str ( iss ) )
logger . fdebug ( ' issueno: ' + str ( issueno ) )
2013-01-28 20:31:43 +00:00
# issue zero-suppression here
if mylar . ZERO_LEVEL == " 0 " :
zeroadd = " "
else :
if mylar . ZERO_LEVEL_N == " none " : zeroadd = " "
elif mylar . ZERO_LEVEL_N == " 0x " : zeroadd = " 0 "
elif mylar . ZERO_LEVEL_N == " 00x " : zeroadd = " 00 "
2015-05-22 08:32:51 +00:00
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' Zero Suppression set to : ' + str ( mylar . ZERO_LEVEL_N ) )
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
prettycomiss = None
2013-01-28 20:31:43 +00:00
2015-01-19 18:41:18 +00:00
if issueno . isalpha ( ) :
logger . fdebug ( ' issue detected as an alpha. ' )
prettycomiss = str ( issueno )
else :
try :
x = float ( issueno )
#validity check
if x < 0 :
logger . info ( ' I \' ve encountered a negative issue #: ' + str ( issueno ) + ' . Trying to accomodate. ' )
prettycomiss = ' - ' + str ( zeroadd ) + str ( issueno [ 1 : ] )
elif x > = 0 :
pass
else :
raise ValueError
except ValueError , e :
logger . warn ( ' Unable to properly determine issue number [ ' + str ( issueno ) + ' ] - you should probably log this on github for help. ' )
return
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
if prettycomiss is None and len ( str ( issueno ) ) > 0 :
#if int(issueno) < 0:
# self._log("issue detected is a negative")
# prettycomiss = '-' + str(zeroadd) + str(abs(issueno))
if int ( issueno ) < 10 :
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' issue detected less than 10 ' )
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 iss :
if int ( iss_decval ) > 0 :
issueno = str ( iss )
prettycomiss = str ( zeroadd ) + str ( iss )
else :
prettycomiss = str ( zeroadd ) + str ( int ( issueno ) )
2013-01-28 20:31:43 +00:00
else :
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
prettycomiss = str ( zeroadd ) + str ( iss )
if issue_except != ' None ' :
prettycomiss = str ( prettycomiss ) + issue_except
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' Zero level supplement set to ' + str ( mylar . ZERO_LEVEL_N ) + ' . Issue will be set as : ' + str ( prettycomiss ) )
2013-01-28 20:31:43 +00:00
elif int ( issueno ) > = 10 and int ( issueno ) < 100 :
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' issue detected greater than 10, but less than 100 ' )
2013-01-28 20:31:43 +00:00
if mylar . ZERO_LEVEL_N == " none " :
zeroadd = " "
else :
zeroadd = " 0 "
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 iss :
if int ( iss_decval ) > 0 :
issueno = str ( iss )
prettycomiss = str ( zeroadd ) + str ( iss )
else :
prettycomiss = str ( zeroadd ) + str ( int ( issueno ) )
2013-01-28 20:31:43 +00:00
else :
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
prettycomiss = str ( zeroadd ) + str ( iss )
if issue_except != ' None ' :
prettycomiss = str ( prettycomiss ) + issue_except
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' Zero level supplement set to ' + str ( mylar . ZERO_LEVEL_N ) + ' .Issue will be set as : ' + str ( prettycomiss ) )
2013-01-28 20:31:43 +00:00
else :
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' issue detected greater than 100 ' )
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 iss :
if int ( iss_decval ) > 0 :
issueno = str ( iss )
2013-01-28 20:31:43 +00:00
prettycomiss = str ( issueno )
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 issue_except != ' None ' :
prettycomiss = str ( prettycomiss ) + issue_except
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' Zero level supplement set to ' + str ( mylar . ZERO_LEVEL_N ) + ' . Issue will be set as : ' + str ( prettycomiss ) )
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
elif len ( str ( issueno ) ) == 0 :
2013-01-28 20:31:43 +00:00
prettycomiss = str ( issueno )
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' issue length error - cannot determine length. Defaulting to None: ' + str ( prettycomiss ) )
2013-01-28 20:31:43 +00:00
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' Pretty Comic Issue is : ' + str ( prettycomiss ) )
2015-06-30 20:21:26 +00:00
issueyear = issuedate [ : 4 ]
month = issuedate [ 5 : 7 ] . replace ( ' - ' , ' ' ) . strip ( )
2014-02-26 19:48:50 +00:00
month_name = fullmonth ( month )
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' Issue Year : ' + str ( issueyear ) )
logger . fdebug ( ' Publisher: ' + str ( publisher ) )
logger . fdebug ( ' Series: ' + str ( series ) )
logger . fdebug ( ' Year: ' + str ( seriesyear ) )
logger . fdebug ( ' Comic Location: ' + str ( comlocation ) )
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 comversion is None :
comversion = ' None '
#if comversion is None, remove it so it doesn't populate with 'None'
if comversion == ' None ' :
2015-05-22 08:32:51 +00:00
chunk_f_f = re . sub ( ' \ $VolumeN ' , ' ' , mylar . FILE_FORMAT )
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
chunk_f = re . compile ( r ' \ s+ ' )
chunk_file_format = chunk_f . sub ( ' ' , chunk_f_f )
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' No version # found for series, removing from filename ' )
2014-01-16 20:25:02 +00:00
logger . fdebug ( " new format: " + str ( chunk_file_format ) )
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
else :
chunk_file_format = mylar . FILE_FORMAT
2013-01-28 20:31:43 +00:00
2014-01-16 20:25:02 +00:00
if annualize is None :
2015-05-22 08:32:51 +00:00
chunk_f_f = re . sub ( ' \ $Annual ' , ' ' , chunk_file_format )
2014-01-16 20:25:02 +00:00
chunk_f = re . compile ( r ' \ s+ ' )
chunk_file_format = chunk_f . sub ( ' ' , chunk_f_f )
logger . fdebug ( ' not an annual - removing from filename paramaters ' )
logger . fdebug ( ' new format: ' + str ( chunk_file_format ) )
else :
logger . fdebug ( ' chunk_file_format is: ' + str ( chunk_file_format ) )
2014-06-09 07:55:05 +00:00
if mylar . ANNUALS_ON :
if ' annual ' in series . lower ( ) :
if ' $Annual ' not in chunk_file_format : # and 'annual' not in ofilename.lower():
#if it's an annual, but $annual isn't specified in file_format, we need to
#force it in there, by default in the format of $Annual $Issue
#prettycomiss = "Annual " + str(prettycomiss)
logger . fdebug ( ' [ ' + series + ' ][ANNUALS-ON][ANNUAL IN SERIES][NOT $ANNUAL] prettycomiss: ' + str ( prettycomiss ) )
else :
#because it exists within title, strip it then use formatting tag for placement of wording.
2015-05-22 08:32:51 +00:00
chunk_f_f = re . sub ( ' \ $Annual ' , ' ' , chunk_file_format )
2014-06-09 07:55:05 +00:00
chunk_f = re . compile ( r ' \ s+ ' )
chunk_file_format = chunk_f . sub ( ' ' , chunk_f_f )
logger . fdebug ( ' [ ' + series + ' ][ANNUALS-ON][ANNUAL IN SERIES][$ANNUAL] prettycomiss: ' + str ( prettycomiss ) )
else :
if ' $Annual ' not in chunk_file_format : # and 'annual' not in ofilename.lower():
#if it's an annual, but $annual isn't specified in file_format, we need to
#force it in there, by default in the format of $Annual $Issue
prettycomiss = " Annual " + str ( prettycomiss )
logger . fdebug ( ' [ ' + series + ' ][ANNUALS-ON][ANNUAL NOT IN SERIES][NOT $ANNUAL] prettycomiss: ' + str ( prettycomiss ) )
else :
logger . fdebug ( ' [ ' + series + ' ][ANNUALS-ON][ANNUAL NOT IN SERIES][$ANNUAL] prettycomiss: ' + str ( prettycomiss ) )
else :
#if annuals aren't enabled, then annuals are being tracked as independent series.
#annualize will be true since it's an annual in the seriesname.
if ' annual ' in series . lower ( ) :
if ' $Annual ' not in chunk_file_format : # and 'annual' not in ofilename.lower():
#if it's an annual, but $annual isn't specified in file_format, we need to
#force it in there, by default in the format of $Annual $Issue
#prettycomiss = "Annual " + str(prettycomiss)
logger . fdebug ( ' [ ' + series + ' ][ANNUALS-OFF][ANNUAL IN SERIES][NOT $ANNUAL] prettycomiss: ' + str ( prettycomiss ) )
else :
#because it exists within title, strip it then use formatting tag for placement of wording.
2015-05-22 08:32:51 +00:00
chunk_f_f = re . sub ( ' \ $Annual ' , ' ' , chunk_file_format )
2014-06-09 07:55:05 +00:00
chunk_f = re . compile ( r ' \ s+ ' )
chunk_file_format = chunk_f . sub ( ' ' , chunk_f_f )
logger . fdebug ( ' [ ' + series + ' ][ANNUALS-OFF][ANNUAL IN SERIES][$ANNUAL] prettycomiss: ' + str ( prettycomiss ) )
else :
if ' $Annual ' not in chunk_file_format : # and 'annual' not in ofilename.lower():
#if it's an annual, but $annual isn't specified in file_format, we need to
#force it in there, by default in the format of $Annual $Issue
prettycomiss = " Annual " + str ( prettycomiss )
logger . fdebug ( ' [ ' + series + ' ][ANNUALS-OFF][ANNUAL NOT IN SERIES][NOT $ANNUAL] prettycomiss: ' + str ( prettycomiss ) )
else :
logger . fdebug ( ' [ ' + series + ' ][ANNUALS-OFF][ANNUAL NOT IN SERIES][$ANNUAL] prettycomiss: ' + str ( prettycomiss ) )
logger . fdebug ( ' Annual detected within series title of ' + series + ' . Not auto-correcting issue # ' )
2014-01-16 20:25:02 +00:00
2015-01-24 08:33:54 +00:00
seriesfilename = seriesfilename . encode ( ' ascii ' , ' ignore ' ) . strip ( )
2015-05-22 08:32:51 +00:00
filebad = [ ' : ' , ' , ' , ' / ' , ' ? ' , ' ! ' , ' \' ' ] #in u_comicname or '/' in u_comicname or ',' in u_comicname or '?' in u_comicname:
2014-06-23 19:10:24 +00:00
for dbd in filebad :
2015-01-24 08:33:54 +00:00
if dbd in seriesfilename :
2014-06-23 19:10:24 +00:00
if dbd == ' / ' : repthechar = ' - '
else : repthechar = ' '
2015-05-22 08:32:51 +00:00
seriesfilename = seriesfilename . replace ( dbd , repthechar )
2015-01-24 08:33:54 +00:00
logger . fdebug ( ' Altering series name due to filenaming restrictions: ' + seriesfilename )
2015-05-22 08:32:51 +00:00
publisher = re . sub ( ' ! ' , ' ' , publisher )
2014-06-23 19:10:24 +00:00
2015-01-24 08:33:54 +00:00
file_values = { ' $Series ' : seriesfilename ,
2013-01-28 20:31:43 +00:00
' $Issue ' : prettycomiss ,
' $Year ' : issueyear ,
' $series ' : series . lower ( ) ,
' $Publisher ' : publisher ,
' $publisher ' : publisher . lower ( ) ,
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
' $VolumeY ' : ' V ' + str ( seriesyear ) ,
2014-01-16 20:25:02 +00:00
' $VolumeN ' : comversion ,
2014-02-27 02:45:02 +00:00
' $monthname ' : month_name ,
2014-02-26 19:48:50 +00:00
' $month ' : month ,
2014-01-16 20:25:02 +00:00
' $Annual ' : ' Annual '
2013-01-28 20:31:43 +00:00
}
2015-01-16 19:40:08 +00:00
extensions = ( ' .cbr ' , ' .cbz ' , ' .cb7 ' )
2013-01-28 20:31:43 +00:00
2013-02-13 01:27:24 +00:00
if ofilename . lower ( ) . endswith ( extensions ) :
path , ext = os . path . splitext ( ofilename )
2013-01-28 20:31:43 +00:00
if mylar . FILE_FORMAT == ' ' :
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' Rename Files is not enabled - keeping original filename. ' )
2013-01-28 20:31:43 +00:00
#check if extension is in nzb_name - will screw up otherwise
if ofilename . lower ( ) . endswith ( extensions ) :
nfilename = ofilename [ : - 4 ]
else :
nfilename = ofilename
else :
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
nfilename = replace_all ( chunk_file_format , file_values )
2013-01-28 20:31:43 +00:00
if mylar . REPLACE_SPACES :
#mylar.REPLACE_CHAR ...determines what to replace spaces with underscore or dot
nfilename = nfilename . replace ( ' ' , mylar . REPLACE_CHAR )
2014-06-23 19:10:24 +00:00
2013-02-13 01:27:24 +00:00
nfilename = re . sub ( ' [ \ , \ :] ' , ' ' , nfilename ) + ext . lower ( )
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' New Filename: ' + str ( nfilename ) )
2013-01-28 20:31:43 +00:00
if mylar . LOWERCASE_FILENAMES :
2014-06-23 19:10:24 +00:00
dst = os . path . join ( comlocation , nfilename . lower ( ) )
2013-01-28 20:31:43 +00:00
else :
2014-06-23 19:10:24 +00:00
dst = os . path . join ( comlocation , nfilename )
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' Source: ' + str ( ofilename ) )
logger . fdebug ( ' Destination: ' + str ( dst ) )
2013-01-28 20:31:43 +00:00
2015-05-22 08:32:51 +00:00
rename_this = { " destination_dir " : dst ,
" nfilename " : nfilename ,
" issueid " : issueid ,
" comicid " : comicid }
2013-01-28 20:31:43 +00:00
return rename_this
2013-03-07 19:33:16 +00:00
def apiremove ( apistring , type ) :
if type == ' nzb ' :
value_regex = re . compile ( " (?<=apikey=)(?P<value>.*?)(?=$) " )
#match = value_regex.search(apistring)
apiremoved = value_regex . sub ( " xUDONTNEEDTOKNOWTHISx " , apistring )
else :
#type = $ to denote end of string
#type = & to denote up until next api variable
value_regex = re . compile ( " (?<= %26i =1 %26r =)(?P<value>.*?)(?= " + str ( type ) + " ) " )
#match = value_regex.search(apistring)
2015-05-22 08:32:51 +00:00
apiremoved = value_regex . sub ( " xUDONTNEEDTOKNOWTHISx " , apistring )
2013-03-07 19:33:16 +00:00
2015-05-14 09:33:40 +00:00
#need to remove the urlencoded-portions as well in future
2013-03-07 19:33:16 +00:00
return apiremoved
2013-03-14 08:33:16 +00:00
2015-05-22 08:32:51 +00:00
def ComicSort ( comicorder = None , sequence = None , imported = None ) :
2013-03-21 17:09:10 +00:00
if sequence :
# if it's on startup, load the sql into a tuple for use to avoid record-locking
i = 0
2015-01-02 06:56:01 +00:00
import logger
IMP: 32P support added (identical to CBT, no backlog searching but full RSS url is required for usage), IMP: Threaded RSS Check (will only run once concurrently), IMP: Added option to enable/disable Snatched/Failed to show on Wanted tab, FIX: Removed UID from dognzb config, IMP: Removed apikey from being stored in db for dognzb, IMP: Will only store ID/HASH for torrents, instead of entire link - will recreate dynamically as required, IMP: Switched to requests for torrent retrieval, IMP: Removed getdefaultlocal requirements on startup (would fail startup on some OSX systems), IMP: Will now display covers that are in 00.png format when viewing issue details, IMP: Fixed incorrect logic for dupecheck status checks, FIX: Removed some unneeded print statements
2015-04-15 04:10:52 +00:00
import db
myDB = db . DBConnection ( )
comicsort = myDB . select ( " SELECT * FROM comics ORDER BY ComicSortName COLLATE NOCASE " )
2013-03-21 17:09:10 +00:00
comicorderlist = [ ]
comicorder = { }
2013-03-16 17:16:42 +00:00
comicidlist = [ ]
2013-03-21 17:09:10 +00:00
if sequence == ' update ' :
2013-03-30 16:53:07 +00:00
mylar . COMICSORT [ ' SortOrder ' ] = None
2013-03-21 17:09:10 +00:00
mylar . COMICSORT [ ' LastOrderNo ' ] = None
mylar . COMICSORT [ ' LastOrderID ' ] = None
2013-03-14 08:33:16 +00:00
for csort in comicsort :
2013-03-16 17:16:42 +00:00
if csort [ ' ComicID ' ] is None : pass
if not csort [ ' ComicID ' ] in comicidlist :
2013-03-21 17:09:10 +00:00
if sequence == ' startup ' :
comicorderlist . append ( {
' ComicID ' : csort [ ' ComicID ' ] ,
' ComicOrder ' : i
} )
elif sequence == ' update ' :
2013-03-30 16:53:07 +00:00
comicorderlist . append ( {
# mylar.COMICSORT['SortOrder'].append({
2013-03-21 17:09:10 +00:00
' ComicID ' : csort [ ' ComicID ' ] ,
' ComicOrder ' : i
} )
2013-03-16 17:16:42 +00:00
comicidlist . append ( csort [ ' ComicID ' ] )
i + = 1
2013-03-21 17:09:10 +00:00
if sequence == ' startup ' :
2015-05-22 08:32:51 +00:00
if i == 0 :
comicorder [ ' SortOrder ' ] = ( { ' ComicID ' : ' 99999 ' , ' ComicOrder ' : 1 } )
2013-03-30 16:53:07 +00:00
comicorder [ ' LastOrderNo ' ] = 1
comicorder [ ' LastOrderID ' ] = 99999
2015-05-22 08:32:51 +00:00
else :
2013-03-30 16:53:07 +00:00
comicorder [ ' SortOrder ' ] = comicorderlist
2015-05-22 08:32:51 +00:00
comicorder [ ' LastOrderNo ' ] = i - 1
comicorder [ ' LastOrderID ' ] = comicorder [ ' SortOrder ' ] [ i - 1 ] [ ' ComicID ' ]
2014-12-01 17:25:35 +00:00
if i < 0 : i == 0
2015-05-22 08:32:51 +00:00
logger . info ( ' Sucessfully ordered ' + str ( i - 1 ) + ' series in your watchlist. ' )
2013-03-21 17:09:10 +00:00
return comicorder
elif sequence == ' update ' :
2013-03-30 16:53:07 +00:00
mylar . COMICSORT [ ' SortOrder ' ] = comicorderlist
2014-12-01 17:25:35 +00:00
#print ("i:" + str(i))
2013-03-30 16:53:07 +00:00
if i == 0 :
placemnt = 1
else :
2015-05-22 08:32:51 +00:00
placemnt = int ( i - 1 )
2013-03-30 16:53:07 +00:00
mylar . COMICSORT [ ' LastOrderNo ' ] = placemnt
mylar . COMICSORT [ ' LastOrderID ' ] = mylar . COMICSORT [ ' SortOrder ' ] [ placemnt ] [ ' ComicID ' ]
2015-05-22 08:32:51 +00:00
return
2013-03-21 17:09:10 +00:00
else :
# for new series adds, we already know the comicid, so we set the sortorder to an abnormally high #
# we DO NOT write to the db to avoid record-locking.
# if we get 2 999's we're in trouble though.
sortedapp = [ ]
if comicorder [ ' LastOrderNo ' ] == ' 999 ' :
lastorderval = int ( comicorder [ ' LastOrderNo ' ] ) + 1
else :
lastorderval = 999
sortedapp . append ( {
' ComicID ' : imported ,
' ComicOrder ' : lastorderval
} )
mylar . COMICSORT [ ' SortOrder ' ] = sortedapp
mylar . COMICSORT [ ' LastOrderNo ' ] = lastorderval
mylar . COMICSORT [ ' LastOrderID ' ] = imported
return
2015-05-22 08:32:51 +00:00
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
def fullmonth ( monthno ) :
#simple numerical to worded month conversion....
2015-05-22 08:32:51 +00:00
basmonths = { ' 1 ' : ' January ' , ' 2 ' : ' February ' , ' 3 ' : ' March ' , ' 4 ' : ' April ' , ' 5 ' : ' May ' , ' 6 ' : ' June ' , ' 7 ' : ' July ' , ' 8 ' : ' August ' , ' 9 ' : ' September ' , ' 10 ' : ' October ' , ' 11 ' : ' November ' , ' 12 ' : ' December ' }
FIX:(#304) Index out of range on recheck, FIX:(#303) Comicvine link updated on details page, FIX:(#302) Query rate (Search Delay) Added as a configuration option, FIX:(#300) Version number error on searching when no version number, FIX:(#297) Manual Rename of Files working, FIX:(#294) 'AU' issue problems should be resolved now, FIX:(#290) V#(year) and Vol#(year) added to filechecking, IMP: ComicVine data use only now as a hidden option (cv_only = 1 in config.ini), IMP: added as options for file naming, IMP: Rough drafting of Annuals (annuals_on = 1 in config.ini), Other fixes..
2013-04-06 09:43:18 +00:00
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
monthconv = None
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
for numbs in basmonths :
if numbs in str ( int ( monthno ) ) :
monthconv = basmonths [ numbs ]
return monthconv
2013-05-06 04:35:33 +00:00
def updateComicLocation ( ) :
2014-11-21 17:16:28 +00:00
#in order for this to work, the ComicLocation MUST be left at the original location.
#in the config.ini - set LOCMOVE = 1 (to enable this to run on the NEXT startup)
# - set NEWCOMDIR = new ComicLocation
#after running, set ComicLocation to new location in Configuration GUI
2013-05-06 04:35:33 +00:00
import db , logger
myDB = db . DBConnection ( )
if mylar . NEWCOM_DIR is not None :
2013-08-19 06:14:47 +00:00
logger . info ( ' Performing a one-time mass update to Comic Location ' )
2013-05-06 04:35:33 +00:00
#create the root dir if it doesn't exist
FIX: included version of comictagger should now work with both Windows and *nix based OS' again, IMP: Global Copy/Move option available when performing post-processing, IMP: Added a verbose file-checking option (FOLDER_SCAN_LOG_VERBOSE) - when enabled will log as it currently does during manual post-processing/file-checking runs, when disabled it will not spam the log nearly as much resulting in more readable log files, IMP: Added Verbose debug logging both via startup option(-v), as well as toggle button in Log GUI (from headphones), as well as per-page loading of log file(s) in GUI, FIX: When doing manual post-processing on issues that were in story arcs, will now indicate X story-arc issues were post-processed for better visibility, FIX: Fixed an issue with deleting from the nzblog table when story arc issues were post-processed, IMP: Added WEEKFOLDER_LOC to the config.ini to allow for specification of where the weekly download directories will default to (as opposed to off of ComicLocation root), IMP: Better handling of some special character references in series titles when looking for series on the auto-wanted list, IMP: 32P will now auto-disable provider if logon returns invalid credentials, FIX: When using alt_pull on weekly pull list, xA0 unicode character caused error, FIX: If title had invalid character in filename that was replaced with a character that already existed in the title, would not scan in during file-checking, FIX: When searching for a series (weeklypull-list/add a series), if the title contained 'and' or '&' would return really mixed up results, FIX: When Post-Processing, if filename being processed had special characters (ie. comma) and was different than nzbname, in some cases would fail to find/move issues, IMP: Utilize internal comictagger to convert from cbr/cbz, IMP: Added more checks when post-processing to ensure files are handled correctly, IMP: Added meta-tag reading when importing series/issues - if previously tagged with CT, will reverse look-up the provided IssueID to reference the correct ComicID, IMP: If scanned directory during import contins cvinfo file, use that and force the ComicID to entire directory when importing a series, IMP: Manual meta-tagging issues will no longer create temporary directories and/or create files in the Comic Location root causing problems for some users, FIX: Annuals weren't properly sorted upon loading of comic details page for some series, IMP: Added some extra checks when validating/creating directories, FIX: Fixed a problem when displaying some covers of .cbz files on the comic details page
2016-01-26 07:49:56 +00:00
checkdirectory = mylar . filechecker . validateAndCreateDirectory ( mylar . NEWCOM_DIR , create = True )
if not checkdirectory :
logger . warn ( ' Error trying to validate/create directory. Aborting this process at this time. ' )
return
2013-05-06 04:35:33 +00:00
dirlist = myDB . select ( " SELECT * FROM comics " )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
comloc = [ ]
2013-05-25 06:18:00 +00:00
2013-05-06 04:35:33 +00:00
if dirlist is not None :
for dl in dirlist :
2015-05-22 08:32:51 +00:00
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
u_comicnm = dl [ ' ComicName ' ]
# let's remove the non-standard characters here that will break filenaming / searching.
comicname_folder = filesafe ( u_comicnm )
2015-05-22 08:32:51 +00:00
publisher = re . sub ( ' ! ' , ' ' , dl [ ' ComicPublisher ' ] ) # thanks Boom!
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
year = dl [ ' ComicYear ' ]
comversion = dl [ ' ComicVersion ' ]
2013-05-25 06:18:00 +00:00
if comversion is None :
comversion = ' None '
#if comversion is None, remove it so it doesn't populate with 'None'
if comversion == ' None ' :
2015-05-22 08:32:51 +00:00
chunk_f_f = re . sub ( ' \ $VolumeN ' , ' ' , mylar . FOLDER_FORMAT )
2013-05-25 06:18:00 +00:00
chunk_f = re . compile ( r ' \ s+ ' )
folderformat = chunk_f . sub ( ' ' , chunk_f_f )
else :
folderformat = mylar . FOLDER_FORMAT
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
#do work to generate folder path
values = { ' $Series ' : comicname_folder ,
' $Publisher ' : publisher ,
' $Year ' : year ,
' $series ' : comicname_folder . lower ( ) ,
' $publisher ' : publisher . lower ( ) ,
' $VolumeY ' : ' V ' + str ( year ) ,
' $VolumeN ' : comversion ,
' $Annual ' : ' Annual '
2013-05-25 06:18:00 +00:00
}
2013-07-01 05:19:15 +00:00
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
2013-05-25 06:18:00 +00:00
if mylar . FFTONEWCOM_DIR :
#if this is enabled (1) it will apply the Folder_Format to all the new dirs
if mylar . FOLDER_FORMAT == ' ' :
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
comlocation = re . sub ( mylar . DESTINATION_DIR , mylar . NEWCOM_DIR , dl [ ' ComicLocation ' ] ) . strip ( )
2013-05-25 06:18:00 +00:00
else :
2015-05-22 08:32:51 +00:00
first = replace_all ( folderformat , values )
2013-05-26 03:18:29 +00:00
if mylar . REPLACE_SPACES :
#mylar.REPLACE_CHAR ...determines what to replace spaces with underscore or dot
first = first . replace ( ' ' , mylar . REPLACE_CHAR )
2015-05-22 08:32:51 +00:00
comlocation = os . path . join ( mylar . NEWCOM_DIR , first ) . strip ( )
2013-05-26 03:18:29 +00:00
2013-05-25 06:18:00 +00:00
else :
2014-11-21 17:16:28 +00:00
#DESTINATION_DIR = /mnt/mediavg/Comics
#NEWCOM_DIR = /mnt/mediavg/Comics/Comics-1
#dl['ComicLocation'] = /mnt/mediavg/Comics/Batman-(2011)
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
comlocation = re . sub ( mylar . DESTINATION_DIR , mylar . NEWCOM_DIR , dl [ ' ComicLocation ' ] ) . strip ( )
comloc . append ( { " comlocation " : comlocation ,
" origlocation " : dl [ ' ComicLocation ' ] ,
" comicid " : dl [ ' ComicID ' ] } )
2013-05-25 06:18:00 +00:00
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
if len ( comloc ) > 0 :
#give the information about what we're doing.
if mylar . FFTONEWCOM_DIR :
logger . info ( ' FFTONEWCOM_DIR is enabled. Applying the existing folder format to ALL directories regardless of existing location paths ' )
else :
logger . info ( ' FFTONEWCOM_DIR is not enabled. I will keep existing subdirectory paths, and will only change the actual Comic Location in the path. ' )
logger . fdebug ( ' (ie. /mnt/Comics/Marvel/Hush-(2012) to /mnt/mynewLocation/Marvel/Hush-(2012) ' )
#do the deed.
for cl in comloc :
ctrlVal = { " ComicID " : cl [ ' comicid ' ] }
newVal = { " ComicLocation " : cl [ ' comlocation ' ] }
2014-11-21 17:16:28 +00:00
myDB . upsert ( " Comics " , newVal , ctrlVal )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
logger . fdebug ( ' Updated : ' + cl [ ' origlocation ' ] + ' .: TO :. ' + cl [ ' comlocation ' ] )
logger . info ( ' Updated ' + str ( len ( comloc ) ) + ' series to a new Comic Location as specified in the config.ini ' )
else :
logger . fdebug ( ' Failed in updating the Comic Locations. Check Folder Format string and/or log the issue. ' )
else :
logger . info ( ' There are no series in your watchlist to Update the locations. Not updating anything at this time. ' )
2013-05-06 04:35:33 +00:00
#set the value to 0 here so we don't keep on doing this...
mylar . LOCMOVE = 0
mylar . config_write ( )
else :
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
logger . info ( ' No new ComicLocation path specified - not updating. Set NEWCOMD_DIR in config.ini ' )
2013-05-06 04:35:33 +00:00
#raise cherrypy.HTTPRedirect("config")
return
2013-05-15 09:09:43 +00:00
def cleanhtml ( raw_html ) :
#cleanr = re.compile('<.*?>')
#cleantext = re.sub(cleanr, '', raw_html)
#return cleantext
from bs4 import BeautifulSoup
VALID_TAGS = [ ' div ' , ' p ' ]
soup = BeautifulSoup ( raw_html )
for tag in soup . findAll ( ' p ' ) :
if tag . name not in VALID_TAGS :
tag . replaceWith ( tag . renderContents ( ) )
flipflop = soup . renderContents ( )
print flipflop
return flipflop
2013-07-01 05:19:15 +00:00
def issuedigits ( issnum ) :
import db , logger
2015-05-22 08:32:51 +00:00
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
int_issnum = None
2015-01-02 00:58:31 +00:00
try :
tst = issnum . isdigit ( )
except :
return 9999999999
2014-09-08 08:35:15 +00:00
if issnum . isdigit ( ) :
2015-05-22 08:32:51 +00:00
int_issnum = int ( issnum ) * 1000
2013-07-01 05:19:15 +00:00
else :
2014-06-09 19:49:55 +00:00
#count = 0
#for char in issnum:
# if char.isalpha():
# count += 1
#if count > 5:
# logger.error('This is not an issue number - not enough numerics to parse')
# int_issnum = 999999999999999
# return int_issnum
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
try :
if ' au ' in issnum . lower ( ) and issnum [ : 1 ] . isdigit ( ) :
int_issnum = ( int ( issnum [ : - 2 ] ) * 1000 ) + ord ( ' a ' ) + ord ( ' u ' )
elif ' ai ' in issnum . lower ( ) and issnum [ : 1 ] . isdigit ( ) :
int_issnum = ( int ( issnum [ : - 2 ] ) * 1000 ) + ord ( ' a ' ) + ord ( ' i ' )
elif ' inh ' in issnum . lower ( ) or ' now ' in issnum . lower ( ) :
remdec = issnum . find ( ' . ' ) #find the decimal position.
if remdec == - 1 :
2014-01-27 04:23:11 +00:00
#if no decimal, it's all one string
#remove the last 3 characters from the issue # (INH)
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
int_issnum = ( int ( issnum [ : - 3 ] ) * 1000 ) + ord ( ' i ' ) + ord ( ' n ' ) + ord ( ' h ' )
else :
int_issnum = ( int ( issnum [ : - 4 ] ) * 1000 ) + ord ( ' i ' ) + ord ( ' n ' ) + ord ( ' h ' )
elif ' now ' in issnum . lower ( ) :
if ' ! ' in issnum : issnum = re . sub ( ' \ ! ' , ' ' , issnum )
remdec = issnum . find ( ' . ' ) #find the decimal position.
if remdec == - 1 :
2015-05-22 08:32:51 +00:00
#if no decimal, it's all one string
2014-01-27 04:23:11 +00:00
#remove the last 3 characters from the issue # (NOW)
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
int_issnum = ( int ( issnum [ : - 3 ] ) * 1000 ) + ord ( ' n ' ) + ord ( ' o ' ) + ord ( ' w ' )
else :
int_issnum = ( int ( issnum [ : - 4 ] ) * 1000 ) + ord ( ' n ' ) + ord ( ' o ' ) + ord ( ' w ' )
except ValueError as e :
logger . error ( ' [ ' + issnum + ' ] Unable to properly determine the issue number. Error: %s ' , e )
return 9999999999
if int_issnum is not None :
return int_issnum
2013-07-01 05:19:15 +00:00
elif u ' \xbd ' in issnum :
2014-09-08 08:35:15 +00:00
int_issnum = .5 * 1000
2013-08-07 06:27:12 +00:00
elif u ' \xbc ' in issnum :
2014-09-08 08:35:15 +00:00
int_issnum = .25 * 1000
2013-08-07 06:27:12 +00:00
elif u ' \xbe ' in issnum :
2014-09-08 08:35:15 +00:00
int_issnum = .75 * 1000
2013-09-18 04:49:24 +00:00
elif u ' \u221e ' in issnum :
#issnum = utf-8 will encode the infinity symbol without any help
int_issnum = 9999999999 * 1000 # set 9999999999 for integer value of issue
2013-07-01 05:19:15 +00:00
elif ' . ' in issnum or ' , ' in issnum :
2013-09-09 04:39:08 +00:00
#logger.fdebug('decimal detected.')
2015-05-22 08:32:51 +00:00
if ' , ' in issnum : issnum = re . sub ( ' , ' , ' . ' , issnum )
2013-07-01 05:19:15 +00:00
issst = str ( issnum ) . find ( ' . ' )
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 issst == 0 :
issb4dec = 0
else :
issb4dec = str ( issnum ) [ : issst ]
2015-05-22 08:32:51 +00:00
decis = str ( issnum ) [ issst + 1 : ]
2013-07-01 05:19:15 +00:00
if len ( decis ) == 1 :
decisval = int ( decis ) * 10
issaftdec = str ( decisval )
2015-01-02 06:56:01 +00:00
elif len ( decis ) == 2 :
2013-07-01 05:19:15 +00:00
decisval = int ( decis )
issaftdec = str ( decisval )
2015-01-02 06:56:01 +00:00
else :
decisval = decis
issaftdec = str ( decisval )
#if there's a trailing decimal (ie. 1.50.) and it's either intentional or not, blow it away.
if issaftdec [ - 1 : ] == ' . ' :
issaftdec = issaftdec [ : - 1 ]
2013-07-01 05:19:15 +00:00
try :
2013-07-31 06:34:07 +00:00
int_issnum = ( int ( issb4dec ) * 1000 ) + ( int ( issaftdec ) * 10 )
2013-07-01 05:19:15 +00:00
except ValueError :
2014-03-02 19:57:57 +00:00
#logger.fdebug('This has no issue # for me to get - Either a Graphic Novel or one-shot.')
2013-07-01 05:19:15 +00:00
int_issnum = 999999999999999
else :
try :
x = float ( issnum )
#validity check
if x < 0 :
#logger.info("I've encountered a negative issue #: " + str(issnum) + ". Trying to accomodate.")
2015-05-22 08:32:51 +00:00
int_issnum = ( int ( x ) * 1000 ) - 1
2013-07-01 05:19:15 +00:00
else : raise ValueError
except ValueError , e :
2013-07-31 06:34:07 +00:00
#this will account for any alpha in a issue#, so long as it doesn't have decimals.
x = 0
2013-07-31 14:41:43 +00:00
tstord = None
issno = None
2013-09-05 02:36:41 +00:00
invchk = " false "
2013-07-31 06:34:07 +00:00
while ( x < len ( issnum ) ) :
if issnum [ x ] . isalpha ( ) :
#take first occurance of alpha in string and carry it through
2013-07-31 14:41:43 +00:00
tstord = issnum [ x : ] . rstrip ( )
2015-05-22 08:32:51 +00:00
tstord = re . sub ( ' [ \ - \ , \ . \ +] ' , ' ' , tstord ) . rstrip ( )
2013-07-31 14:41:43 +00:00
issno = issnum [ : x ] . rstrip ( )
2015-05-22 08:32:51 +00:00
issno = re . sub ( ' [ \ - \ , \ . \ +] ' , ' ' , issno ) . rstrip ( )
2013-09-05 02:36:41 +00:00
try :
isschk = float ( issno )
except ValueError , e :
2014-09-08 08:35:15 +00:00
if len ( issnum ) == 1 and issnum . isalpha ( ) :
break
2015-01-02 00:58:31 +00:00
logger . fdebug ( ' [ ' + issno + ' ] Invalid numeric for issue - cannot be found. Ignoring. ' )
2013-09-05 02:36:41 +00:00
issno = None
tstord = None
invchk = " true "
2013-07-31 06:34:07 +00:00
break
x + = 1
if tstord is not None and issno is not None :
a = 0
ordtot = 0
2014-09-08 08:35:15 +00:00
if len ( issnum ) == 1 and issnum . isalpha ( ) :
int_issnum = ord ( tstord . lower ( ) )
else :
while ( a < len ( tstord ) ) :
try :
ordtot + = ord ( tstord [ a ] . lower ( ) ) #lower-case the letters for simplicty
except ValueError :
break
a + = 1
int_issnum = ( int ( issno ) * 1000 ) + ordtot
2013-09-05 02:36:41 +00:00
elif invchk == " true " :
logger . fdebug ( ' this does not have an issue # that I can parse properly. ' )
int_issnum = 999999999999999
2013-07-31 06:34:07 +00:00
else :
2013-08-19 06:14:47 +00:00
logger . error ( str ( issnum ) + ' this has an alpha-numeric in the issue # which I cannot account for. ' )
2013-07-31 06:34:07 +00:00
int_issnum = 999999999999999
2013-07-01 05:19:15 +00:00
return int_issnum
def checkthepub ( ComicID ) :
import db , logger
myDB = db . DBConnection ( )
publishers = [ ' marvel ' , ' dc ' , ' darkhorse ' ]
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
pubchk = myDB . selectone ( " SELECT * FROM comics WHERE ComicID=? " , [ ComicID ] ) . fetchone ( )
2013-07-01 05:19:15 +00:00
if pubchk is None :
2013-08-19 06:14:47 +00:00
logger . fdebug ( ' No publisher information found to aid in determining series..defaulting to base check of 55 days. ' )
2013-07-01 05:19:15 +00:00
return mylar . BIGGIE_PUB
else :
for publish in publishers :
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
if publish in pubchk [ ' ComicPublisher ' ] . lower ( ) :
logger . fdebug ( ' Biggie publisher detected - ' + pubchk [ ' ComicPublisher ' ] )
2013-07-01 05:19:15 +00:00
return mylar . BIGGIE_PUB
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
logger . fdebug ( ' Indie publisher detected - ' + pubchk [ ' ComicPublisher ' ] )
2013-07-01 05:19:15 +00:00
return mylar . INDIE_PUB
2013-07-30 04:57:37 +00:00
def annual_update ( ) :
import db , logger
myDB = db . DBConnection ( )
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
annuallist = myDB . select ( ' SELECT * FROM annuals ' )
2013-07-30 04:57:37 +00:00
if annuallist is None :
2013-08-19 06:14:47 +00:00
logger . info ( ' no annuals to update. ' )
2013-07-30 04:57:37 +00:00
return
cnames = [ ]
#populate the ComicName field with the corresponding series name from the comics table.
for ann in annuallist :
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
coms = myDB . selectone ( ' SELECT * FROM comics WHERE ComicID=? ' , [ ann [ ' ComicID ' ] ] ) . fetchone ( )
2013-07-30 04:57:37 +00:00
cnames . append ( { ' ComicID ' : ann [ ' ComicID ' ] ,
' ComicName ' : coms [ ' ComicName ' ]
} )
#write in a seperate loop to avoid db locks
i = 0
for cns in cnames :
ctrlVal = { " ComicID " : cns [ ' ComicID ' ] }
newVal = { " ComicName " : cns [ ' ComicName ' ] }
myDB . upsert ( " annuals " , newVal , ctrlVal )
i + = 1
2013-08-19 06:14:47 +00:00
logger . info ( str ( i ) + ' series have been updated in the annuals table. ' )
2015-05-22 08:32:51 +00:00
return
2013-07-30 04:57:37 +00:00
def replacetheslash ( data ) :
# this is necessary for the cache directory to display properly in IE/FF.
2015-05-22 08:32:51 +00:00
# os.path.join will pipe in the '\' in windows, which won't resolve
# when viewing through cherrypy - so convert it and viola.
2013-07-30 04:57:37 +00:00
if platform . system ( ) == " Windows " :
2013-07-30 18:50:15 +00:00
slashreplaced = data . replace ( ' \\ ' , ' / ' )
2013-07-30 04:57:37 +00:00
else :
slashreplaced = data
return slashreplaced
def urlretrieve ( urlfile , fpath ) :
chunk = 4096
f = open ( fpath , " w " )
while 1 :
data = urlfile . read ( chunk )
if not data :
print " done. "
break
f . write ( data )
print " Read %s bytes " % len ( data )
2013-09-18 04:49:24 +00:00
def renamefile_readingorder ( readorder ) :
import logger
logger . fdebug ( ' readingorder#: ' + str ( readorder ) )
if int ( readorder ) < 10 : readord = " 00 " + str ( readorder )
elif int ( readorder ) > 10 and int ( readorder ) < 99 : readord = " 0 " + str ( readorder )
else : readord = str ( readorder )
return readord
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
def latestdate_fix ( ) :
import db , logger
datefix = [ ]
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
cnupdate = [ ]
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
myDB = db . DBConnection ( )
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
comiclist = myDB . select ( ' SELECT * FROM comics ' )
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 comiclist is None :
logger . fdebug ( ' No Series in watchlist to correct latest date ' )
return
for cl in comiclist :
2015-05-22 08:32:51 +00:00
if cl [ ' ComicName_Filesafe ' ] is None :
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
cnupdate . append ( { " comicid " : cl [ ' ComicID ' ] ,
" comicname_filesafe " : filesafe ( cl [ ' ComicName ' ] ) } )
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
latestdate = cl [ ' LatestDate ' ]
#logger.fdebug("latestdate: " + str(latestdate))
if latestdate [ 8 : ] == ' ' :
#logger.fdebug("invalid date " + str(latestdate) + " appending 01 for day to avoid errors")
if len ( latestdate ) < = 7 :
finddash = latestdate . find ( ' - ' )
#logger.info('dash found at position ' + str(finddash))
if finddash != 4 : #format of mm-yyyy
lat_month = latestdate [ : finddash ]
2015-05-22 08:32:51 +00:00
lat_year = latestdate [ finddash + 1 : ]
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
else : #format of yyyy-mm
2015-05-22 08:32:51 +00:00
lat_month = latestdate [ finddash + 1 : ]
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
lat_year = latestdate [ : finddash ]
latestdate = ( lat_year ) + ' - ' + str ( lat_month ) + ' -01 '
datefix . append ( { " comicid " : cl [ ' ComicID ' ] ,
" latestdate " : latestdate } )
#logger.info('latest date: ' + str(latestdate))
#now we fix.
if len ( datefix ) > 0 :
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
logger . info ( ' Preparing to correct/fix ' + str ( len ( datefix ) ) + ' series that have incorrect values given for the Latest Date field. ' )
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 df in datefix :
newCtrl = { " ComicID " : df [ ' comicid ' ] }
newVal = { " LatestDate " : df [ ' latestdate ' ] }
myDB . upsert ( " comics " , newVal , newCtrl )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
if len ( cnupdate ) > 0 :
logger . info ( ' Preparing to update ' + str ( len ( cnupdate ) ) + ' series on your watchlist for use with non-ascii characters ' )
for cn in cnupdate :
newCtrl = { " ComicID " : cn [ ' comicid ' ] }
newVal = { " ComicName_Filesafe " : cn [ ' comicname_filesafe ' ] }
myDB . upsert ( " comics " , newVal , newCtrl )
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
return
def checkFolder ( ) :
2014-07-30 05:11:19 +00:00
from mylar import PostProcessor , logger
import Queue
queue = Queue . Queue ( )
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
#monitor a selected folder for 'snatched' files that haven't been processed
logger . info ( ' Checking folder ' + mylar . CHECK_FOLDER + ' for newly snatched downloads ' )
2014-07-30 05:11:19 +00:00
PostProcess = PostProcessor . PostProcessor ( ' Manual Run ' , mylar . CHECK_FOLDER , queue = queue )
vals = PostProcess . Process ( )
return
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
2014-02-26 19:48:50 +00:00
def LoadAlternateSearchNames ( seriesname_alt , comicid ) :
2015-05-22 08:32:51 +00:00
import logger
2014-02-26 19:48:50 +00:00
#seriesname_alt = db.comics['AlternateSearch']
AS_Alt = [ ]
Alternate_Names = { }
alt_count = 0
2014-03-04 05:11:52 +00:00
#logger.fdebug('seriesname_alt:' + str(seriesname_alt))
2014-02-26 19:48:50 +00:00
if seriesname_alt is None or seriesname_alt == ' None ' :
logger . fdebug ( ' no Alternate name given. Aborting search. ' )
return " no results "
else :
chkthealt = seriesname_alt . split ( ' ## ' )
if chkthealt == 0 :
AS_Alternate = seriesname_alt
AS_Alt . append ( seriesname_alt )
for calt in chkthealt :
2015-05-22 08:32:51 +00:00
AS_Alter = re . sub ( ' ## ' , ' ' , calt )
2014-02-26 19:48:50 +00:00
u_altsearchcomic = AS_Alter . encode ( ' ascii ' , ' ignore ' ) . strip ( )
AS_formatrem_seriesname = re . sub ( ' \ s+ ' , ' ' , u_altsearchcomic )
if AS_formatrem_seriesname [ : 1 ] == ' ' : AS_formatrem_seriesname = AS_formatrem_seriesname [ 1 : ]
AS_Alt . append ( { " AlternateName " : AS_formatrem_seriesname } )
alt_count + = 1
Alternate_Names [ ' AlternateName ' ] = AS_Alt
Alternate_Names [ ' ComicID ' ] = comicid
Alternate_Names [ ' Count ' ] = alt_count
2014-03-04 05:11:52 +00:00
#logger.info('AlternateNames returned:' + str(Alternate_Names))
2014-02-26 19:48:50 +00:00
return Alternate_Names
2014-06-02 19:02:28 +00:00
FIX: (#746) updated autoProcessComics.py / ComicRN.py's which will now send proper completion messeages to clients, FIX: (#752) refresh series will now test if a series is 'out of whack' with it's numerical issue count (ie. 5/4) or it has no issue data due to a bad refresh / api maxing out and will adjust it's processing to accomodate either, IMP: (#750) Added ComicVine API Checker which will check API counts at regular intervals to inform/warn users of usage, as well as adding a screen-time display of API hits / mins used at the bottom of every page (refreshing/reloading pages will update counts), FIX: (#747)EOL normalization (dos2unix) on search.py - removed classes & exceptions as not being used, IMP: (#747) Skip processing issues with an invalid store date & issue date (thnx rupaschomaker), FIX: Removed strings when searching/logging torrents as was causing ascii errors especially with KAT, IMP: Added [META-TAGGING] to logging for meta-tagging module, IMP: Added ability in GUI to select CR or Cbl tags (or both) when writing metadata to cbz files, IMP: Improved support/usage with ComicTagger v1.1.15 which allows for personal CV API Key usage - if supplied to Mylar, will use when tagging with ComicTagger, IMP: Added Manual Search option to allow for individual searches of issues without changing initial status.
2014-06-18 19:58:19 +00:00
def havetotals ( refreshit = None ) :
2014-06-02 19:02:28 +00:00
import db , logger
comics = [ ]
IMP: 32P support added (identical to CBT, no backlog searching but full RSS url is required for usage), IMP: Threaded RSS Check (will only run once concurrently), IMP: Added option to enable/disable Snatched/Failed to show on Wanted tab, FIX: Removed UID from dognzb config, IMP: Removed apikey from being stored in db for dognzb, IMP: Will only store ID/HASH for torrents, instead of entire link - will recreate dynamically as required, IMP: Switched to requests for torrent retrieval, IMP: Removed getdefaultlocal requirements on startup (would fail startup on some OSX systems), IMP: Will now display covers that are in 00.png format when viewing issue details, IMP: Fixed incorrect logic for dupecheck status checks, FIX: Removed some unneeded print statements
2015-04-15 04:10:52 +00:00
myDB = db . DBConnection ( )
2014-06-02 19:02:28 +00:00
FIX: (#746) updated autoProcessComics.py / ComicRN.py's which will now send proper completion messeages to clients, FIX: (#752) refresh series will now test if a series is 'out of whack' with it's numerical issue count (ie. 5/4) or it has no issue data due to a bad refresh / api maxing out and will adjust it's processing to accomodate either, IMP: (#750) Added ComicVine API Checker which will check API counts at regular intervals to inform/warn users of usage, as well as adding a screen-time display of API hits / mins used at the bottom of every page (refreshing/reloading pages will update counts), FIX: (#747)EOL normalization (dos2unix) on search.py - removed classes & exceptions as not being used, IMP: (#747) Skip processing issues with an invalid store date & issue date (thnx rupaschomaker), FIX: Removed strings when searching/logging torrents as was causing ascii errors especially with KAT, IMP: Added [META-TAGGING] to logging for meta-tagging module, IMP: Added ability in GUI to select CR or Cbl tags (or both) when writing metadata to cbz files, IMP: Improved support/usage with ComicTagger v1.1.15 which allows for personal CV API Key usage - if supplied to Mylar, will use when tagging with ComicTagger, IMP: Added Manual Search option to allow for individual searches of issues without changing initial status.
2014-06-18 19:58:19 +00:00
if refreshit is None :
IMP: 32P support added (identical to CBT, no backlog searching but full RSS url is required for usage), IMP: Threaded RSS Check (will only run once concurrently), IMP: Added option to enable/disable Snatched/Failed to show on Wanted tab, FIX: Removed UID from dognzb config, IMP: Removed apikey from being stored in db for dognzb, IMP: Will only store ID/HASH for torrents, instead of entire link - will recreate dynamically as required, IMP: Switched to requests for torrent retrieval, IMP: Removed getdefaultlocal requirements on startup (would fail startup on some OSX systems), IMP: Will now display covers that are in 00.png format when viewing issue details, IMP: Fixed incorrect logic for dupecheck status checks, FIX: Removed some unneeded print statements
2015-04-15 04:10:52 +00:00
comiclist = myDB . select ( ' SELECT * from comics order by ComicSortName COLLATE NOCASE ' )
FIX: (#746) updated autoProcessComics.py / ComicRN.py's which will now send proper completion messeages to clients, FIX: (#752) refresh series will now test if a series is 'out of whack' with it's numerical issue count (ie. 5/4) or it has no issue data due to a bad refresh / api maxing out and will adjust it's processing to accomodate either, IMP: (#750) Added ComicVine API Checker which will check API counts at regular intervals to inform/warn users of usage, as well as adding a screen-time display of API hits / mins used at the bottom of every page (refreshing/reloading pages will update counts), FIX: (#747)EOL normalization (dos2unix) on search.py - removed classes & exceptions as not being used, IMP: (#747) Skip processing issues with an invalid store date & issue date (thnx rupaschomaker), FIX: Removed strings when searching/logging torrents as was causing ascii errors especially with KAT, IMP: Added [META-TAGGING] to logging for meta-tagging module, IMP: Added ability in GUI to select CR or Cbl tags (or both) when writing metadata to cbz files, IMP: Improved support/usage with ComicTagger v1.1.15 which allows for personal CV API Key usage - if supplied to Mylar, will use when tagging with ComicTagger, IMP: Added Manual Search option to allow for individual searches of issues without changing initial status.
2014-06-18 19:58:19 +00:00
else :
comiclist = [ ]
comicref = myDB . selectone ( " SELECT * from comics WHERE ComicID=? " , [ refreshit ] ) . fetchone ( )
#refreshit is the ComicID passed from the Refresh Series to force/check numerical have totals
comiclist . append ( { " ComicID " : comicref [ 0 ] ,
" Have " : comicref [ 7 ] ,
" Total " : comicref [ 8 ] } )
2014-06-02 19:02:28 +00:00
for comic in comiclist :
FIX: (#746) updated autoProcessComics.py / ComicRN.py's which will now send proper completion messeages to clients, FIX: (#752) refresh series will now test if a series is 'out of whack' with it's numerical issue count (ie. 5/4) or it has no issue data due to a bad refresh / api maxing out and will adjust it's processing to accomodate either, IMP: (#750) Added ComicVine API Checker which will check API counts at regular intervals to inform/warn users of usage, as well as adding a screen-time display of API hits / mins used at the bottom of every page (refreshing/reloading pages will update counts), FIX: (#747)EOL normalization (dos2unix) on search.py - removed classes & exceptions as not being used, IMP: (#747) Skip processing issues with an invalid store date & issue date (thnx rupaschomaker), FIX: Removed strings when searching/logging torrents as was causing ascii errors especially with KAT, IMP: Added [META-TAGGING] to logging for meta-tagging module, IMP: Added ability in GUI to select CR or Cbl tags (or both) when writing metadata to cbz files, IMP: Improved support/usage with ComicTagger v1.1.15 which allows for personal CV API Key usage - if supplied to Mylar, will use when tagging with ComicTagger, IMP: Added Manual Search option to allow for individual searches of issues without changing initial status.
2014-06-18 19:58:19 +00:00
issue = myDB . selectone ( " SELECT COUNT(*) as count FROM issues WHERE ComicID=? " , [ comic [ ' ComicID ' ] ] ) . fetchone ( )
if issue is None :
if refreshit is not None :
logger . fdebug ( str ( comic [ ' ComicID ' ] ) + ' has no issuedata available. Forcing complete Refresh/Rescan ' )
2015-05-22 08:32:51 +00:00
return True
FIX: (#746) updated autoProcessComics.py / ComicRN.py's which will now send proper completion messeages to clients, FIX: (#752) refresh series will now test if a series is 'out of whack' with it's numerical issue count (ie. 5/4) or it has no issue data due to a bad refresh / api maxing out and will adjust it's processing to accomodate either, IMP: (#750) Added ComicVine API Checker which will check API counts at regular intervals to inform/warn users of usage, as well as adding a screen-time display of API hits / mins used at the bottom of every page (refreshing/reloading pages will update counts), FIX: (#747)EOL normalization (dos2unix) on search.py - removed classes & exceptions as not being used, IMP: (#747) Skip processing issues with an invalid store date & issue date (thnx rupaschomaker), FIX: Removed strings when searching/logging torrents as was causing ascii errors especially with KAT, IMP: Added [META-TAGGING] to logging for meta-tagging module, IMP: Added ability in GUI to select CR or Cbl tags (or both) when writing metadata to cbz files, IMP: Improved support/usage with ComicTagger v1.1.15 which allows for personal CV API Key usage - if supplied to Mylar, will use when tagging with ComicTagger, IMP: Added Manual Search option to allow for individual searches of issues without changing initial status.
2014-06-18 19:58:19 +00:00
else :
continue
2014-06-02 19:02:28 +00:00
if mylar . ANNUALS_ON :
annuals_on = True
annual = myDB . selectone ( " SELECT COUNT(*) as count FROM annuals WHERE ComicID=? " , [ comic [ ' ComicID ' ] ] ) . fetchone ( )
annualcount = annual [ 0 ]
if not annualcount :
annualcount = 0
else :
annuals_on = False
annual = None
annualcount = 0
try :
totalissues = comic [ ' Total ' ] + annualcount
haveissues = comic [ ' Have ' ]
except TypeError :
logger . warning ( ' [Warning] ComicID: ' + str ( comic [ ' ComicID ' ] ) + ' is incomplete - Removing from DB. You should try to re-add the series. ' )
myDB . action ( " DELETE from COMICS WHERE ComicID=? AND ComicName LIKE ' Comic ID % ' " , [ comic [ ' ComicID ' ] ] )
myDB . action ( " DELETE from ISSUES WHERE ComicID=? AND ComicName LIKE ' Comic ID % ' " , [ comic [ ' ComicID ' ] ] )
continue
if not haveissues :
FIX: (#746) updated autoProcessComics.py / ComicRN.py's which will now send proper completion messeages to clients, FIX: (#752) refresh series will now test if a series is 'out of whack' with it's numerical issue count (ie. 5/4) or it has no issue data due to a bad refresh / api maxing out and will adjust it's processing to accomodate either, IMP: (#750) Added ComicVine API Checker which will check API counts at regular intervals to inform/warn users of usage, as well as adding a screen-time display of API hits / mins used at the bottom of every page (refreshing/reloading pages will update counts), FIX: (#747)EOL normalization (dos2unix) on search.py - removed classes & exceptions as not being used, IMP: (#747) Skip processing issues with an invalid store date & issue date (thnx rupaschomaker), FIX: Removed strings when searching/logging torrents as was causing ascii errors especially with KAT, IMP: Added [META-TAGGING] to logging for meta-tagging module, IMP: Added ability in GUI to select CR or Cbl tags (or both) when writing metadata to cbz files, IMP: Improved support/usage with ComicTagger v1.1.15 which allows for personal CV API Key usage - if supplied to Mylar, will use when tagging with ComicTagger, IMP: Added Manual Search option to allow for individual searches of issues without changing initial status.
2014-06-18 19:58:19 +00:00
havetracks = 0
if refreshit is not None :
if haveissues > totalissues :
return True # if it's 5/4, send back to updater and don't restore previous status'
else :
return False # if it's 5/5 or 4/5, send back to updater and restore previous status'
2014-06-02 19:02:28 +00:00
try :
2015-05-22 08:32:51 +00:00
percent = ( haveissues * 100.0 ) / totalissues
2014-06-02 19:02:28 +00:00
if percent > 100 :
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
percent = 101
2014-06-02 19:02:28 +00:00
except ( ZeroDivisionError , TypeError ) :
percent = 0
totalissuess = ' ? '
2015-01-16 19:40:08 +00:00
if comic [ ' LatestDate ' ] is None :
logger . warn ( comic [ ' ComicName ' ] + ' has not finished loading. Nulling some values so things display properly until they can populate. ' )
recentstatus = ' Loading '
elif comic [ ' ComicPublished ' ] is None or comic [ ' ComicPublished ' ] == ' ' or comic [ ' LatestDate ' ] is None :
2014-06-02 19:02:28 +00:00
recentstatus = ' Unknown '
elif comic [ ' ForceContinuing ' ] == 1 :
recentstatus = ' Continuing '
2015-05-22 08:32:51 +00:00
elif ' present ' in comic [ ' ComicPublished ' ] . lower ( ) or ( today ( ) [ : 4 ] in comic [ ' LatestDate ' ] ) :
2014-06-02 19:02:28 +00:00
latestdate = comic [ ' LatestDate ' ]
2015-06-30 20:21:26 +00:00
#pull-list f'd up the date by putting '15' instead of '2015' causing 500 server errors
if ' - ' in latestdate [ : 3 ] :
st_date = latestdate . find ( ' - ' )
st_remainder = latestdate [ st_date + 1 : ]
st_year = latestdate [ : st_date ]
year = ' 20 ' + st_year
latestdate = str ( year ) + ' - ' + str ( st_remainder )
2015-08-14 01:32:00 +00:00
#logger.fdebug('year set to: ' + latestdate)
2015-05-22 08:32:51 +00:00
c_date = datetime . date ( int ( latestdate [ : 4 ] ) , int ( latestdate [ 5 : 7 ] ) , 1 )
2014-06-02 19:02:28 +00:00
n_date = datetime . date . today ( )
recentchk = ( n_date - c_date ) . days
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
if comic [ ' NewPublish ' ] :
2014-06-02 19:02:28 +00:00
recentstatus = ' Continuing '
else :
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
if recentchk < 55 :
recentstatus = ' Continuing '
else :
recentstatus = ' Ended '
2014-06-02 19:02:28 +00:00
else :
recentstatus = ' Ended '
comics . append ( { " ComicID " : comic [ ' ComicID ' ] ,
" ComicName " : comic [ ' ComicName ' ] ,
" ComicSortName " : comic [ ' ComicSortName ' ] ,
" ComicPublisher " : comic [ ' ComicPublisher ' ] ,
" ComicYear " : comic [ ' ComicYear ' ] ,
" ComicImage " : comic [ ' ComicImage ' ] ,
" LatestIssue " : comic [ ' LatestIssue ' ] ,
" LatestDate " : comic [ ' LatestDate ' ] ,
2015-05-22 08:32:51 +00:00
" ComicPublished " : re . sub ( ' (N) ' , ' ' , comic [ ' ComicPublished ' ] ) . strip ( ) ,
2014-06-02 19:02:28 +00:00
" Status " : comic [ ' Status ' ] ,
" recentstatus " : recentstatus ,
" percent " : percent ,
" totalissues " : totalissues ,
" haveissues " : haveissues ,
" DateAdded " : comic [ ' LastUpdated ' ] } )
return comics
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
def filesafe ( comic ) :
import unicodedata
u_comic = unicodedata . normalize ( ' NFKD ' , comic ) . encode ( ' ASCII ' , ' ignore ' ) . strip ( )
comicname_filesafe = re . sub ( ' [ \ : \' \ , \ ? \ ! \\ \ ] ' , ' ' , u_comic )
2015-05-22 08:32:51 +00:00
comicname_filesafe = re . sub ( ' [ \ /] ' , ' - ' , comicname_filesafe )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
return comicname_filesafe
def IssueDetails ( filelocation , IssueID = None ) :
import zipfile , logger , shutil
from xml . dom . minidom import parseString
dstlocation = os . path . join ( mylar . CACHE_DIR , ' temp.zip ' )
issuedetails = [ ]
if filelocation . endswith ( ' .cbz ' ) :
2014-08-18 19:54:34 +00:00
logger . fdebug ( ' CBZ file detected. Checking for .xml within file ' )
2015-05-22 08:32:51 +00:00
shutil . copy ( filelocation , dstlocation )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
else :
2014-08-18 19:54:34 +00:00
logger . fdebug ( ' filename is not a cbz : ' + filelocation )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
return
cover = " notfound "
issuetag = None
2015-06-22 03:38:10 +00:00
pic_extensions = ( ' .jpg ' , ' .png ' , ' .webp ' )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
modtime = os . path . getmtime ( dstlocation )
with zipfile . ZipFile ( dstlocation , ' r ' ) as inzipfile :
for infile in inzipfile . namelist ( ) :
if infile == ' ComicInfo.xml ' :
2014-08-18 19:54:34 +00:00
logger . fdebug ( ' Extracting ComicInfo.xml to display. ' )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
dst = os . path . join ( mylar . CACHE_DIR , ' ComicInfo.xml ' )
data = inzipfile . read ( infile )
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
#print str(data)
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
issuetag = ' xml '
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
#looks for the first page and assumes it's the cover. (Alternate covers handled later on)
2015-06-22 03:38:10 +00:00
elif any ( [ ' 000. ' in infile , ' 00. ' in infile ] ) and infile . endswith ( pic_extensions ) :
2014-08-18 19:54:34 +00:00
logger . fdebug ( ' Extracting primary image ' + infile + ' as coverfile for display. ' )
2015-05-22 08:32:51 +00:00
local_file = open ( os . path . join ( mylar . CACHE_DIR , ' temp.jpg ' ) , " wb " )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
local_file . write ( inzipfile . read ( infile ) )
local_file . close
cover = " found "
FIX: One-off Failed Download handling will now work, IMP: Some better error handling when detecting one-off's during post-processing, FIX:(#1143) When series contained a digit preceded by a dash, would incorrectly assume it as a negative issue number, FIX: Improved being able to detect corresponding annuals on CV when refreshing/importing a series when the annuals are new (ie. no data on CV), FIX: Alt_Pull method for weekly pull list retrieval working again, FIX: Fixed nzbid detection for experimental search, IMP: Mass Import button now available on Import Results screen (will attempt to import all series that are in a 'Not Imported' status), IMP: When searching for arc issues using the 'Search for Missing' option, the call is now threaded so it runs in the background, IMP: Changed IssueYear to IssueDate for Story Arc Issues on the arc details page, FIX:(#1156) Typo that caused error when attempting to view cbz comics in the series detail page, FIX:(#1145) Select All option via top checkbox (on series detail page), FIX: Auto-Want feature via weeklypull will better match to titles that contain 'the' and have hypens in differing character positions, FIX:(#1160) Would incorrectly take the length of a decimal placed issue when searching and never complete the issue number cylcing search, FIX:(#1161) When annuals not enabled, and series in watchlist and series annual in pullist, would error out trying to link series to pullist.
2015-11-18 06:32:40 +00:00
elif any ( [ ' 00a ' in infile , ' 00b ' in infile , ' 00c ' in infile , ' 00d ' in infile , ' 00e ' in infile ] ) and infile . endswith ( pic_extensions ) :
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
logger . fdebug ( ' Found Alternate cover - ' + infile + ' . Extracting. ' )
altlist = ( ' 00a ' , ' 00b ' , ' 00c ' , ' 00d ' , ' 00e ' )
for alt in altlist :
if alt in infile :
2015-05-22 08:32:51 +00:00
local_file = open ( os . path . join ( mylar . CACHE_DIR , ' temp.jpg ' ) , " wb " )
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
local_file . write ( inzipfile . read ( infile ) )
local_file . close
cover = " found "
break
FIX: included version of comictagger should now work with both Windows and *nix based OS' again, IMP: Global Copy/Move option available when performing post-processing, IMP: Added a verbose file-checking option (FOLDER_SCAN_LOG_VERBOSE) - when enabled will log as it currently does during manual post-processing/file-checking runs, when disabled it will not spam the log nearly as much resulting in more readable log files, IMP: Added Verbose debug logging both via startup option(-v), as well as toggle button in Log GUI (from headphones), as well as per-page loading of log file(s) in GUI, FIX: When doing manual post-processing on issues that were in story arcs, will now indicate X story-arc issues were post-processed for better visibility, FIX: Fixed an issue with deleting from the nzblog table when story arc issues were post-processed, IMP: Added WEEKFOLDER_LOC to the config.ini to allow for specification of where the weekly download directories will default to (as opposed to off of ComicLocation root), IMP: Better handling of some special character references in series titles when looking for series on the auto-wanted list, IMP: 32P will now auto-disable provider if logon returns invalid credentials, FIX: When using alt_pull on weekly pull list, xA0 unicode character caused error, FIX: If title had invalid character in filename that was replaced with a character that already existed in the title, would not scan in during file-checking, FIX: When searching for a series (weeklypull-list/add a series), if the title contained 'and' or '&' would return really mixed up results, FIX: When Post-Processing, if filename being processed had special characters (ie. comma) and was different than nzbname, in some cases would fail to find/move issues, IMP: Utilize internal comictagger to convert from cbr/cbz, IMP: Added more checks when post-processing to ensure files are handled correctly, IMP: Added meta-tag reading when importing series/issues - if previously tagged with CT, will reverse look-up the provided IssueID to reference the correct ComicID, IMP: If scanned directory during import contins cvinfo file, use that and force the ComicID to entire directory when importing a series, IMP: Manual meta-tagging issues will no longer create temporary directories and/or create files in the Comic Location root causing problems for some users, FIX: Annuals weren't properly sorted upon loading of comic details page for some series, IMP: Added some extra checks when validating/creating directories, FIX: Fixed a problem when displaying some covers of .cbz files on the comic details page
2016-01-26 07:49:56 +00:00
elif any ( [ ' 001.jpg ' in infile , ' 001.png ' in infile , ' 001.webp ' in infile , ' 01.jpg ' in infile , ' 01.png ' in infile , ' 01.webp ' in infile ] ) and cover == " notfound " :
2014-08-18 19:54:34 +00:00
logger . fdebug ( ' Extracting primary image ' + infile + ' as coverfile for display. ' )
2015-05-22 08:32:51 +00:00
local_file = open ( os . path . join ( mylar . CACHE_DIR , ' temp.jpg ' ) , " wb " )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
local_file . write ( inzipfile . read ( infile ) )
local_file . close
cover = " found "
2015-05-22 08:32:51 +00:00
ComicImage = os . path . join ( ' cache ' , ' temp.jpg? ' + str ( modtime ) )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
IssueImage = replacetheslash ( ComicImage )
2014-08-18 19:54:34 +00:00
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
if issuetag is None :
import subprocess
from subprocess import CalledProcessError , check_output
unzip_cmd = " /usr/bin/unzip "
try :
#unzip -z will extract the zip comment field.
2015-05-22 08:32:51 +00:00
data = subprocess . check_output ( [ unzip_cmd , ' -z ' , dstlocation ] )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
# return data is encoded in bytes, not unicode. Need to figure out how to run check_output returning utf-8
issuetag = ' comment '
except CalledProcessError as e :
logger . warn ( ' Unable to extract comment field from zipfile. ' )
2015-05-22 08:32:51 +00:00
2014-08-18 19:54:34 +00:00
#logger.info('data:' + str(data))
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
if issuetag == ' xml ' :
#import easy to use xml parser called minidom:
dom = parseString ( data )
results = dom . getElementsByTagName ( ' ComicInfo ' )
for result in results :
try :
issue_title = result . getElementsByTagName ( ' Title ' ) [ 0 ] . firstChild . wholeText
except :
issue_title = " None "
try :
series_title = result . getElementsByTagName ( ' Series ' ) [ 0 ] . firstChild . wholeText
except :
series_title = " None "
FIX: included version of comictagger should now work with both Windows and *nix based OS' again, IMP: Global Copy/Move option available when performing post-processing, IMP: Added a verbose file-checking option (FOLDER_SCAN_LOG_VERBOSE) - when enabled will log as it currently does during manual post-processing/file-checking runs, when disabled it will not spam the log nearly as much resulting in more readable log files, IMP: Added Verbose debug logging both via startup option(-v), as well as toggle button in Log GUI (from headphones), as well as per-page loading of log file(s) in GUI, FIX: When doing manual post-processing on issues that were in story arcs, will now indicate X story-arc issues were post-processed for better visibility, FIX: Fixed an issue with deleting from the nzblog table when story arc issues were post-processed, IMP: Added WEEKFOLDER_LOC to the config.ini to allow for specification of where the weekly download directories will default to (as opposed to off of ComicLocation root), IMP: Better handling of some special character references in series titles when looking for series on the auto-wanted list, IMP: 32P will now auto-disable provider if logon returns invalid credentials, FIX: When using alt_pull on weekly pull list, xA0 unicode character caused error, FIX: If title had invalid character in filename that was replaced with a character that already existed in the title, would not scan in during file-checking, FIX: When searching for a series (weeklypull-list/add a series), if the title contained 'and' or '&' would return really mixed up results, FIX: When Post-Processing, if filename being processed had special characters (ie. comma) and was different than nzbname, in some cases would fail to find/move issues, IMP: Utilize internal comictagger to convert from cbr/cbz, IMP: Added more checks when post-processing to ensure files are handled correctly, IMP: Added meta-tag reading when importing series/issues - if previously tagged with CT, will reverse look-up the provided IssueID to reference the correct ComicID, IMP: If scanned directory during import contins cvinfo file, use that and force the ComicID to entire directory when importing a series, IMP: Manual meta-tagging issues will no longer create temporary directories and/or create files in the Comic Location root causing problems for some users, FIX: Annuals weren't properly sorted upon loading of comic details page for some series, IMP: Added some extra checks when validating/creating directories, FIX: Fixed a problem when displaying some covers of .cbz files on the comic details page
2016-01-26 07:49:56 +00:00
try :
series_volume = result . getElementsByTagName ( ' Volume ' ) [ 0 ] . firstChild . wholeText
except :
series_volume = " None "
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
try :
issue_number = result . getElementsByTagName ( ' Number ' ) [ 0 ] . firstChild . wholeText
except :
issue_number = " None "
try :
summary = result . getElementsByTagName ( ' Summary ' ) [ 0 ] . firstChild . wholeText
except :
summary = " None "
2015-05-22 08:32:51 +00:00
if ' *List ' in summary :
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
summary_cut = summary . find ( ' *List ' )
summary = summary [ : summary_cut ]
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
#check here to see if Covers exist as they will probably be misnamed when trying to determine the actual cover
# (ie. 00a.jpg / 00d.jpg - when there's a Cover A or a Cover D listed)
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
try :
notes = result . getElementsByTagName ( ' Notes ' ) [ 0 ] . firstChild . wholeText #IssueID is in here
except :
notes = " None "
try :
year = result . getElementsByTagName ( ' Year ' ) [ 0 ] . firstChild . wholeText
except :
year = " None "
try :
month = result . getElementsByTagName ( ' Month ' ) [ 0 ] . firstChild . wholeText
except :
month = " None "
try :
day = result . getElementsByTagName ( ' Day ' ) [ 0 ] . firstChild . wholeText
except :
day = " None "
try :
writer = result . getElementsByTagName ( ' Writer ' ) [ 0 ] . firstChild . wholeText
except :
writer = " None "
try :
penciller = result . getElementsByTagName ( ' Penciller ' ) [ 0 ] . firstChild . wholeText
except :
penciller = " None "
try :
inker = result . getElementsByTagName ( ' Inker ' ) [ 0 ] . firstChild . wholeText
except :
inker = " None "
try :
colorist = result . getElementsByTagName ( ' Colorist ' ) [ 0 ] . firstChild . wholeText
except :
colorist = " None "
try :
letterer = result . getElementsByTagName ( ' Letterer ' ) [ 0 ] . firstChild . wholeText
except :
letterer = " None "
try :
cover_artist = result . getElementsByTagName ( ' CoverArtist ' ) [ 0 ] . firstChild . wholeText
except :
cover_artist = " None "
try :
editor = result . getElementsByTagName ( ' Editor ' ) [ 0 ] . firstChild . wholeText
except :
editor = " None "
try :
publisher = result . getElementsByTagName ( ' Publisher ' ) [ 0 ] . firstChild . wholeText
except :
publisher = " None "
try :
webpage = result . getElementsByTagName ( ' Web ' ) [ 0 ] . firstChild . wholeText
except :
webpage = " None "
try :
pagecount = result . getElementsByTagName ( ' PageCount ' ) [ 0 ] . firstChild . wholeText
except :
2015-05-22 08:32:51 +00:00
pagecount = 0
2014-08-18 19:54:34 +00:00
logger . fdebug ( " number of pages I counted: " + str ( pagecount ) )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
i = 0
while ( i < int ( pagecount ) ) :
pageinfo = result . getElementsByTagName ( ' Page ' ) [ i ] . attributes
attrib = pageinfo . getNamedItem ( ' Image ' )
2014-08-18 19:54:34 +00:00
logger . fdebug ( ' Frontcover validated as being image #: ' + str ( attrib . value ) )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
att = pageinfo . getNamedItem ( ' Type ' )
2014-08-18 19:54:34 +00:00
logger . fdebug ( ' pageinfo: ' + str ( pageinfo ) )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
if att . value == ' FrontCover ' :
2014-08-18 19:54:34 +00:00
logger . fdebug ( ' FrontCover detected. Extracting. ' )
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
break
i + = 1
else :
stripline = ' Archive: ' + dstlocation
2014-08-18 19:54:34 +00:00
data = re . sub ( stripline , ' ' , data . encode ( " utf-8 " ) ) . strip ( )
if data is None or data == ' ' :
return
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
import ast
ast_data = ast . literal_eval ( str ( data ) )
lastmodified = ast_data [ ' lastModified ' ]
2014-08-18 19:54:34 +00:00
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
dt = ast_data [ ' ComicBookInfo/1.0 ' ]
publisher = dt [ ' publisher ' ]
year = dt [ ' publicationYear ' ]
month = dt [ ' publicationMonth ' ]
try :
day = dt [ ' publicationDay ' ]
except :
day = None
issue_title = dt [ ' title ' ]
series_title = dt [ ' series ' ]
issue_number = dt [ ' issue ' ]
summary = dt [ ' comments ' ]
editor = " None "
colorist = " None "
artist = " None "
writer = " None "
letterer = " None "
cover_artist = " None "
penciller = " None "
inker = " None "
FIX: included version of comictagger should now work with both Windows and *nix based OS' again, IMP: Global Copy/Move option available when performing post-processing, IMP: Added a verbose file-checking option (FOLDER_SCAN_LOG_VERBOSE) - when enabled will log as it currently does during manual post-processing/file-checking runs, when disabled it will not spam the log nearly as much resulting in more readable log files, IMP: Added Verbose debug logging both via startup option(-v), as well as toggle button in Log GUI (from headphones), as well as per-page loading of log file(s) in GUI, FIX: When doing manual post-processing on issues that were in story arcs, will now indicate X story-arc issues were post-processed for better visibility, FIX: Fixed an issue with deleting from the nzblog table when story arc issues were post-processed, IMP: Added WEEKFOLDER_LOC to the config.ini to allow for specification of where the weekly download directories will default to (as opposed to off of ComicLocation root), IMP: Better handling of some special character references in series titles when looking for series on the auto-wanted list, IMP: 32P will now auto-disable provider if logon returns invalid credentials, FIX: When using alt_pull on weekly pull list, xA0 unicode character caused error, FIX: If title had invalid character in filename that was replaced with a character that already existed in the title, would not scan in during file-checking, FIX: When searching for a series (weeklypull-list/add a series), if the title contained 'and' or '&' would return really mixed up results, FIX: When Post-Processing, if filename being processed had special characters (ie. comma) and was different than nzbname, in some cases would fail to find/move issues, IMP: Utilize internal comictagger to convert from cbr/cbz, IMP: Added more checks when post-processing to ensure files are handled correctly, IMP: Added meta-tag reading when importing series/issues - if previously tagged with CT, will reverse look-up the provided IssueID to reference the correct ComicID, IMP: If scanned directory during import contins cvinfo file, use that and force the ComicID to entire directory when importing a series, IMP: Manual meta-tagging issues will no longer create temporary directories and/or create files in the Comic Location root causing problems for some users, FIX: Annuals weren't properly sorted upon loading of comic details page for some series, IMP: Added some extra checks when validating/creating directories, FIX: Fixed a problem when displaying some covers of .cbz files on the comic details page
2016-01-26 07:49:56 +00:00
try :
series_volume = dt [ ' volume ' ]
except :
series_volume = None
2015-05-22 08:32:51 +00:00
for cl in dt [ ' credits ' ] :
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
if cl [ ' role ' ] == ' Editor ' :
if editor == " None " : editor = cl [ ' person ' ]
else : editor + = ' , ' + cl [ ' person ' ]
elif cl [ ' role ' ] == ' Colorist ' :
if colorist == " None " : colorist = cl [ ' person ' ]
else : colorist + = ' , ' + cl [ ' person ' ]
elif cl [ ' role ' ] == ' Artist ' :
if artist == " None " : artist = cl [ ' person ' ]
else : artist + = ' , ' + cl [ ' person ' ]
elif cl [ ' role ' ] == ' Writer ' :
if writer == " None " : writer = cl [ ' person ' ]
else : writer + = ' , ' + cl [ ' person ' ]
elif cl [ ' role ' ] == ' Letterer ' :
if letterer == " None " : letterer = cl [ ' person ' ]
else : letterer + = ' , ' + cl [ ' person ' ]
elif cl [ ' role ' ] == ' Cover ' :
if cover_artist == " None " : cover_artist = cl [ ' person ' ]
else : cover_artist + = ' , ' + cl [ ' person ' ]
elif cl [ ' role ' ] == ' Penciller ' :
if penciller == " None " : penciller = cl [ ' person ' ]
else : penciller + = ' , ' + cl [ ' person ' ]
elif cl [ ' role ' ] == ' Inker ' :
if inker == " None " : inker = cl [ ' person ' ]
else : inker + = ' , ' + cl [ ' person ' ]
try :
notes = dt [ ' notes ' ]
except :
notes = " None "
try :
webpage = dt [ ' web ' ]
except :
webpage = " None "
try :
pagecount = dt [ ' pagecount ' ]
except :
pagecount = " None "
issuedetails . append ( { " title " : issue_title ,
" series " : series_title ,
FIX: included version of comictagger should now work with both Windows and *nix based OS' again, IMP: Global Copy/Move option available when performing post-processing, IMP: Added a verbose file-checking option (FOLDER_SCAN_LOG_VERBOSE) - when enabled will log as it currently does during manual post-processing/file-checking runs, when disabled it will not spam the log nearly as much resulting in more readable log files, IMP: Added Verbose debug logging both via startup option(-v), as well as toggle button in Log GUI (from headphones), as well as per-page loading of log file(s) in GUI, FIX: When doing manual post-processing on issues that were in story arcs, will now indicate X story-arc issues were post-processed for better visibility, FIX: Fixed an issue with deleting from the nzblog table when story arc issues were post-processed, IMP: Added WEEKFOLDER_LOC to the config.ini to allow for specification of where the weekly download directories will default to (as opposed to off of ComicLocation root), IMP: Better handling of some special character references in series titles when looking for series on the auto-wanted list, IMP: 32P will now auto-disable provider if logon returns invalid credentials, FIX: When using alt_pull on weekly pull list, xA0 unicode character caused error, FIX: If title had invalid character in filename that was replaced with a character that already existed in the title, would not scan in during file-checking, FIX: When searching for a series (weeklypull-list/add a series), if the title contained 'and' or '&' would return really mixed up results, FIX: When Post-Processing, if filename being processed had special characters (ie. comma) and was different than nzbname, in some cases would fail to find/move issues, IMP: Utilize internal comictagger to convert from cbr/cbz, IMP: Added more checks when post-processing to ensure files are handled correctly, IMP: Added meta-tag reading when importing series/issues - if previously tagged with CT, will reverse look-up the provided IssueID to reference the correct ComicID, IMP: If scanned directory during import contins cvinfo file, use that and force the ComicID to entire directory when importing a series, IMP: Manual meta-tagging issues will no longer create temporary directories and/or create files in the Comic Location root causing problems for some users, FIX: Annuals weren't properly sorted upon loading of comic details page for some series, IMP: Added some extra checks when validating/creating directories, FIX: Fixed a problem when displaying some covers of .cbz files on the comic details page
2016-01-26 07:49:56 +00:00
" volume " : series_volume ,
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
" issue_number " : issue_number ,
" summary " : summary ,
" notes " : notes ,
" year " : year ,
" month " : month ,
" day " : day ,
" writer " : writer ,
" penciller " : penciller ,
" inker " : inker ,
" colorist " : colorist ,
" letterer " : letterer ,
" cover_artist " : cover_artist ,
" editor " : editor ,
" publisher " : publisher ,
" webpage " : webpage ,
" pagecount " : pagecount ,
" IssueImage " : IssueImage } )
return issuedetails
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
def get_issue_title ( IssueID = None , ComicID = None , IssueNumber = None ) :
2014-09-10 19:19:16 +00:00
import db , logger
2014-09-08 08:35:15 +00:00
myDB = db . DBConnection ( )
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
if IssueID :
issue = myDB . selectone ( ' SELECT * FROM issues WHERE IssueID=? ' , [ IssueID ] ) . fetchone ( )
if issue is None :
2015-01-16 19:40:08 +00:00
issue = myDB . selectone ( ' SELECT * FROM annuals WHERE IssueID=? ' , [ IssueID ] ) . fetchone ( )
if issue is None :
logger . fdebug ( ' Unable to locate given IssueID within the db. Assuming Issue Title is None. ' )
return None
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
else :
issue = myDB . selectone ( ' SELECT * FROM issues WHERE ComicID=? AND Int_IssueNumber=? ' , [ ComicID , issuedigits ( IssueNumber ) ] ) . fetchone ( )
if issue is None :
2015-01-16 19:40:08 +00:00
issue = myDB . selectone ( ' SELECT * FROM annuals WHERE IssueID=? ' , [ IssueID ] ) . fetchone ( )
if issue is None :
logger . fdebug ( ' Unable to locate given IssueID within the db. Assuming Issue Title is None. ' )
return None
2015-05-22 08:32:51 +00:00
2014-09-08 08:35:15 +00:00
return issue [ ' IssueName ' ]
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
def int_num ( s ) :
try :
return int ( s )
except ValueError :
return float ( s )
2015-05-22 08:32:51 +00:00
2014-10-08 06:45:51 +00:00
def listLibrary ( ) :
import db
2014-10-08 18:17:44 +00:00
library = { }
2014-10-08 06:45:51 +00:00
myDB = db . DBConnection ( )
2014-10-09 05:37:25 +00:00
# Get individual comics
2014-10-08 06:45:51 +00:00
list = myDB . select ( " SELECT ComicId FROM Comics " )
for row in list :
2014-10-08 18:17:44 +00:00
library [ row [ ' ComicID ' ] ] = row [ ' ComicID ' ]
2014-10-08 06:45:51 +00:00
# Add the annuals
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
if mylar . ANNUALS_ON :
list = myDB . select ( " SELECT ReleaseComicId,ComicID FROM Annuals " )
for row in list :
library [ row [ ' ReleaseComicId ' ] ] = row [ ' ComicID ' ]
2014-10-08 06:45:51 +00:00
return library
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
def incr_snatched ( ComicID ) :
import db , logger
myDB = db . DBConnection ( )
incr_count = myDB . selectone ( " SELECT Have FROM Comics WHERE ComicID=? " , [ ComicID ] ) . fetchone ( )
2015-05-22 08:32:51 +00:00
logger . fdebug ( ' Incrementing HAVE count total to : ' + str ( incr_count [ ' Have ' ] + 1 ) )
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
newCtrl = { " ComicID " : ComicID }
newVal = { " Have " : incr_count [ ' Have ' ] + 1 }
myDB . upsert ( " comics " , newVal , newCtrl )
2015-05-22 08:32:51 +00:00
return
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
def duplicate_filecheck ( filename , ComicID = None , IssueID = None , StoryArcID = None ) :
#filename = the filename in question that's being checked against
#comicid = the comicid of the series that's being checked for duplication
#issueid = the issueid of the issue that's being checked for duplication
#storyarcid = the storyarcid of the issue that's being checked for duplication.
#
import db , logger
myDB = db . DBConnection ( )
2015-01-16 19:40:08 +00:00
logger . info ( ' [DUPECHECK] Duplicate check for ' + filename )
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
filesz = os . path . getsize ( filename )
if IssueID :
dupchk = myDB . selectone ( " SELECT * FROM issues WHERE IssueID=? " , [ IssueID ] ) . fetchone ( )
if dupchk is None :
dupchk = myDB . selectone ( " SELECT * FROM annuals WHERE IssueID=? " , [ IssueID ] ) . fetchone ( )
if dupchk is None :
2015-01-16 19:40:08 +00:00
logger . info ( ' [DUPECHECK] Unable to find corresponding Issue within the DB. Do you still have the series on your watchlist? ' )
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
return
2015-10-06 17:16:27 +00:00
#if it's a retry and the file was already snatched, the status is Snatched and won't hit the dupecheck.
2015-11-23 08:25:59 +00:00
#rtnval will be one of 3:
#'write' - write new file
#'dupe_file' - do not write new file as existing file is better quality
#'dupe_src' - write new file, as existing file is a lesser quality (dupe)
IMP: 32P support added (identical to CBT, no backlog searching but full RSS url is required for usage), IMP: Threaded RSS Check (will only run once concurrently), IMP: Added option to enable/disable Snatched/Failed to show on Wanted tab, FIX: Removed UID from dognzb config, IMP: Removed apikey from being stored in db for dognzb, IMP: Will only store ID/HASH for torrents, instead of entire link - will recreate dynamically as required, IMP: Switched to requests for torrent retrieval, IMP: Removed getdefaultlocal requirements on startup (would fail startup on some OSX systems), IMP: Will now display covers that are in 00.png format when viewing issue details, IMP: Fixed incorrect logic for dupecheck status checks, FIX: Removed some unneeded print statements
2015-04-15 04:10:52 +00:00
if dupchk [ ' Status ' ] == ' Downloaded ' or dupchk [ ' Status ' ] == ' Archived ' :
2015-10-06 17:16:27 +00:00
try :
dupsize = dupchk [ ' ComicSize ' ]
except :
logger . info ( ' [DUPECHECK] Duplication detection returned no hits as this is a new Snatch. This is not a duplicate. ' )
rtnval = " write "
2015-01-16 19:40:08 +00:00
logger . info ( ' [DUPECHECK] Existing Status already set to ' + dupchk [ ' Status ' ] )
cid = [ ]
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
if dupsize is None :
2015-01-16 19:40:08 +00:00
logger . info ( ' [DUPECHECK] Existing filesize is 0 bytes as I cannot locate the orginal entry - it is probably archived. ' )
logger . fdebug ( ' [DUPECHECK] Checking series for unrefreshed series syndrome (USS). ' )
havechk = myDB . selectone ( ' SELECT * FROM comics WHERE ComicID=? ' , [ ComicID ] ) . fetchone ( )
if havechk :
2015-02-02 20:29:21 +00:00
if havechk [ ' Have ' ] > havechk [ ' Total ' ] :
2015-01-16 19:40:08 +00:00
logger . info ( ' [DUPECHECK] Series has invalid issue totals [ ' + str ( havechk [ ' Have ' ] ) + ' / ' + str ( havechk [ ' Total ' ] ) + ' ] Attempting to Refresh & continue post-processing this issue. ' )
cid . append ( ComicID )
logger . fdebug ( ' [DUPECHECK] ComicID: ' + str ( ComicID ) )
2015-05-22 08:32:51 +00:00
mylar . updater . dbUpdate ( ComicIDList = cid , calledfrom = ' dupechk ' )
2015-01-16 19:40:08 +00:00
return duplicate_filecheck ( filename , ComicID , IssueID , StoryArcID )
else :
2015-11-23 08:25:59 +00:00
#not sure if this one is correct - should never actually get to this point.
rtnval = " dupe_file "
2015-01-16 19:40:08 +00:00
else :
2015-11-23 08:25:59 +00:00
rtnval = " dupe_file "
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
else :
2015-01-16 19:40:08 +00:00
logger . info ( ' [DUPECHECK] Existing file : ' + dupchk [ ' Location ' ] + ' has a filesize of : ' + str ( dupsize ) + ' bytes. ' )
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
#keywords to force keep / delete
#this will be eventually user-controlled via the GUI once the options are enabled.
2015-01-16 19:40:08 +00:00
if int ( dupsize ) == 0 :
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
logger . info ( ' [DUPECHECK] Existing filesize is 0 as I cannot locate the original entry. ' )
if dupchk [ ' Status ' ] == ' Archived ' :
logger . info ( ' [DUPECHECK] Assuming issue is Archived. ' )
2015-11-23 08:25:59 +00:00
rtnval = " dupe_file "
return rtnval
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
else :
logger . info ( ' [DUPECHECK] Assuming 0-byte file - this one is gonna get hammered. ' )
logger . fdebug ( ' [DUPECHECK] Based on duplication preferences I will retain based on : ' + mylar . DUPECONSTRAINT )
if ' cbr ' in mylar . DUPECONSTRAINT or ' cbz ' in mylar . DUPECONSTRAINT :
if ' cbr ' in mylar . DUPECONSTRAINT :
#this has to be configured in config - either retain cbr or cbz.
if dupchk [ ' Location ' ] . endswith ( ' .cbz ' ) :
#keep dupechk['Location']
logger . info ( ' [DUPECHECK-CBR PRIORITY] [# ' + dupchk [ ' Issue_Number ' ] + ' ] Retaining currently scanned in file : ' + dupchk [ ' Location ' ] )
2015-11-23 08:25:59 +00:00
rtnval = " dupe_file "
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
else :
#keep filename
logger . info ( ' [DUPECHECK-CBR PRIORITY] [# ' + dupchk [ ' Issue_Number ' ] + ' ] Retaining newly scanned in file : ' + filename )
2015-11-23 08:25:59 +00:00
rtnval = " dupe_src "
2015-01-16 19:40:08 +00:00
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
elif ' cbz ' in mylar . DUPECONSTRAINT :
if dupchk [ ' Location ' ] . endswith ( ' .cbr ' ) :
#keep dupchk['Location']
logger . info ( ' [DUPECHECK-CBZ PRIORITY] [# ' + dupchk [ ' Issue_Number ' ] + ' ] Retaining currently scanned in filename : ' + dupchk [ ' Location ' ] )
2015-11-23 08:25:59 +00:00
rtnval = " dupe_file "
2015-01-16 19:40:08 +00:00
else :
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
#keep filename
logger . info ( ' [DUPECHECK-CBZ PRIORITY] [# ' + dupchk [ ' Issue_Number ' ] + ' ] Retaining newly scanned in filename : ' + filename )
2015-11-23 08:25:59 +00:00
rtnval = " dupe_src "
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
if mylar . DUPECONSTRAINT == ' filesize ' :
if filesz < = int ( dupsize ) and int ( dupsize ) != 0 :
logger . info ( ' [DUPECHECK-FILESIZE PRIORITY] [# ' + dupchk [ ' Issue_Number ' ] + ' ] Retaining currently scanned in filename : ' + dupchk [ ' Location ' ] )
2015-11-23 08:25:59 +00:00
rtnval = " dupe_file "
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
else :
logger . info ( ' [DUPECHECK-FILESIZE PRIORITY] [# ' + dupchk [ ' Issue_Number ' ] + ' ] Retaining newly scanned in filename : ' + filename )
2015-11-23 08:25:59 +00:00
rtnval = " dupe_src "
IMP: Cleaned up interface for StoryArcs / Story Arc Details, IMP: Cleaned up interface for Reading list Management, IMP: Added better reading list management - new status (added, downloaded, read), IMP: Added sync option for use with another device for reading list transfer (ie. tablet) Android only, IMP: Autopopulate new weekly pull releases to reading list, IMP: 'Watch' option in weekly pull list now fully functional. Will watch CV for series' that do not have any series data yet as they are new starting series. Will auto-add once available, IMP: Auto-watch check is run after every refresh/recreate of the weeklypull list, IMP: Improved the Add a Series option where it will now look for issues that are 'new' or 'wanted' during add sequence, IMP: Main page interface now has coloured have/total bars to denote series completion, IMP: New scheduler / threading locks in place in an attempt to avoid database locks, FIX: Removed some erroneous locking that was going on when importing a directory was being run, IMP: Stat counter now present when post-processing multiple issues in sequence, FIX: for issue number error when post-processing and issue number was a non-alphanumeric, FIX: for metatagging: when original file was .cbz, would try to convert and fail, FIX: for issues that were negative and were preceeded by a # in the filename (filechecker), FIX: for publisher having non-alphanumeric character in name when attempting to determine publisher, FIX: if annuals enabled, would incorrectly show as being 'already in library' when viewing search results if results constained annuals, FIX:(#944) for incorrect nzbname being used when post-processing was being performed from an nzb client (experimental mainly), IMP: Turned off logging for ComicVine API counter, FIX: Added retry attempts when connecting to ComicVine in order to avoid errors when adding a series, IMP:(#963) Added ability to add snatched to filter when viewing Wanted issues on Wanted tab, FIX: When importing and then selecting a series to import via the select screen, will now flip back to the importresults and add the selected series in the background, IMP:(#952) Main page is now sorted in ascending order by Continuing/Ended status (and subbed by whether is Active/Paused).Custom sorting is still available, FIX: Dupecheck will now automatically assume existing 0-byte files are to be overwritten when performing post-processing, FIX: If publication date for series contained a '?' (usually with brand new series) will force to 'Present' to allow for pull-list comparisons to take place, FIX: Mylar will now disallow search results which have 'covers only' or 'variant' in the filename, IMP: Better nzbname generation/retrieval (will check inside nzb for possible names) to be used when post-processing, IMP: DB Update will now perform update to all active comics in descending order by Latest Date (instead of random order), FIX: Enforce the 5hr limit rule when running DB update (will only update series that haven't been updated in >5 hours), FIX: Annuals will now have/retain the proper status upon doing DB Update, FIX: Have totals will now be updated when doing a recheck files (sometimes wouldn't get updated depending on various states of status'), FIX:(#966) Added urllib2.URLError exeception trap when attempting to check Git for updates, IMP: Removed the individual sqlite calls for weeklypull, and brought them into line with using the db module (which will minimize concurrent access, which seemed to be causing db locks), IMP: Cleaned up some code and shuffled some functions so they are in more appropriate locations
2015-03-27 17:27:59 +00:00
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
else :
2015-01-16 19:40:08 +00:00
logger . info ( ' [DUPECHECK] Duplication detection returned no hits. This is not a duplicate of anything that I have scanned in as of yet. ' )
IMP: When scanning a folder using the Import a Directory option, upon completion a button to the Import Results Management page will be displayed to allow for easier access / acknowledgement of completion of scan, FIX: Fixed some issues with the search results page displaying too much information, IMP: Improved the ability to see alternate covers within issues when viewing selected issue details via the 'i' icon on the issue details page, IMP: Fixed the problem with issues that had 2015 dates and wouldn't scan in via manual post-processing, IMP: Added duplicate issue detection (beta) - enabled, when post-processing (manually or otherwise), will retain the issue that is bigger in filesize and won't post-process if it's smaller in size, instead of hammering the oldest copy, FIX: bunch of small fixes, and getting groundwork done for other things.
2014-12-18 18:30:57 +00:00
rtnval = " write "
return rtnval
2015-01-25 02:26:22 +00:00
def create_https_certificates ( ssl_cert , ssl_key ) :
"""
Create a pair of self - signed HTTPS certificares and store in them in
' ssl_cert ' and ' ssl_key ' . Method assumes pyOpenSSL is installed .
This code is stolen from SickBeard ( http : / / github . com / midgetspy / Sick - Beard ) .
"""
from mylar import logger
from OpenSSL import crypto
from lib . certgen import createKeyPair , createCertRequest , createCertificate , \
TYPE_RSA , serial
# Create the CA Certificate
cakey = createKeyPair ( TYPE_RSA , 2048 )
careq = createCertRequest ( cakey , CN = " Certificate Authority " )
cacert = createCertificate ( careq , ( careq , cakey ) , serial , ( 0 , 60 * 60 * 24 * 365 * 10 ) ) # ten years
pkey = createKeyPair ( TYPE_RSA , 2048 )
req = createCertRequest ( pkey , CN = " Mylar " )
cert = createCertificate ( req , ( cacert , cakey ) , serial , ( 0 , 60 * 60 * 24 * 365 * 10 ) ) # ten years
# Save the key and certificate to disk
try :
with open ( ssl_key , " w " ) as fp :
fp . write ( crypto . dump_privatekey ( crypto . FILETYPE_PEM , pkey ) )
with open ( ssl_cert , " w " ) as fp :
fp . write ( crypto . dump_certificate ( crypto . FILETYPE_PEM , cert ) )
except IOError as e :
logger . error ( " Error creating SSL key and certificate: %s " , e )
return False
return True
2015-07-22 21:00:45 +00:00
def torrent_create ( site , linkid , alt = None ) :
2015-08-11 21:56:22 +00:00
if site == ' 32P ' or site == ' TOR ' :
IMP: 32P support added (identical to CBT, no backlog searching but full RSS url is required for usage), IMP: Threaded RSS Check (will only run once concurrently), IMP: Added option to enable/disable Snatched/Failed to show on Wanted tab, FIX: Removed UID from dognzb config, IMP: Removed apikey from being stored in db for dognzb, IMP: Will only store ID/HASH for torrents, instead of entire link - will recreate dynamically as required, IMP: Switched to requests for torrent retrieval, IMP: Removed getdefaultlocal requirements on startup (would fail startup on some OSX systems), IMP: Will now display covers that are in 00.png format when viewing issue details, IMP: Fixed incorrect logic for dupecheck status checks, FIX: Removed some unneeded print statements
2015-04-15 04:10:52 +00:00
pass
elif site == ' KAT ' :
if ' http ' in linkid :
2015-07-22 21:00:45 +00:00
if alt is None :
#if it's being passed here with the http alread in, then it's an old rssdb entry and we can take it as is.
url = linkid
else :
url = re . sub ( ' http://torcache.net/ ' , ' http://torrage.com/ ' , linkid ) . strip ( )
IMP: 32P support added (identical to CBT, no backlog searching but full RSS url is required for usage), IMP: Threaded RSS Check (will only run once concurrently), IMP: Added option to enable/disable Snatched/Failed to show on Wanted tab, FIX: Removed UID from dognzb config, IMP: Removed apikey from being stored in db for dognzb, IMP: Will only store ID/HASH for torrents, instead of entire link - will recreate dynamically as required, IMP: Switched to requests for torrent retrieval, IMP: Removed getdefaultlocal requirements on startup (would fail startup on some OSX systems), IMP: Will now display covers that are in 00.png format when viewing issue details, IMP: Fixed incorrect logic for dupecheck status checks, FIX: Removed some unneeded print statements
2015-04-15 04:10:52 +00:00
else :
2015-07-22 21:00:45 +00:00
if alt is None :
url = ' http://torcache.net/torrent/ ' + str ( linkid ) + ' .torrent '
else :
IMP: (#1122) Added provider OMGWTFNZBS (results untested), FIX:(#1124) Experimental search results had a 1/9 (or simliar) parts as part of the header, would error out trying to create the nzb due to invalid path, FIX: When importing a series, if Move Files wasn't enabled would error out during the import process, FIX: When on Import page, if selecting Save Changes without Scanning Library would leave pop-up notification up forever, FIX: When searching for series (like A-Force), results would return 16000+ which would look like it locked up due to the excessive number of results - will now better handle such titles, and overall search results are limited to the first 1000 hits, FIX: When clicking on 'Add Series' from the pull-list, if a series was a new series with no issues published would return 0 results from CV even though the series would exist, FIX:(#1120) Story Arcs with special characters would cause error during manual post-processing run, FIX:(#1125) If year is fuzzied for a given series when searching, would error out with invalid date comparisons
2015-09-11 15:49:56 +00:00
url = ' http://torrage.com/ ' + str ( linkid ) + ' .torrent '
IMP: 32P support added (identical to CBT, no backlog searching but full RSS url is required for usage), IMP: Threaded RSS Check (will only run once concurrently), IMP: Added option to enable/disable Snatched/Failed to show on Wanted tab, FIX: Removed UID from dognzb config, IMP: Removed apikey from being stored in db for dognzb, IMP: Will only store ID/HASH for torrents, instead of entire link - will recreate dynamically as required, IMP: Switched to requests for torrent retrieval, IMP: Removed getdefaultlocal requirements on startup (would fail startup on some OSX systems), IMP: Will now display covers that are in 00.png format when viewing issue details, IMP: Fixed incorrect logic for dupecheck status checks, FIX: Removed some unneeded print statements
2015-04-15 04:10:52 +00:00
return url
2015-05-14 09:33:40 +00:00
def parse_32pfeed ( rssfeedline ) :
KEYS_32P = { }
if mylar . ENABLE_32P and len ( rssfeedline ) > 1 :
userid_st = rssfeedline . find ( ' &user ' )
2015-05-22 08:32:51 +00:00
userid_en = rssfeedline . find ( ' & ' , userid_st + 1 )
2015-05-14 09:33:40 +00:00
if userid_en == - 1 :
2015-05-22 08:32:51 +00:00
USERID_32P = rssfeedline [ userid_st + 6 : ]
2015-05-14 09:33:40 +00:00
else :
2015-05-22 08:32:51 +00:00
USERID_32P = rssfeedline [ userid_st + 6 : userid_en ]
2015-05-14 09:33:40 +00:00
auth_st = rssfeedline . find ( ' &auth ' )
2015-05-22 08:32:51 +00:00
auth_en = rssfeedline . find ( ' & ' , auth_st + 1 )
2015-05-14 09:33:40 +00:00
if auth_en == - 1 :
2015-05-22 08:32:51 +00:00
AUTH_32P = rssfeedline [ auth_st + 6 : ]
2015-05-14 09:33:40 +00:00
else :
2015-05-22 08:32:51 +00:00
AUTH_32P = rssfeedline [ auth_st + 6 : auth_en ]
2015-05-14 09:33:40 +00:00
authkey_st = rssfeedline . find ( ' &authkey ' )
2015-05-22 08:32:51 +00:00
authkey_en = rssfeedline . find ( ' & ' , authkey_st + 1 )
2015-05-14 09:33:40 +00:00
if authkey_en == - 1 :
2015-05-22 08:32:51 +00:00
AUTHKEY_32P = rssfeedline [ authkey_st + 9 : ]
2015-05-14 09:33:40 +00:00
else :
2015-05-22 08:32:51 +00:00
AUTHKEY_32P = rssfeedline [ authkey_st + 9 : authkey_en ]
2015-05-14 09:33:40 +00:00
KEYS_32P = { " user " : USERID_32P ,
" auth " : AUTH_32P ,
" authkey " : AUTHKEY_32P ,
" passkey " : mylar . PASSKEY_32P }
return KEYS_32P
IMP: (#1122) Added provider OMGWTFNZBS (results untested), FIX:(#1124) Experimental search results had a 1/9 (or simliar) parts as part of the header, would error out trying to create the nzb due to invalid path, FIX: When importing a series, if Move Files wasn't enabled would error out during the import process, FIX: When on Import page, if selecting Save Changes without Scanning Library would leave pop-up notification up forever, FIX: When searching for series (like A-Force), results would return 16000+ which would look like it locked up due to the excessive number of results - will now better handle such titles, and overall search results are limited to the first 1000 hits, FIX: When clicking on 'Add Series' from the pull-list, if a series was a new series with no issues published would return 0 results from CV even though the series would exist, FIX:(#1120) Story Arcs with special characters would cause error during manual post-processing run, FIX:(#1125) If year is fuzzied for a given series when searching, would error out with invalid date comparisons
2015-09-11 15:49:56 +00:00
#def file_ops(path,dst):
# # path = source path + filename
# # dst = destination path + filename
# #get the crc of the file prior to the operation and then compare after to ensure it's complete.
# crc_check = mylar.filechecker.crc(path)
# #will be either copy / move
# if mylar.FILE_OPS == 'copy':
# shutil.copy( path , dst )
# if crc_check == mylar.filechecker.crc(dst):
# return True
# else:
# return False
# elif mylar.FILE_OPS == 'move':
# shutil.move( path , dst )
# if crc_check == mylar.filechecker.crc(dst):
# return True
# else:
# return False
# elif mylar.FILE_OPS == 'hardlink':
# import sys
# # Open a file
# fd = os.open( path, os.O_RDWR|os.O_CREAT )
# os.close( fd )
# # Now create another copy of the above file.
# os.link( path, dst )
# print "Created hard link successfully!!"
# return True
# elif mylar.FILE_OPS == 'softlink':
# try:
FIX: One-off Failed Download handling will now work, IMP: Some better error handling when detecting one-off's during post-processing, FIX:(#1143) When series contained a digit preceded by a dash, would incorrectly assume it as a negative issue number, FIX: Improved being able to detect corresponding annuals on CV when refreshing/importing a series when the annuals are new (ie. no data on CV), FIX: Alt_Pull method for weekly pull list retrieval working again, FIX: Fixed nzbid detection for experimental search, IMP: Mass Import button now available on Import Results screen (will attempt to import all series that are in a 'Not Imported' status), IMP: When searching for arc issues using the 'Search for Missing' option, the call is now threaded so it runs in the background, IMP: Changed IssueYear to IssueDate for Story Arc Issues on the arc details page, FIX:(#1156) Typo that caused error when attempting to view cbz comics in the series detail page, FIX:(#1145) Select All option via top checkbox (on series detail page), FIX: Auto-Want feature via weeklypull will better match to titles that contain 'the' and have hypens in differing character positions, FIX:(#1160) Would incorrectly take the length of a decimal placed issue when searching and never complete the issue number cylcing search, FIX:(#1161) When annuals not enabled, and series in watchlist and series annual in pullist, would error out trying to link series to pullist.
2015-11-18 06:32:40 +00:00
# os.symlink( path, dst )
# except OSError, e:
# if e.errno == errno.EEXIST:
# os.remove(dst)
# os.symlink( path, dst )
# else:
# raise e
# print 'Unable to create symlink.'
# return False
IMP: (#1122) Added provider OMGWTFNZBS (results untested), FIX:(#1124) Experimental search results had a 1/9 (or simliar) parts as part of the header, would error out trying to create the nzb due to invalid path, FIX: When importing a series, if Move Files wasn't enabled would error out during the import process, FIX: When on Import page, if selecting Save Changes without Scanning Library would leave pop-up notification up forever, FIX: When searching for series (like A-Force), results would return 16000+ which would look like it locked up due to the excessive number of results - will now better handle such titles, and overall search results are limited to the first 1000 hits, FIX: When clicking on 'Add Series' from the pull-list, if a series was a new series with no issues published would return 0 results from CV even though the series would exist, FIX:(#1120) Story Arcs with special characters would cause error during manual post-processing run, FIX:(#1125) If year is fuzzied for a given series when searching, would error out with invalid date comparisons
2015-09-11 15:49:56 +00:00
# return True
# else:
# return False
2015-05-14 09:33:40 +00:00
2014-06-02 19:02:28 +00:00
from threading import Thread
class ThreadWithReturnValue ( Thread ) :
def __init__ ( self , group = None , target = None , name = None ,
args = ( ) , kwargs = { } , Verbose = None ) :
Thread . __init__ ( self , group , target , name , args , kwargs , Verbose )
self . _return = None
def run ( self ) :
if self . _Thread__target is not None :
FIX: undefined on filter box on startup, IMP: Added Meta-Tagging options on a series / issue basis on comic details screen, IMP: Issue Information is now available per issue and is extracted currently from the cbz file to display (if no cbz is present, the option isn't available), IMP: Failed Download handling is implemented and available in GUI - required to replace existing autoProcessComics.py and ComicRN.py scripts, IMP: Added ability to specify post-processing script instead of ComicRN.py, IMP: Added abilty to edit the issue date for a given issue by simply clicking on it - this will help to avoid dates that have incorrect or 0000-00-00, IMP: Story Arc searching is working (not adding yet), IMP: Added Archived/Ignored options to Upcoming/Wanted tab, IMP: Fixed some alignment and display issues on the Upcoming section, IMP: Added better directory handling for Updating Comic Location when it needs to get changed for all existing series (locmove in config.ini), IMP: Added better handling for unicode characters in series titles when searching / filechecking, IMP: When adding a new series with no data, Mylar would error out (now will add and just retain 0 issues), FIX: When year was fuzzied, search would still attempt to do a date-check comparison and say everything failed, IMP: Better handling of nzb names when retaining for post-processing comparisons, IMP: Future Upcoming now will use actual shipping date of issue if available in order to see if issue is available, FIX: If annuals were enabled, refreshing a series would put some issues into an Archived status because the actual counts would be off, IMP: When file checking, Alternate Naming would be searched last which resulted in matching incorrectly to the series title or other alternate naming for the given series, now will check the Alternate Naming first for a match, then drop back down to the series name itself otherwise, IMP: Improved Annual detection when integrated with a given series, IMP: Improved the checking of the future Upcoming list for issues marked as Wanted but not available yet and then auto-adding, IMP: Improved upon story arc checking for missing issues / searching for wanted, IMP: Enabling Annuals support now within Configuration GUI, bunch of other things....
2014-07-28 19:28:09 +00:00
self . _return = self . _Thread__target ( * self . _Thread__args , * * self . _Thread__kwargs )
2014-06-02 19:02:28 +00:00
def join ( self ) :
Thread . join ( self )
return self . _return