mirror of https://github.com/evilhero/mylar
FIX:(#613) Negative issues now accounted for properly when File Checking, FIX: If filename extension was uppercase, would be ignored (again), FIX: When creating temporary directory for metatagging, will raise exception on error, FIX: Changed 'Enable RSS Feeds' to 'Enable RSS Feeds for torrents & nzbs', IMP: Removed some unnecessary print statements
This commit is contained in:
parent
10f797c9b7
commit
a216f3c4d5
|
@ -495,8 +495,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
%endfor
|
%endfor
|
||||||
</tbody>
|
</tbody>
|
||||||
</form>
|
|
||||||
</table>
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
<div style="position:relative; width:960px; height:10px; margin:10px auto;">
|
<div style="position:relative; width:960px; height:10px; margin:10px auto;">
|
||||||
<form action="manual_annual_add" method="GET">
|
<form action="manual_annual_add" method="GET">
|
||||||
<input type="hidden" name="comicid" value=${comic['ComicID']}>
|
<input type="hidden" name="comicid" value=${comic['ComicID']}>
|
||||||
|
|
|
@ -212,7 +212,7 @@
|
||||||
<legend>Usenet</legend>
|
<legend>Usenet</legend>
|
||||||
<input type="radio" name="nzb_downloader" id="nzb_downloader_sabnzbd" value="0" ${config['nzb_downloader_sabnzbd']}>Sabnzbd <input type="radio" name="nzb_downloader" id="nzb_downloader_nzbget" value="1" ${config['nzb_downloader_nzbget']}> NZBget <input type="radio" name="nzb_downloader" id="nzb_downloader_blackhole" value="2" ${config['nzb_downloader_blackhole']}>Black Hole
|
<input type="radio" name="nzb_downloader" id="nzb_downloader_sabnzbd" value="0" ${config['nzb_downloader_sabnzbd']}>Sabnzbd <input type="radio" name="nzb_downloader" id="nzb_downloader_nzbget" value="1" ${config['nzb_downloader_nzbget']}> NZBget <input type="radio" name="nzb_downloader" id="nzb_downloader_blackhole" value="2" ${config['nzb_downloader_blackhole']}>Black Hole
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset id="sabnzbd_options">
|
<fieldset id="sabnzbd_options">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label>SABnzbd Host:</label>
|
<label>SABnzbd Host:</label>
|
||||||
<input type="text" name="sab_host" value="${config['sab_host']}" size="30">
|
<input type="text" name="sab_host" value="${config['sab_host']}" size="30">
|
||||||
|
@ -283,7 +283,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label>NZBGet Password:</label>
|
<label>NZBGet Password:</label>
|
||||||
<input type="password" name="nzbget_password" value="${config['nzbget_pass']}" size="20">
|
<input type="password" name="nzbget_password" value="${config['nzbget_pass']}" size="20">
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label>NZBGet Download Directory</label>
|
<label>NZBGet Download Directory</label>
|
||||||
<input type="text" name="nzbget_directory" value="${config['nzbget_directory']}" size="36" />
|
<input type="text" name="nzbget_directory" value="${config['nzbget_directory']}" size="36" />
|
||||||
|
@ -380,7 +380,7 @@
|
||||||
<td>
|
<td>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="row checkbox left clearfix">
|
<div class="row checkbox left clearfix">
|
||||||
<input id="enable_rss" type="checkbox" onclick="initConfigCheckbox($(this));" name="enable_rss" value=1 ${config['enable_rss']} /><label>Enable RSS Feed Searches</label>
|
<input id="enable_rss" type="checkbox" onclick="initConfigCheckbox($(this));" name="enable_rss" value=1 ${config['enable_rss']} /><label>Enable RSS Feed Searches (nzbs & torrents)</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="config">
|
<div class="config">
|
||||||
<label>RSS Inteval Feed Check</label>
|
<label>RSS Inteval Feed Check</label>
|
||||||
|
@ -961,8 +961,8 @@
|
||||||
|
|
||||||
if ($("#nzb_downloader_sabnzbd").is(":checked"))
|
if ($("#nzb_downloader_sabnzbd").is(":checked"))
|
||||||
{
|
{
|
||||||
$("#sabnzbd_options").show();
|
|
||||||
$("#nzbget_options,#blackhole_options").hide();
|
$("#nzbget_options,#blackhole_options").hide();
|
||||||
|
$("#sabnzbd_options").show();
|
||||||
}
|
}
|
||||||
if ($("#nzb_downloader_nzbget").is(":checked"))
|
if ($("#nzb_downloader_nzbget").is(":checked"))
|
||||||
{
|
{
|
||||||
|
|
36
mylar/api.py
36
mylar/api.py
|
@ -145,42 +145,6 @@ class Api(object):
|
||||||
def _getLogs(self, **kwargs):
|
def _getLogs(self, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _findArtist(self, **kwargs):
|
|
||||||
if 'name' not in kwargs:
|
|
||||||
self.data = 'Missing parameter: name'
|
|
||||||
return
|
|
||||||
if 'limit' in kwargs:
|
|
||||||
limit = kwargs['limit']
|
|
||||||
else:
|
|
||||||
limit=50
|
|
||||||
|
|
||||||
self.data = mb.findArtist(kwargs['name'], limit)
|
|
||||||
|
|
||||||
def _findAlbum(self, **kwargs):
|
|
||||||
if 'name' not in kwargs:
|
|
||||||
self.data = 'Missing parameter: name'
|
|
||||||
return
|
|
||||||
if 'limit' in kwargs:
|
|
||||||
limit = kwargs['limit']
|
|
||||||
else:
|
|
||||||
limit=50
|
|
||||||
|
|
||||||
self.data = mb.findRelease(kwargs['name'], limit)
|
|
||||||
|
|
||||||
def _addArtist(self, **kwargs):
|
|
||||||
if 'id' not in kwargs:
|
|
||||||
self.data = 'Missing parameter: id'
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
self.id = kwargs['id']
|
|
||||||
|
|
||||||
try:
|
|
||||||
importer.addComictoDB(self.id)
|
|
||||||
except Exception, e:
|
|
||||||
self.data = e
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
def _delComic(self, **kwargs):
|
def _delComic(self, **kwargs):
|
||||||
if 'id' not in kwargs:
|
if 'id' not in kwargs:
|
||||||
self.data = 'Missing parameter: id'
|
self.data = 'Missing parameter: id'
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# modified very slightly so Mylar just passes it the IssueID for it to do it's magic.
|
# modified very slightly so Mylar just passes it the IssueID for it to do it's magic.
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os, errno
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import glob
|
import glob
|
||||||
|
@ -92,8 +92,15 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
|
|
||||||
if os.path.exists( comicpath ):
|
if os.path.exists( comicpath ):
|
||||||
shutil.rmtree( comicpath )
|
shutil.rmtree( comicpath )
|
||||||
os.makedirs( comicpath )
|
|
||||||
|
|
||||||
|
logger.fdebug('attempting to create directory @: ' + str(comicpath))
|
||||||
|
try:
|
||||||
|
os.makedirs(comicpath)
|
||||||
|
except OSError:
|
||||||
|
raise
|
||||||
|
|
||||||
|
logger.fdebug('created directory @ : ' + str(comicpath))
|
||||||
|
logger.fdebug('filename is : ' + str(filename))
|
||||||
if filename is None:
|
if filename is None:
|
||||||
filename_list = glob.glob( os.path.join( downloadpath, "*.cbz" ) )
|
filename_list = glob.glob( os.path.join( downloadpath, "*.cbz" ) )
|
||||||
filename_list.extend( glob.glob( os.path.join( downloadpath, "*.cbr" ) ) )
|
filename_list.extend( glob.glob( os.path.join( downloadpath, "*.cbr" ) ) )
|
||||||
|
@ -114,10 +121,8 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
if filename.endswith('.cbr'):
|
if filename.endswith('.cbr'):
|
||||||
f = os.path.join( comicpath, filename )
|
f = os.path.join( comicpath, filename )
|
||||||
if zipfile.is_zipfile( f ):
|
if zipfile.is_zipfile( f ):
|
||||||
#print "zipfile detected"
|
logger.fdebug('zipfile detected')
|
||||||
base = os.path.splitext( f )[0]
|
base = os.path.splitext( f )[0]
|
||||||
#print base
|
|
||||||
#print f
|
|
||||||
shutil.move( f, base + ".cbz" )
|
shutil.move( f, base + ".cbz" )
|
||||||
logger.fdebug('{0}: renaming {1} to be a cbz'.format( scriptname, os.path.basename( f ) ))
|
logger.fdebug('{0}: renaming {1} to be a cbz'.format( scriptname, os.path.basename( f ) ))
|
||||||
|
|
||||||
|
@ -138,6 +143,7 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
|
|
||||||
# Now rename all CBR files to RAR
|
# Now rename all CBR files to RAR
|
||||||
if filename.endswith('.cbr'):
|
if filename.endswith('.cbr'):
|
||||||
|
#logger.fdebug('renaming .cbr to .rar')
|
||||||
f = os.path.join( comicpath, filename)
|
f = os.path.join( comicpath, filename)
|
||||||
base = os.path.splitext( f )[0]
|
base = os.path.splitext( f )[0]
|
||||||
baserar = base + ".rar"
|
baserar = base + ".rar"
|
||||||
|
|
|
@ -86,7 +86,7 @@ def listFiles(dir,watchcomic,Publisher,AlternateSearch=None,manual=None,sarc=Non
|
||||||
item = fname['filename']
|
item = fname['filename']
|
||||||
|
|
||||||
if item == 'cover.jpg' or item == 'cvinfo': continue
|
if item == 'cover.jpg' or item == 'cvinfo': continue
|
||||||
if not item.endswith(extensions):
|
if not item.lower().endswith(extensions):
|
||||||
logger.fdebug('[FILECHECKER] filename not a valid cbr/cbz - ignoring: ' + item)
|
logger.fdebug('[FILECHECKER] filename not a valid cbr/cbz - ignoring: ' + item)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -157,11 +157,11 @@ def listFiles(dir,watchcomic,Publisher,AlternateSearch=None,manual=None,sarc=Non
|
||||||
#if the series has digits this f's it up.
|
#if the series has digits this f's it up.
|
||||||
if numberinseries == 'True' or decimalinseries == 'True':
|
if numberinseries == 'True' or decimalinseries == 'True':
|
||||||
#we need to remove the series from the subname and then search the remainder.
|
#we need to remove the series from the subname and then search the remainder.
|
||||||
watchname = re.sub('[-\:\;\!\'\/\?\+\=\_\%\.]', '', watchcomic) #remove spec chars for watchcomic match.
|
watchname = re.sub('[\:\;\!\'\/\?\+\=\_\%\.]', '', watchcomic) #remove spec chars for watchcomic match.
|
||||||
logger.fdebug('[FILECHECKER] watch-cleaned: ' + str(watchname))
|
logger.fdebug('[FILECHECKER] watch-cleaned: ' + str(watchname))
|
||||||
subthis = re.sub('.cbr', '', subname)
|
subthis = re.sub('.cbr', '', subname)
|
||||||
subthis = re.sub('.cbz', '', subthis)
|
subthis = re.sub('.cbz', '', subthis)
|
||||||
subthis = re.sub('[-\:\;\!\'\/\?\+\=\_\%\.]', '', subthis)
|
subthis = re.sub('[\:\;\!\'\/\?\+\=\_\%\.]', '', subthis)
|
||||||
logger.fdebug('[FILECHECKER] sub-cleaned: ' + str(subthis))
|
logger.fdebug('[FILECHECKER] sub-cleaned: ' + str(subthis))
|
||||||
subthis = subthis[len(watchname):] #remove watchcomic
|
subthis = subthis[len(watchname):] #remove watchcomic
|
||||||
#we need to now check the remainder of the string for digits assuming it's a possible year
|
#we need to now check the remainder of the string for digits assuming it's a possible year
|
||||||
|
@ -173,7 +173,7 @@ def listFiles(dir,watchcomic,Publisher,AlternateSearch=None,manual=None,sarc=Non
|
||||||
subit = re.sub('(.*)[\s+|_+](19\d{2}|20\d{2})(.*)', '\\1 (\\2) \\3', subname)
|
subit = re.sub('(.*)[\s+|_+](19\d{2}|20\d{2})(.*)', '\\1 (\\2) \\3', subname)
|
||||||
subthis2 = re.sub('.cbr', '', subit)
|
subthis2 = re.sub('.cbr', '', subit)
|
||||||
subthis1 = re.sub('.cbz', '', subthis2)
|
subthis1 = re.sub('.cbz', '', subthis2)
|
||||||
subname = re.sub('[-\:\;\!\'\/\?\+\=\_\%\-]', '', subthis1)
|
subname = re.sub('[\:\;\!\'\/\?\+\=\_\%]', '', subthis1)
|
||||||
#if '.' appears more than once at this point, then it's being used in place of spaces.
|
#if '.' appears more than once at this point, then it's being used in place of spaces.
|
||||||
#if '.' only appears once at this point, it's a decimal issue (since decimalinseries is False within this else stmt).
|
#if '.' only appears once at this point, it's a decimal issue (since decimalinseries is False within this else stmt).
|
||||||
if len(str(subname.count('.'))) == 1:
|
if len(str(subname.count('.'))) == 1:
|
||||||
|
@ -235,6 +235,7 @@ def listFiles(dir,watchcomic,Publisher,AlternateSearch=None,manual=None,sarc=Non
|
||||||
detneg = "no"
|
detneg = "no"
|
||||||
leavehyphen = False
|
leavehyphen = False
|
||||||
should_restart = True
|
should_restart = True
|
||||||
|
lenwatch = len(watchcomic) # because subname gets replaced dynamically, the length will change and things go wrong.
|
||||||
while should_restart:
|
while should_restart:
|
||||||
should_restart = False
|
should_restart = False
|
||||||
for nono in not_these:
|
for nono in not_these:
|
||||||
|
@ -254,7 +255,8 @@ def listFiles(dir,watchcomic,Publisher,AlternateSearch=None,manual=None,sarc=Non
|
||||||
logger.fdebug('[FILECHECKER] possible negative issue detected.')
|
logger.fdebug('[FILECHECKER] possible negative issue detected.')
|
||||||
nonocount = nonocount + subcnt - 1
|
nonocount = nonocount + subcnt - 1
|
||||||
detneg = "yes"
|
detneg = "yes"
|
||||||
elif '-' in watchcomic and i < len(watchcomic):
|
elif '-' in watchcomic and j < lenwatch:
|
||||||
|
lenwatch -=1
|
||||||
logger.fdebug('[FILECHECKER] - appears in series title.')
|
logger.fdebug('[FILECHECKER] - appears in series title.')
|
||||||
logger.fdebug('[FILECHECKER] up to - :' + subname[:j+1].replace('-', ' '))
|
logger.fdebug('[FILECHECKER] up to - :' + subname[:j+1].replace('-', ' '))
|
||||||
logger.fdebug('[FILECHECKER] after - :' + subname[j+1:])
|
logger.fdebug('[FILECHECKER] after - :' + subname[j+1:])
|
||||||
|
@ -263,7 +265,7 @@ def listFiles(dir,watchcomic,Publisher,AlternateSearch=None,manual=None,sarc=Non
|
||||||
should_restart = True
|
should_restart = True
|
||||||
leavehyphen = True
|
leavehyphen = True
|
||||||
i+=1
|
i+=1
|
||||||
if detneg == "no" or leavehyphen == False:
|
if detneg == "no" and leavehyphen == False:
|
||||||
subname = re.sub(str(nono), ' ', subname)
|
subname = re.sub(str(nono), ' ', subname)
|
||||||
nonocount = nonocount + subcnt
|
nonocount = nonocount + subcnt
|
||||||
#logger.fdebug('[FILECHECKER] (str(nono) + " detected " + str(subcnt) + " times.")
|
#logger.fdebug('[FILECHECKER] (str(nono) + " detected " + str(subcnt) + " times.")
|
||||||
|
@ -374,23 +376,23 @@ def listFiles(dir,watchcomic,Publisher,AlternateSearch=None,manual=None,sarc=Non
|
||||||
i=0
|
i=0
|
||||||
while (i < len(charpos)):
|
while (i < len(charpos)):
|
||||||
for i,j in enumerate(charpos):
|
for i,j in enumerate(charpos):
|
||||||
#print i,j
|
#logger.fdebug('i,j:' + str(i) + ',' + str(j))
|
||||||
#print subname
|
#logger.fdebug(str(len(subname)) + ' - subname: ' + subname)
|
||||||
#print "digitchk: " + str(subname[j:])
|
#logger.fdebug("digitchk: " + str(subname[j:]))
|
||||||
if j >= len(subname):
|
if j >= len(subname):
|
||||||
logger.fdebug('[FILECHECKER] end reached. ignoring remainder.')
|
logger.fdebug('[FILECHECKER] end reached. ignoring remainder.')
|
||||||
break
|
break
|
||||||
elif subname[j:] == '-':
|
elif subname[j:] == '-':
|
||||||
if i <= len(subname) and subname[i+1].isdigit():
|
if j <= len(subname) and subname[j+1].isdigit():
|
||||||
logger.fdebug('[FILECHECKER] negative issue detected.')
|
logger.fdebug('[FILECHECKER] negative issue detected.')
|
||||||
#detneg = "yes"
|
#detneg = "yes"
|
||||||
elif j > findtitlepos:
|
elif j > findtitlepos:
|
||||||
if subname[j:] == '#':
|
if subname[j:] == '#':
|
||||||
if subname[i+1].isdigit():
|
if subname[j+1].isdigit():
|
||||||
logger.fdebug('[FILECHECKER] # detected denoting issue#, ignoring.')
|
logger.fdebug('[FILECHECKER] # detected denoting issue#, ignoring.')
|
||||||
else:
|
else:
|
||||||
nonocount-=1
|
nonocount-=1
|
||||||
elif '-' in watchcomic and i < len(watchcomic):
|
elif '-' in watchcomic and j < len(watchcomic):
|
||||||
logger.fdebug('[FILECHECKER] - appears in series title, ignoring.')
|
logger.fdebug('[FILECHECKER] - appears in series title, ignoring.')
|
||||||
else:
|
else:
|
||||||
logger.fdebug('[FILECHECKER] special character appears outside of title - ignoring @ position: ' + str(charpos[i]))
|
logger.fdebug('[FILECHECKER] special character appears outside of title - ignoring @ position: ' + str(charpos[i]))
|
||||||
|
|
Loading…
Reference in New Issue