2013-07-01 05:19:15 +00:00
# This script was taken almost entirely from Manders2600 Script with the use of the awesome ComicTagger.
# modified very slightly so Mylar just passes it the IssueID for it to do it's magic.
2014-04-14 18:10:10 +00:00
import os , errno
2013-07-01 05:19:15 +00:00
import sys
2013-08-21 02:33:57 +00:00
import re
2013-07-01 05:19:15 +00:00
import glob
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
import shlex
2013-07-01 05:19:15 +00:00
import platform
import shutil
2013-07-30 04:57:37 +00:00
import time
2013-07-01 05:19:15 +00:00
import zipfile
import subprocess
2013-08-04 05:57:21 +00:00
from subprocess import CalledProcessError , check_output
2013-07-01 05:19:15 +00:00
import mylar
from mylar import logger
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
from mylar . helpers import cvapi_check
2013-07-01 05:19:15 +00:00
2015-01-16 19:40:08 +00:00
def run ( dirName , nzbName = None , issueid = None , comversion = None , manual = None , filename = None , module = None ) :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
if module is None :
module = ' '
module + = ' [META-TAGGER] '
logger . fdebug ( module + ' dirName: ' + dirName )
2013-07-01 05:19:15 +00:00
## Set the directory in which comictagger and other external commands are located - IMPORTANT - ##
# ( User may have to modify, depending on their setup, but these are some guesses for now )
2014-10-14 07:31:49 +00:00
2013-07-01 05:19:15 +00:00
if platform . system ( ) == " Windows " :
2014-06-15 05:10:45 +00:00
#if it's a source install.
2014-10-29 18:23:33 +00:00
sys_type = ' windows '
2014-06-15 05:10:45 +00:00
if os . path . isdir ( os . path . join ( mylar . CMTAGGER_PATH , ' .git ' ) ) :
comictagger_cmd = os . path . join ( mylar . CMTAGGER_PATH , ' comictagger.py ' )
2013-07-01 05:19:15 +00:00
else :
2014-06-15 05:10:45 +00:00
#regardless of 32/64 bit install
if ' comictagger.exe ' in mylar . CMTAGGER_PATH :
comictagger_cmd = mylar . CMTAGGER_PATH
else :
comictagger_cmd = os . path . join ( mylar . CMTAGGER_PATH , ' comictagger.exe ' )
2014-10-29 04:46:57 +00:00
if mylar . UNRAR_CMD == ' None ' or mylar . UNRAR_CMD == ' ' or mylar . UNRAR_CMD is None :
2014-10-14 07:31:49 +00:00
unrar_cmd = " C: \ Program Files \ WinRAR \ UnRAR.exe "
else :
unrar_cmd = mylar . UNRAR_CMD . strip ( )
2013-07-30 04:57:37 +00:00
# test for UnRAR
if not os . path . isfile ( unrar_cmd ) :
unrar_cmd = " C: \ Program Files (x86) \ WinRAR \ UnRAR.exe "
if not os . path . isfile ( unrar_cmd ) :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' Unable to locate UnRAR.exe - make sure it is installed. ' )
logger . fdebug ( module + ' Aborting meta-tagging. ' )
2013-07-30 04:57:37 +00:00
return " fail "
2014-10-14 07:31:49 +00:00
logger . fdebug ( module + ' UNRAR path set to : ' + unrar_cmd )
2013-07-01 05:19:15 +00:00
2014-10-29 18:23:33 +00:00
elif platform . system ( ) == " Darwin " :
#Mac OS X
sys_type = ' mac '
2013-08-04 05:57:21 +00:00
comictagger_cmd = os . path . join ( mylar . CMTAGGER_PATH , ' comictagger.py ' )
2014-10-29 04:46:57 +00:00
if mylar . UNRAR_CMD == ' None ' or mylar . UNRAR_CMD == ' ' or mylar . UNRAR_CMD is None :
2014-10-14 07:31:49 +00:00
unrar_cmd = " /usr/local/bin/unrar "
else :
unrar_cmd = mylar . UNRAR_CMD . strip ( )
logger . fdebug ( module + ' UNRAR path set to : ' + unrar_cmd )
2013-07-01 05:19:15 +00:00
else :
2013-07-30 04:57:37 +00:00
#for the 'nix
2014-10-29 18:23:33 +00:00
sys_type = ' linux '
2014-10-29 04:46:57 +00:00
if mylar . UNRAR_CMD == ' None ' or mylar . UNRAR_CMD == ' ' or mylar . UNRAR_CMD is None :
2014-10-14 07:31:49 +00:00
if ' freebsd ' in platform . linux_distribution ( ) [ 0 ] . lower ( ) :
unrar_cmd = " /usr/local/bin/unrar "
else :
unrar_cmd = " /usr/bin/unrar "
2014-09-10 06:39:15 +00:00
else :
2014-10-14 07:31:49 +00:00
unrar_cmd = mylar . UNRAR_CMD . strip ( )
logger . fdebug ( module + ' UNRAR path set to : ' + unrar_cmd )
2013-07-30 04:57:37 +00:00
#check for dependencies here - configparser
try :
import configparser
except ImportError :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' configparser not found on system. Please install manually in order to write metadata ' )
logger . fdebug ( module + ' continuing with PostProcessing, but I am not using metadata. ' )
2013-07-30 04:57:37 +00:00
return " fail "
2013-07-01 05:19:15 +00:00
#set this to the lib path (ie. '<root of mylar>/lib')
comictagger_cmd = os . path . join ( mylar . CMTAGGER_PATH , ' comictagger.py ' )
# if not os.path.exists( comictagger_cmd ):
# print "ERROR: can't find the ComicTagger program: {0}".format( comictagger_cmd )
# print " You probably need to edit this script!"
# sys.exit( 1 )
file_conversion = True
file_extension_fixing = True
if not os . path . exists ( unrar_cmd ) :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' WARNING: cannot find the unrar command. ' )
logger . fdebug ( module + ' File conversion and extension fixing not available ' )
logger . fdebug ( module + ' You probably need to edit this script, or install the missing tool, or both! ' )
2014-10-14 07:31:49 +00:00
return " fail "
#file_conversion = False
#file_extension_fixing = False
2013-07-01 05:19:15 +00:00
## Sets up other directories ##
scriptname = os . path . basename ( sys . argv [ 0 ] )
downloadpath = os . path . abspath ( dirName )
sabnzbdscriptpath = os . path . dirname ( sys . argv [ 0 ] )
if manual is None :
comicpath = os . path . join ( downloadpath , " temp " )
else :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
chkpath , chkfile = os . path . split ( filename )
logger . fdebug ( module + ' chkpath: ' + chkpath )
logger . fdebug ( module + ' chkfile: ' + chkfile )
extensions = ( ' .cbr ' , ' .cbz ' )
if os . path . isdir ( chkpath ) and chkpath != downloadpath :
logger . fdebug ( module + ' Changing ' + downloadpath + ' location to ' + chkpath + ' as it is a directory. ' )
downloadpath = chkpath
2013-07-01 05:19:15 +00:00
comicpath = os . path . join ( downloadpath , issueid )
unrar_folder = os . path . join ( comicpath , " unrard " )
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' Paths / Locations: ' )
logger . fdebug ( module + ' scriptname : ' + scriptname )
logger . fdebug ( module + ' downloadpath : ' + downloadpath )
logger . fdebug ( module + ' sabnzbdscriptpath : ' + sabnzbdscriptpath )
logger . fdebug ( module + ' comicpath : ' + comicpath )
logger . fdebug ( module + ' unrar_folder : ' + unrar_folder )
logger . fdebug ( module + ' Running the ComicTagger Add-on for Mylar ' )
2013-07-01 05:19:15 +00:00
if os . path . exists ( comicpath ) :
shutil . rmtree ( comicpath )
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' Attempting to create directory @: ' + str ( comicpath ) )
2014-04-14 18:10:10 +00:00
try :
os . makedirs ( comicpath )
except OSError :
raise
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' Created directory @ : ' + str ( comicpath ) )
logger . fdebug ( module + ' Filename is : ' + str ( filename ) )
2015-01-19 05:11:59 +00:00
2013-07-01 05:19:15 +00:00
if filename is None :
filename_list = glob . glob ( os . path . join ( downloadpath , " *.cbz " ) )
filename_list . extend ( glob . glob ( os . path . join ( downloadpath , " *.cbr " ) ) )
2013-12-30 19:30:50 +00:00
fcount = 1
2013-07-01 05:19:15 +00:00
for f in filename_list :
2013-12-30 19:30:50 +00:00
if fcount > 1 :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' More than one cbr/cbz within path, performing Post-Process on first file detected: ' + f )
2013-12-30 19:30:50 +00:00
break
2015-01-16 19:40:08 +00:00
if f . endswith ( ' .cbz ' ) :
logger . fdebug ( module + ' .cbz file detected. Excluding from temporary directory move at this time. ' )
comicpath = downloadpath
else :
shutil . move ( f , comicpath )
2013-12-30 19:30:50 +00:00
filename = f #just the filename itself
fcount + = 1
else :
2014-06-15 05:10:45 +00:00
# if the filename is identical to the parent folder, the entire subfolder gets copied since it's the first match, instead of just the file
2015-01-16 19:40:08 +00:00
#if os.path.isfile(filename):
#if the filename doesn't exist - force the path assuming it's the 'download path'
filename = os . path . join ( downloadpath , filename )
logger . fdebug ( module + ' The path where the file is that I was provided is probably wrong - modifying it to : ' + filename )
2015-01-19 05:11:59 +00:00
shutil . move ( filename , os . path . join ( comicpath , os . path . split ( filename ) [ 1 ] ) )
logger . fdebug ( module + ' moving : ' + filename + ' to ' + os . path . join ( comicpath , os . path . split ( filename ) [ 1 ] ) )
2013-12-30 19:30:50 +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
try :
filename = os . path . split ( filename ) [ 1 ] # just the filename itself
except :
logger . warn ( ' Unable to detect filename within directory - I am aborting the tagging. You best check things out. ' )
return " fail "
2013-12-30 19:30:50 +00:00
#print comicpath
#print os.path.join( comicpath, filename )
if filename . endswith ( ' .cbr ' ) :
f = os . path . join ( comicpath , filename )
if zipfile . is_zipfile ( f ) :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' zipfile detected ' )
2013-12-30 19:30:50 +00:00
base = os . path . splitext ( f ) [ 0 ]
shutil . move ( f , base + " .cbz " )
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' {0} : renaming {1} to be a cbz ' . format ( scriptname , os . path . basename ( f ) ) )
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
filename = base + ' .cbz '
2013-12-30 19:30:50 +00:00
if file_extension_fixing :
if filename . endswith ( ' .cbz ' ) :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . info ( module + ' Filename detected as a .cbz file. ' )
2013-12-30 19:30:50 +00:00
f = os . path . join ( comicpath , filename )
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' filename : ' + f )
2013-12-30 19:30:50 +00:00
if os . path . isfile ( f ) :
2013-07-01 05:19:15 +00:00
try :
rar_test_cmd_output = " is not RAR archive " #default, in case of error
rar_test_cmd_output = subprocess . check_output ( [ unrar_cmd , " t " , f ] )
except :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' This is a zipfile. Unable to test rar. ' )
2013-07-01 05:19:15 +00:00
if not " is not RAR archive " in rar_test_cmd_output :
base = os . path . splitext ( f ) [ 0 ]
shutil . move ( f , base + " .cbr " )
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' {0} : renaming {1} to be a cbr ' . format ( scriptname , os . path . basename ( f ) ) )
else :
try :
with open ( f ) : pass
except :
logger . warn ( module + ' No zip file present ' )
return " fail "
2015-01-19 05:11:59 +00:00
#if the temp directory is the LAST directory in the path, it's part of the CT logic path above
#and can be removed to allow a copy back to the original path to work.
if ' temp ' in os . path . basename ( os . path . normpath ( comicpath ) ) :
pathbase = os . path . dirname ( os . path . dirname ( comicpath ) )
base = os . path . join ( pathbase , filename )
else :
base = os . path . join ( re . sub ( issueid , ' ' , comicpath ) , filename ) #extension is already .cbz
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' Base set to : ' + base )
logger . fdebug ( module + ' Moving : ' + f + ' - to - ' + base )
shutil . move ( f , base )
try :
with open ( base ) :
logger . fdebug ( module + ' Verified file exists in location: ' + base )
removetemp = True
except :
logger . fdebug ( module + ' Cannot verify file exist in location: ' + base )
removetemp = False
if removetemp == True :
if comicpath != downloadpath :
2014-10-29 04:46:57 +00:00
shutil . rmtree ( comicpath )
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' Successfully removed temporary directory: ' + comicpath )
else :
2015-01-16 19:40:08 +00:00
logger . fdebug ( module + ' Unable to remove temporary directory since it is identical to the download location : ' + comicpath )
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' new filename : ' + base )
nfilename = base
2013-12-30 19:30:50 +00:00
# Now rename all CBR files to RAR
if filename . endswith ( ' .cbr ' ) :
2014-04-14 18:10:10 +00:00
#logger.fdebug('renaming .cbr to .rar')
2013-12-30 19:30:50 +00:00
f = os . path . join ( comicpath , filename )
base = os . path . splitext ( f ) [ 0 ]
baserar = base + " .rar "
shutil . move ( f , baserar )
2013-07-01 05:19:15 +00:00
## Changes any cbr files to cbz files for insertion of metadata ##
if file_conversion :
2013-12-30 19:30:50 +00:00
f = os . path . join ( comicpath , filename )
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' {0} : converting {1} to be zip format ' . format ( scriptname , os . path . basename ( f ) ) )
2013-12-30 19:30:50 +00:00
basename = os . path . splitext ( f ) [ 0 ]
zipname = basename + " .cbz "
# Move into the folder where we will be unrar-ing things
os . makedirs ( unrar_folder )
os . chdir ( unrar_folder )
# Extract and zip up
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' {0} : Comicpath is ' + baserar ) #os.path.join(comicpath,basename))
logger . fdebug ( module + ' {0} : Unrar is ' + unrar_folder )
2013-12-30 19:30:50 +00:00
try :
#subprocess.Popen( [ unrar_cmd, "x", os.path.join(comicpath,basename) ] ).communicate()
2014-09-10 06:39:15 +00:00
output = subprocess . check_output ( [ unrar_cmd , ' x ' , baserar ] )
2013-12-30 19:30:50 +00:00
except CalledProcessError as e :
if e . returncode == 3 :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . warn ( module + ' [Unrar Error 3] - Broken Archive. ' )
2013-12-30 19:30:50 +00:00
elif e . returncode == 1 :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . warn ( module + ' [Unrar Error 1] - No files to extract. ' )
logger . warn ( module + ' Marking this as an incomplete download. ' )
2013-12-30 19:30:50 +00:00
return " unrar error "
shutil . make_archive ( basename , " zip " , unrar_folder )
# get out of unrar folder and clean up
os . chdir ( comicpath )
shutil . rmtree ( unrar_folder )
2013-07-01 05:19:15 +00:00
## Changes zip to cbz
2013-08-21 02:33:57 +00:00
2013-12-30 19:30:50 +00:00
f = os . path . join ( comicpath , os . path . splitext ( filename ) [ 0 ] + " .zip " )
#print "zipfile" + f
try :
with open ( f ) : pass
except :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . warn ( module + ' No zip file present: ' + f )
2013-12-30 19:30:50 +00:00
return " fail "
base = os . path . splitext ( f ) [ 0 ]
shutil . move ( f , base + " .cbz " )
nfilename = base + " .cbz "
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
#else:
# logger.fdebug(module + ' Filename:' + filename)
# nfilename = filename
#if os.path.isfile( nfilename ):
# logger.fdebug(module + ' File exists in given location already : ' + nfilename)
# file_dir, file_n = os.path.split(nfilename)
#else:
# #remove the IssueID from the path
# file_dir = re.sub(issueid, '', comicpath)
# file_n = os.path.split(nfilename)[1]
2014-06-25 15:32:54 +00:00
if manual is None :
file_dir = downloadpath
else :
file_dir = re . sub ( issueid , ' ' , comicpath )
2014-10-14 07:31:49 +00:00
try :
file_n = os . path . split ( nfilename ) [ 1 ]
except :
logger . error ( module + ' unable to retrieve filename properly. Check your logs as there is probably an error or misconfiguration indicated (such as unable to locate unrar or configparser) ' )
return " fail "
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' Converted directory: ' + str ( file_dir ) )
logger . fdebug ( module + ' Converted filename: ' + str ( file_n ) )
logger . fdebug ( module + ' Destination path: ' + os . path . join ( file_dir , file_n ) ) #dirName,file_n))
logger . fdebug ( module + ' dirName: ' + dirName )
logger . fdebug ( module + ' absDirName: ' + os . path . abspath ( dirName ) )
##set up default comictagger options here.
2015-01-16 19:40:08 +00:00
if comversion is None or comversion == ' ' :
2015-01-20 05:41:29 +00:00
comversion = ' 1 '
comversion = re . sub ( ' [^0-9] ' , ' ' , comversion ) . strip ( )
2015-01-16 19:40:08 +00:00
cvers = ' volume= ' + str ( comversion )
tagoptions = [ " -s " , " --verbose " , " -m " , cvers ]
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
2014-06-15 05:10:45 +00:00
## check comictagger version - less than 1.15.beta - take your chances.
2014-10-29 18:23:33 +00:00
if sys_type == ' windows ' :
ctversion = subprocess . check_output ( [ comictagger_cmd , " --version " ] )
else :
ctversion = subprocess . check_output ( [ sys . executable , comictagger_cmd , " --version " ] )
2014-06-15 05:10:45 +00:00
ctend = ctversion . find ( ' : ' )
ctcheck = re . sub ( " [^0-9] " , " " , ctversion [ : ctend ] )
ctcheck = re . sub ( ' \ . ' , ' ' , ctcheck ) . strip ( )
if int ( ctcheck ) > = int ( ' 1115 ' ) : #(v1.1.15)
if mylar . COMICVINE_API == mylar . DEFAULT_CVAPI :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' ' + ctversion [ : ctend ] + ' being used - no personal ComicVine API Key supplied. Take your chances. ' )
2014-06-15 05:10:45 +00:00
use_cvapi = " False "
else :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' ' + ctversion [ : ctend ] + ' being used - using personal ComicVine API key supplied via mylar. ' )
2014-06-15 05:10:45 +00:00
use_cvapi = " True "
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
tagoptions . extend ( [ " --cv-api-key " , mylar . COMICVINE_API ] )
2014-06-15 05:10:45 +00:00
else :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' ' + ctversion [ : ctend ] + ' being used - personal ComicVine API key not supported in this version. Good luck. ' )
2014-06-15 05:10:45 +00:00
use_cvapi = " False "
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
i = 1
tagcnt = 0
if mylar . CT_TAG_CR :
tagcnt = 1
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' CR Tagging enabled. ' )
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 mylar . CT_TAG_CBL :
if not mylar . CT_TAG_CR : i = 2 #set the tag to start at cbl and end without doing another tagging.
tagcnt = 2
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' CBL Tagging enabled. ' )
2014-06-15 05:10:45 +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 tagcnt == 0 :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . warn ( module + ' You have metatagging enabled, but you have not selected the type(s) of metadata to write. Please fix and re-run manually ' )
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
return " fail "
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
#if it's a cbz file - check if no-overwrite existing tags is enabled / disabled in config.
if nfilename . endswith ( ' .cbz ' ) :
if mylar . CT_CBZ_OVERWRITE :
logger . fdebug ( module + ' Will modify existing tag blocks even if it exists. ' )
else :
logger . fdebug ( module + ' Will NOT modify existing tag blocks even if they exist already. ' )
tagoptions . extend ( [ " --nooverwrite " ] )
if issueid is None :
tagoptions . extend ( [ " -f " , " -o " ] )
else :
tagoptions . extend ( [ " -o " , " --id " , issueid ] )
original_tagoptions = tagoptions
og_tagtype = None
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
while ( i < = tagcnt ) :
if i == 1 :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
tagtype = ' cr ' # CR meta-tagging cycle.
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
tagdisp = ' ComicRack tagging '
elif i == 2 :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
tagtype = ' cbl ' #Cbl meta-tagging cycle
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
tagdisp = ' Comicbooklover tagging '
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
f_tagoptions = original_tagoptions
if og_tagtype is not None :
for index , item in enumerate ( f_tagoptions ) :
if item == og_tagtype :
f_tagoptions [ index ] = tagtype
else :
f_tagoptions . extend ( [ " --type " , tagtype , nfilename ] )
og_tagtype = tagtype
logger . info ( module + ' ' + tagdisp + ' meta-tagging processing started. ' )
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
#CV API Check here.
if mylar . CVAPI_COUNT == 0 or mylar . CVAPI_COUNT > = 200 :
cvapi_check ( )
2014-10-29 18:23:33 +00:00
if sys_type == ' windows ' :
currentScriptName = str ( comictagger_cmd ) . decode ( " string_escape " )
else :
currentScriptName = sys . executable + ' ' + str ( comictagger_cmd ) . decode ( " string_escape " )
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' Enabling ComicTagger script: ' + str ( currentScriptName ) + ' with options: ' + str ( f_tagoptions ) )
# generate a safe command line string to execute the script and provide all the parameters
script_cmd = shlex . split ( currentScriptName , posix = False ) + f_tagoptions
# use subprocess to run the command and capture output
logger . fdebug ( module + ' Executing command: ' + str ( script_cmd ) )
logger . fdebug ( module + ' Absolute path to script: ' + script_cmd [ 0 ] )
try :
2014-09-10 06:39:15 +00:00
p = subprocess . Popen ( script_cmd )
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
out , err = p . communicate ( ) #@UnusedVariable
logger . fdebug ( module + ' [COMIC-TAGGER] : ' + str ( out ) )
logger . info ( module + ' [COMIC-TAGGER] Successfully wrote ' + tagdisp )
except OSError , e :
logger . warn ( module + ' [COMIC-TAGGER] Unable to run comictagger with the options provided: ' + str ( script_cmd ) )
2015-01-19 05:11:59 +00:00
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
#increment CV API counter.
mylar . CVAPI_COUNT + = 1
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
## Tag each CBZ, and move it back to original directory ##
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
#if use_cvapi == "True":
# if issueid is None:
# subprocess.Popen( [ comictagger_cmd, "-s", "-t", tagtype, "--cv-api-key", mylar.COMICVINE_API, "-f", "-o", "--verbose", "--nooverwrite", nfilename ] ).communicate()
# else:
# subprocess.Popen( [ comictagger_cmd, "-s", "-t", tagtype, "--cv-api-key", mylar.COMICVINE_API, "-o", "--id", issueid, "--verbose", nfilename ] ).communicate()
# logger.info(module + ' ' + tagdisp + ' meta-tagging complete')
# #increment CV API counter.
# mylar.CVAPI_COUNT +=1
#else:
# if issueid is None:
# subprocess.Popen( [ comictagger_cmd, "-s", "-t", tagtype, "-f", "-o", "--verbose", "--nooverwrite", nfilename ] ).communicate()
# else:
# subprocess.Popen( [ comictagger_cmd, "-s", "-t", tagtype, "-o", "--id", issueid, "--verbose", "--nooverwrite", nfilename ] ).communicate()
# #increment CV API counter.
# mylar.CVAPI_COUNT +=1
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
i + = 1
2013-07-01 05:19:15 +00:00
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
if os . path . exists ( os . path . join ( os . path . abspath ( file_dir ) , file_n ) ) : #(os.path.abspath(dirName),file_n)):
logger . fdebug ( module + ' Unable to move from temporary directory - file already exists in destination: ' + os . path . join ( os . path . abspath ( file_dir ) , file_n ) )
2013-12-30 19:30:50 +00:00
else :
2014-06-25 15:32:54 +00:00
try :
shutil . move ( os . path . join ( comicpath , nfilename ) , os . path . join ( os . path . abspath ( file_dir ) , file_n ) ) #os.path.abspath(dirName),file_n))
#shutil.move( nfilename, os.path.join(os.path.abspath(dirName),file_n))
logger . fdebug ( module + ' Sucessfully moved file from temporary path. ' )
except :
IMP: 32P legacy mode (rss feed only) and Auth mode (user/pass) available now. With Auth mode, will monitor all of personal notification feeds, IMP: Changed access methods to 32P for retrieving links, FIX:(#1007) Fixed error for one-off downloading via weekly pull list, FIX: (#1004) Fix for post-processing errors (missing files), FIX: (#1001) Extra scripts & pre-scripts will now accept bash scripts, FIX: Annuals were being incorrectly tallied in Have total as well as not having status correctly updated, IMP: Fixed some discrepencies with the provider_order generation line, IMP: Made some additional adjustments to the file-checking to account for some additional variations in naming, FIX: Fixed traceback errors when folder monitor was running and wouldn't be able to complete the post-processing properly, FIX: Cleanup code and some other small fixes....
2015-05-09 02:39:28 +00:00
logger . error ( module + ' Unable to move file from temporary path [ ' + os . path . join ( comicpath , nfilename ) + ' ]. Deletion of temporary path halted. ' )
2015-01-19 05:11:59 +00:00
logger . error ( module + ' attempt to move: ' + os . path . join ( comicpath , nfilename ) + ' to ' + os . path . join ( os . path . abspath ( file_dir ) , file_n ) )
IMP: 32P legacy mode (rss feed only) and Auth mode (user/pass) available now. With Auth mode, will monitor all of personal notification feeds, IMP: Changed access methods to 32P for retrieving links, FIX:(#1007) Fixed error for one-off downloading via weekly pull list, FIX: (#1004) Fix for post-processing errors (missing files), FIX: (#1001) Extra scripts & pre-scripts will now accept bash scripts, FIX: Annuals were being incorrectly tallied in Have total as well as not having status correctly updated, IMP: Fixed some discrepencies with the provider_order generation line, IMP: Made some additional adjustments to the file-checking to account for some additional variations in naming, FIX: Fixed traceback errors when folder monitor was running and wouldn't be able to complete the post-processing properly, FIX: Cleanup code and some other small fixes....
2015-05-09 02:39:28 +00:00
return os . path . join ( os . path . abspath ( file_dir ) , file_n ) #os.path.join(comicpath, nfilename)
2014-06-25 15:32:54 +00:00
2013-12-30 19:30:50 +00:00
i = 0
os . chdir ( mylar . PROG_DIR )
while i < 10 :
try :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' Attempting to remove: ' + comicpath )
2013-12-30 19:30:50 +00:00
shutil . rmtree ( comicpath )
except :
time . sleep ( .1 )
else :
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
return os . path . join ( os . path . abspath ( file_dir ) , file_n ) #dirName), file_n)
2013-12-30 19:30:50 +00:00
i + = 1
2013-07-01 05:19:15 +00:00
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
logger . fdebug ( module + ' Failed to remove temporary path : ' + str ( comicpath ) )
2013-07-01 05:19:15 +00:00
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
return os . path . join ( os . path . abspath ( file_dir ) , file_n ) #dirName),file_n)
2013-07-01 05:19:15 +00:00