mirror of https://github.com/evilhero/mylar
FIX: Invalid Torrent files (Bencoded Error), IMP:(#562) update mylar.init.d (thnx Kalinon), IMP:(#558,#560) Added quiet variable to config.ini (kat_proxy) for bypassing blocked url, FIX:(#556) Torrent File Names now fixed for KAT (format of: series_issue_year), FIX: KAT Torrent searching wasn't going through all iterations of issue numbering for matches
This commit is contained in:
parent
45c69f97a3
commit
527c23526e
15
mylar.init.d
15
mylar.init.d
|
@ -32,6 +32,7 @@ DESC=mylar
|
|||
RUN_AS=
|
||||
|
||||
PID_FILE=/var/run/mylar.pid
|
||||
PID_PATH=`dirname $PID_FILE`
|
||||
|
||||
############### END EDIT ME ##################
|
||||
|
||||
|
@ -39,6 +40,20 @@ test -x $DAEMON || exit 0
|
|||
|
||||
set -e
|
||||
|
||||
# Create PID if missing and remove stale PID file
|
||||
if [ ! =d $PID_PATH ]; then
|
||||
mkdir -p $PID_PATH
|
||||
chown $RUN_AS $PID_PATH
|
||||
fi
|
||||
|
||||
if [ -e $PID_FILE ]; then
|
||||
PID=`cat $PID_FILE`
|
||||
if ! kill -0 $PID > /dev/null 2>&1; then
|
||||
echo "Removing stale $PID_FILE"
|
||||
rm $PID_FILE
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting $DESC"
|
||||
|
|
|
@ -251,6 +251,7 @@ SEEDBOX_WATCHDIR = None
|
|||
|
||||
ENABLE_TORRENT_SEARCH = 0
|
||||
ENABLE_KAT = 0
|
||||
KAT_PROXY = None
|
||||
ENABLE_CBT = 0
|
||||
CBT_PASSKEY = None
|
||||
|
||||
|
@ -316,7 +317,7 @@ def initialize():
|
|||
RAW, RAW_PROVIDER, RAW_USERNAME, RAW_PASSWORD, RAW_GROUPS, EXPERIMENTAL, ALTEXPERIMENTAL, \
|
||||
ENABLE_META, CMTAGGER_PATH, INDIE_PUB, BIGGIE_PUB, IGNORE_HAVETOTAL, PROVIDER_ORDER, \
|
||||
ENABLE_TORRENTS, TORRENT_LOCAL, LOCAL_WATCHDIR, TORRENT_SEEDBOX, SEEDBOX_HOST, SEEDBOX_PORT, SEEDBOX_USER, SEEDBOX_PASS, SEEDBOX_WATCHDIR, \
|
||||
ENABLE_RSS, RSS_CHECKINTERVAL, RSS_LASTRUN, ENABLE_TORRENT_SEARCH, ENABLE_KAT, ENABLE_CBT, CBT_PASSKEY, \
|
||||
ENABLE_RSS, RSS_CHECKINTERVAL, RSS_LASTRUN, ENABLE_TORRENT_SEARCH, ENABLE_KAT, KAT_PROXY, ENABLE_CBT, CBT_PASSKEY, \
|
||||
PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY, NMA_ONSNATCH, PUSHOVER_ENABLED, PUSHOVER_PRIORITY, PUSHOVER_APIKEY, PUSHOVER_USERKEY, PUSHOVER_ONSNATCH, BOXCAR_ENABLED, BOXCAR_USERNAME, BOXCAR_ONSNATCH, LOCMOVE, NEWCOM_DIR, FFTONEWCOM_DIR, \
|
||||
PREFERRED_QUALITY, MOVE_FILES, RENAME_FILES, LOWERCASE_FILENAMES, USE_MINSIZE, MINSIZE, USE_MAXSIZE, MAXSIZE, CORRECT_METADATA, FOLDER_FORMAT, FILE_FORMAT, REPLACE_CHAR, REPLACE_SPACES, ADD_TO_CSV, CVINFO, LOG_LEVEL, POST_PROCESSING, SEARCH_DELAY, GRABBAG_DIR, READ2FILENAME, STORYARCDIR, CVURL, CVAPIFIX, \
|
||||
COMIC_LOCATION, QUAL_ALTVERS, QUAL_SCANNER, QUAL_TYPE, QUAL_QUALITY, ENABLE_EXTRA_SCRIPTS, EXTRA_SCRIPTS, ENABLE_PRE_SCRIPTS, PRE_SCRIPTS, PULLNEW, COUNT_ISSUES, COUNT_HAVES, COUNT_COMICS, SYNO_FIX, CHMOD_FILE, CHMOD_DIR, ANNUALS_ON, CV_ONLY, CV_ONETIMER, WEEKFOLDER
|
||||
|
@ -481,6 +482,7 @@ def initialize():
|
|||
|
||||
ENABLE_TORRENT_SEARCH = bool(check_setting_int(CFG, 'Torrents', 'enable_torrent_search', 0))
|
||||
ENABLE_KAT = bool(check_setting_int(CFG, 'Torrents', 'enable_kat', 0))
|
||||
KAT_PROXY = check_setting_str(CFG, 'Torrents', 'kat_proxy', '')
|
||||
ENABLE_CBT = bool(check_setting_int(CFG, 'Torrents', 'enable_cbt', 0))
|
||||
CBT_PASSKEY = check_setting_str(CFG, 'Torrents', 'cbt_passkey', '')
|
||||
|
||||
|
@ -935,6 +937,7 @@ def config_write():
|
|||
|
||||
new_config['Torrents']['enable_torrent_search'] = int(ENABLE_TORRENT_SEARCH)
|
||||
new_config['Torrents']['enable_kat'] = int(ENABLE_KAT)
|
||||
new_config['Torrents']['kat_proxy'] = KAT_PROXY
|
||||
new_config['Torrents']['enable_cbt'] = int(ENABLE_CBT)
|
||||
new_config['Torrents']['cbt_passkey'] = CBT_PASSKEY
|
||||
|
||||
|
|
|
@ -69,14 +69,25 @@ def torrents(pickfeed=None,seriesname=None,issue=None):
|
|||
if seriesname:
|
||||
srchterm = re.sub(' ', '%20', seriesname)
|
||||
if issue:
|
||||
srchterm += ' ' + str(issue)
|
||||
srchterm += '%20' + str(issue)
|
||||
|
||||
if mylar.KAT_PROXY:
|
||||
if mylar.KAT_PROXY.endswith('/'):
|
||||
kat_url = mylar.KAT_PROXY
|
||||
else:
|
||||
kat_url = mylar.KAT_PROXY + '/'
|
||||
else:
|
||||
kat_url = 'http://kat.ph/'
|
||||
|
||||
|
||||
if pickfeed == "1": # cbt rss feed based on followlist
|
||||
feed = "http://comicbt.com/rss.php?action=browse&passkey=" + str(passkey) + "&type=dl"
|
||||
elif pickfeed == "2" and srchterm is not None: # kat.ph search
|
||||
feed = "http://kat.ph/usearch/" + str(srchterm) + "%20category%3Acomics%20seeds%3A1/?rss=1"
|
||||
logger.info('PF2 - kat url set to: ' + kat_url)
|
||||
feed = kat_url + "usearch/" + str(srchterm) + "%20category%3Acomics%20seeds%3A1/?rss=1"
|
||||
elif pickfeed == "3": # kat.ph rss feed
|
||||
feed = "http://kat.ph/usearch/category%3Acomics%20seeds%3A1/?rss=1"
|
||||
logger.info('PF3 - kat url set to: ' + kat_url)
|
||||
feed = kat_url + "usearch/category%3Acomics%20seeds%3A1/?rss=1"
|
||||
elif pickfeed == "4": #cbt follow link
|
||||
feed = "http://comicbt.com/rss.php?action=follow&passkey=" + str(passkey) + "&type=dl"
|
||||
elif pickfeed == "5": # cbt series link
|
||||
|
@ -117,12 +128,13 @@ def torrents(pickfeed=None,seriesname=None,issue=None):
|
|||
elif pickfeed == "2":
|
||||
tmpsz = feedme.entries[i].enclosures[0]
|
||||
torthekat.append({
|
||||
'title': feedme.entries[i].title,
|
||||
'link': tmpsz['url'],
|
||||
'pubdate': feedme.entries[i].updated,
|
||||
'site': 'KAT',
|
||||
'length': tmpsz['length']
|
||||
})
|
||||
'site': 'KAT',
|
||||
'title': feedme.entries[i].title,
|
||||
'link': tmpsz['url'],
|
||||
'pubdate': feedme.entries[i].updated,
|
||||
'length': tmpsz['length']
|
||||
})
|
||||
|
||||
#print ("Site: KAT")
|
||||
#print ("Title: " + str(feedme.entries[i].title))
|
||||
#print ("Link: " + str(tmpsz['url']))
|
||||
|
@ -545,14 +557,15 @@ def nzbdbsearch(seriesname,issue,comicid=None,nzbprov=None):
|
|||
nzbinfo['entries'] = nzbtheinfo
|
||||
return nzbinfo
|
||||
|
||||
def torsend2client(seriesname, linkit, site):
|
||||
def torsend2client(seriesname, issue, seriesyear, linkit, site):
|
||||
logger.info('matched on ' + str(seriesname))
|
||||
filename = re.sub('[\'\!\@\#\$\%\:\;\/\\=\?\.]', '',seriesname)
|
||||
filename += "_" + str(issue) + "_" + str(seriesyear)
|
||||
if site == 'CBT':
|
||||
logger.info(linkit)
|
||||
linkit = str(linkit) + '&passkey=' + str(mylar.CBT_PASSKEY)
|
||||
|
||||
if linkit[-7:] != "torrent" and site != "KAT":
|
||||
if linkit[-7:] != "torrent": # and site != "KAT":
|
||||
filename += ".torrent"
|
||||
|
||||
if mylar.TORRENT_LOCAL and mylar.LOCAL_WATCHDIR is not None:
|
||||
|
@ -571,7 +584,10 @@ def torsend2client(seriesname, linkit, site):
|
|||
request.add_header('Accept-encoding', 'gzip')
|
||||
|
||||
if site == 'KAT':
|
||||
request.add_header('Referer', 'http://kat.ph/')
|
||||
stfind = linkit.find('?')
|
||||
kat_referrer = linkit[:stfind]
|
||||
request.add_header('Referer', kat_referrer)
|
||||
logger.fdebug('KAT Referer set to :' + kat_referrer)
|
||||
|
||||
|
||||
# response = helpers.urlretrieve(urllib2.urlopen(request), filepath)
|
||||
|
@ -588,7 +604,7 @@ def torsend2client(seriesname, linkit, site):
|
|||
logger.warn('Error fetching data from %s: %s' % (site, e))
|
||||
return "fail"
|
||||
|
||||
with open(filepath, 'w') as the_file:
|
||||
with open(filepath, 'wb') as the_file:
|
||||
the_file.write(torrent)
|
||||
|
||||
logger.info("saved.")
|
||||
|
|
|
@ -166,7 +166,7 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
|
|||
elif torprovider[torprtmp] == 'kat':
|
||||
torprov = 'KAT'
|
||||
|
||||
if mylar.ENABLE_RSS:
|
||||
if searchmode == 'rss':
|
||||
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, torprov, torpr, IssDateFix, IssueID, UseFuzzy, ComicVersion=ComicVersion, SARC=SARC, IssueArcID=IssueArcID, RSS="yes", ComicID=ComicID)
|
||||
if findit == 'yes':
|
||||
logger.fdebug("findit = found!")
|
||||
|
@ -757,8 +757,9 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
yearmatch = "true"
|
||||
elif UseFuzzy == "0" or UseFuzzy == "2" or UseFuzzy is None or IssDateFix != "no":
|
||||
if m[cnt][:-2] == '19' or m[cnt][:-2] == '20':
|
||||
logger.fdebug("year detected: " + str(m[cnt]))
|
||||
logger.fdebug('year detected: ' + str(m[cnt]))
|
||||
result_comyear = m[cnt]
|
||||
logger.fdebug('year looking for: ' + str(comyear))
|
||||
if str(comyear) in result_comyear:
|
||||
logger.fdebug(str(comyear) + " - right years match baby!")
|
||||
yearmatch = "true"
|
||||
|
@ -1105,7 +1106,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
nzbname = re.sub('[\,\:\?]', '', str(nzbname))
|
||||
if nzbname.lower().endswith('.torrent'):
|
||||
nzbname = re.sub('.torrent', '', nzbname)
|
||||
rcheck = rsscheck.torsend2client(ComicName, entry['link'], nzbprov)
|
||||
rcheck = rsscheck.torsend2client(ComicName, IssueNumber, comyear, entry['link'], nzbprov)
|
||||
if rcheck == "fail":
|
||||
logger.error("Unable to send torrent - check logs and settings.")
|
||||
return
|
||||
|
|
|
@ -198,6 +198,9 @@ def upcoming_update(ComicID, ComicName, IssueNumber, IssueDate, forcecheck=None)
|
|||
elif issuechk['Status'] == "Wanted":
|
||||
values = { "Status": "Wanted"}
|
||||
newValue['Status'] = "Wanted"
|
||||
elif issuechk['Status'] == "Archived":
|
||||
values = { "Status": "Archived"}
|
||||
newValue['Status'] = "Archived"
|
||||
else:
|
||||
values = { "Status": "Skipped"}
|
||||
newValue['Status'] = "Skipped"
|
||||
|
@ -246,7 +249,7 @@ def upcoming_update(ComicID, ComicName, IssueNumber, IssueDate, forcecheck=None)
|
|||
else:
|
||||
myDB.upsert("issues", values, control)
|
||||
|
||||
if issuechk['Status'] == 'Downloaded':
|
||||
if issuechk['Status'] == 'Downloaded' or issuechk['Status'] == 'Archived':
|
||||
logger.fdebug('updating Pull-list to reflect status.')
|
||||
downstats = {"Status": issuechk['Status'],
|
||||
"ComicID": issuechk['ComicID']}
|
||||
|
|
Loading…
Reference in New Issue