Recheck files locates # now, added replace with spaces option in config for filenames

This commit is contained in:
evilhero 2012-09-14 13:29:01 -04:00
parent 94e118ada4
commit 5a8c34d387
6 changed files with 74 additions and 33 deletions

View File

@ -245,6 +245,25 @@
<fieldset>
<legend>Advanced Options</legend>
<div class="row checkbox">
<input id="replace_spaces" type="checkbox" onclick="initConfigCheckbox($(this));" name="replace_spaces" value="1" ${config['use_dognzb']} /><label>Replace Spaces</label>
</div>
<div class="row">
<label>Format</label>
<select name="replace_char">
%for x in ['.', '_']:
<%
if config['replace_char'] == x:
outputselect = 'selected'
else:
outputselect = ''
%>
<option value=${x} ${outputselect}>${x}</option>
%endfor
</select>
</div>
</fieldset>
</td>

View File

@ -15,7 +15,7 @@
<%def name="body()">
<div class="table_wrapper">
<div id="manageheader" class="title">
<h1 class="clearfix"><img src="interfaces/default/images/icon_manage.png" alt="manage"/>Manage comics</h1>
<h1 class="clearfix">Manage comics</h1>
</div>
<form action="markArtists" method="get" id="markArtists">
<div id="markalbum">

View File

@ -98,6 +98,8 @@ BLACKHOLE = False
BLACKHOLE_DIR = None
FOLDER_FORMAT = None
FILE_FORMAT = None
REPLACE_SPACES = False
REPLACE_CHAR = None
AUTOWANT_UPCOMING = False
AUTOWANT_ALL = False
@ -185,8 +187,8 @@ def initialize():
DOWNLOAD_DIR, USENET_RETENTION, SEARCH_INTERVAL, INTERFACE, AUTOWANT_ALL, AUTOWANT_UPCOMING, \
LIBRARYSCAN_INTERVAL, DOWNLOAD_SCAN_INTERVAL, SAB_HOST, SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, BLACKHOLE, BLACKHOLE_DIR, \
NZBSU, NZBSU_APIKEY, DOGNZB, DOGNZB_APIKEY, \
RAW, RAW_PROVIDER, RAW_USERNAME, RAW_PASSWORD, RAW_GROUPS, EXPERIMENTAL,\
PREFERRED_QUALITY, MOVE_FILES, RENAME_FILES, CORRECT_METADATA, FOLDER_FORMAT, FILE_FORMAT, \
RAW, RAW_PROVIDER, RAW_USERNAME, RAW_PASSWORD, RAW_GROUPS, EXPERIMENTAL, \
PREFERRED_QUALITY, MOVE_FILES, RENAME_FILES, CORRECT_METADATA, FOLDER_FORMAT, FILE_FORMAT, REPLACE_CHAR, REPLACE_SPACES, \
COMIC_LOCATION, QUAL_ALTVERS, QUAL_SCANNER, QUAL_TYPE, QUAL_QUALITY
if __INITIALIZED__:
@ -237,7 +239,9 @@ def initialize():
FILE_FORMAT = check_setting_str(CFG, 'General', 'file_format', 'Track Artist - Album [Year]- Title')
BLACKHOLE = bool(check_setting_int(CFG, 'General', 'blackhole', 0))
BLACKHOLE_DIR = check_setting_str(CFG, 'General', 'blackhole_dir', '')
REPLACE_SPACES = bool(check_setting_int(CFG, 'General', 'replace_spaces', 0))
REPLACE_CHAR = check_setting_str(CFG, 'General', 'replace_char', '')
SAB_HOST = check_setting_str(CFG, 'SABnzbd', 'sab_host', '')
SAB_USERNAME = check_setting_str(CFG, 'SABnzbd', 'sab_username', '')
SAB_PASSWORD = check_setting_str(CFG, 'SABnzbd', 'sab_password', '')
@ -438,6 +442,9 @@ def config_write():
new_config['General']['file_format'] = FILE_FORMAT
new_config['General']['blackhole'] = int(BLACKHOLE)
new_config['General']['blackhole_dir'] = BLACKHOLE_DIR
new_config['General']['replace_spaces'] = int(REPLACE_SPACES)
new_config['General']['replace_char'] = REPLACE_CHAR
new_config['SABnzbd'] = {}
new_config['SABnzbd']['sab_host'] = SAB_HOST

View File

@ -93,14 +93,16 @@ def addComictoDB(comicid):
#comic book location on machine
# setup default location here
comlocation = mylar.DESTINATION_DIR + "/" + comic['ComicName'] + " (" + comic['ComicYear'] + ")"
if ':' in comic['ComicName']:
comicdir = comic['ComicName'].replace(':','')
else: comicdir = comic['ComicName']
comlocation = mylar.DESTINATION_DIR + "/" + comicdir + " (" + comic['ComicYear'] + ")"
if mylar.DESTINATION_DIR == "":
logger.error(u"There is no general directory specified - please specify in Config/Post-Processing.")
return
#if mylar.REPLACE_SPACES == "yes":
if mylar.REPLACE_SPACES:
#mylar.REPLACE_CHAR ...determines what to replace spaces with underscore or dot
mylarREPLACE_CHAR = '_'
comlocation = comlocation.replace(' ', mylarREPLACE_CHAR)
comlocation = comlocation.replace(' ', mylar.REPLACE_CHAR)
#if it doesn't exist - create it (otherwise will bugger up later on)
if os.path.isdir(str(comlocation)):
logger.info(u"Directory (" + str(comlocation) + ") already exists! Continuing...")
@ -234,6 +236,8 @@ def addComictoDB(comicid):
tmpfc = fc['comiclist'][fn]
#print (str(int_issnum[n]) + " against ... " + str(tmpfc['ComicFilename']))
temploc = tmpfc['ComicFilename'].replace('_', ' ')
temploc = re.sub('\#', '', temploc)
fcnew = shlex.split(str(temploc))
fcn = len(fcnew)
som = 0

View File

@ -17,6 +17,7 @@ import time
from xml.dom.minidom import parseString
import urllib2
import shlex
import re
import mylar
from mylar import db, logger, helpers, filechecker
@ -135,6 +136,7 @@ def forceRescan(ComicID):
while (fn < fccnt):
tmpfc = fc['comiclist'][fn]
temploc = tmpfc['ComicFilename'].replace('_', ' ')
temploc = re.sub('\#', '', temploc)
if 'annual' not in temploc:
fcnew = shlex.split(str(temploc))
fcn = len(fcnew)

View File

@ -1,17 +1,17 @@
# This file is part of Headphones.
# This file is part of Mylar.
#
# Headphones is free software: you can redistribute it and/or modify
# 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.
#
# Headphones is distributed in the hope that it will be useful,
# 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 Headphones. If not, see <http://www.gnu.org/licenses/>.
# along with Mylar. If not, see <http://www.gnu.org/licenses/>.
import os
import cherrypy
@ -64,7 +64,10 @@ class WebInterface(object):
issues = myDB.select('SELECT * from issues WHERE ComicID=? order by Int_IssueNumber DESC', [ComicID])
if comic is None:
raise cherrypy.HTTPRedirect("home")
return serve_template(templatename="artistredone.html", title=comic['ComicName'], comic=comic, issues=issues)
comicConfig = {
"comiclocation" : mylar.COMIC_LOCATION
}
return serve_template(templatename="artistredone.html", title=comic['ComicName'], comic=comic, issues=issues, comicConfig=comicConfig)
artistPage.exposed = True
def searchit(self, name, issue=None, mode=None):
@ -415,6 +418,8 @@ class WebInterface(object):
"dognzb_api" : mylar.DOGNZB_APIKEY,
"use_experimental" : helpers.checked(mylar.EXPERIMENTAL),
"destination_dir" : mylar.DESTINATION_DIR,
"replace_spaces" : helpers.checked(mylar.REPLACE_SPACES),
"replace_char" : mylar.REPLACE_CHAR,
"interface_list" : interface_list,
"autowant_all" : helpers.checked(mylar.AUTOWANT_ALL),
"autowant_upcoming" : helpers.checked(mylar.AUTOWANT_UPCOMING),
@ -431,33 +436,35 @@ class WebInterface(object):
return serve_template(templatename="config.html", title="Settings", config=config)
config.exposed = True
def comic_configUpdate(self, comic_location, qual_altvers, qual_scanner, qual_type, qual_quality):
def comicConfigUpdate(self, comiclocation=None):
print ("YO")
mylar.COMIC_LOCATION = comic_location
mylar.QUAL_ALTVERS = qual_altvers
mylar.QUAL_SCANNER = qual_scanner
mylar.QUAL_TYPE = qual_type
mylar.QUAL_QUALITY = qual_quality
print ("ComicID:" + ComicID)
print ("LOC:" + str(comic_location))
print ("ALT:" + str(qual_altvers))
myDB = db.DBConnection()
controlValueDict = {'ComicID': ComicID}
newValues = {"ComicLocation": comic_location,
"QUALalt_vers": qual_altvers,
"QUALScanner": qual_scanner,
"QUALtype": qual_type,
"QUALquality": qual_quality
}
myDB.upsert("comics", newValues, controlValueDict)
comic_configUpdate.exposed = True
#mylar.COMIC_LOCATION = comiclocation
#mylar.QUAL_ALTVERS = qualaltvers
#mylar.QUAL_SCANNER = qualscanner
#mylar.QUAL_TYPE = qualtype
#mylar.QUAL_QUALITY = qualquality
#print ("ComicID:" + ComicID)
print ("LOC:" + str(comiclocation))
#print ("ALT:" + str(qualaltvers))
#myDB = db.DBConnection()
#controlValueDict = {'ComicID': ComicID}
#newValues = {"ComicLocation": comic_location,
# "QUALalt_vers": qual_altvers,
# "QUALScanner": qual_scanner,
# "QUALtype": qual_type,
# "QUALquality": qual_quality
# }
#myDB.upsert("comics", newValues, controlValueDict)
raise cherrypy.HTTPRedirect("home")
comicConfigUpdate.exposed = True
def configUpdate(self, http_host='0.0.0.0', http_username=None, http_port=8181, http_password=None, launch_browser=0, download_scan_interval=None, nzb_search_interval=None, libraryscan_interval=None,
sab_host=None, sab_username=None, sab_apikey=None, sab_password=None, sab_category=None, log_dir=None, blackhole=0, blackhole_dir=None,
usenet_retention=None, nzbsu=0, nzbsu_apikey=None, dognzb=0, dognzb_apikey=None,
raw=0, raw_provider=None, raw_username=None, raw_password=None, raw_groups=None, experimental=0,
preferred_quality=0, move_files=0, rename_files=0, folder_format=None, file_format=None,
destination_dir=None, autowant_all=0, autowant_upcoming=0, interface=None):
destination_dir=None, replace_spaces=0, replace_char=None, autowant_all=0, autowant_upcoming=0, interface=None):
mylar.HTTP_HOST = http_host
mylar.HTTP_PORT = http_port
mylar.HTTP_USERNAME = http_username
@ -487,6 +494,8 @@ class WebInterface(object):
mylar.PREFERRED_QUALITY = int(preferred_quality)
mylar.MOVE_FILES = move_files
mylar.RENAME_FILES = rename_files
mylar.REPLACE_SPACES = replace_spaces
mylar.REPLACE_CHAR = replace_char
mylar.FOLDER_FORMAT = folder_format
mylar.FILE_FORMAT = file_format
mylar.DESTINATION_DIR = destination_dir