Subversion Repositories programming

Compare Revisions

Ignore whitespace Rev 151 → Rev 152

/shell_programs/rarslave.py
50,6 → 50,10
# someone finds a bug, they can output this and send it to me with a
# description of the bug they're seeing.
#
# - 2005-11-05
# - Added an output system to rarslave. This makes a nice status report
# possible at the end of the program run.
#
 
################################################################################
# REQUIREMENTS:
175,6 → 179,109
config = rarslave_config()
 
################################################################################
# The rarslave_output class
#
# This class handles the nice output summary which is printed at the end
# of a run
################################################################################
 
class rarslave_output:
# Data structure: list of lists
# [ [status, filename], ... ]
#
# Where status is one of:
# 0: Verified and Extracted Perfectly
# 1: Failed to Verify (and therefore Extract)
# 2: Verified correctly, but failed to Extract
#
 
def __init__(self):
self.output_list = []
self.good_files = 0
self.unverified = 0
self.unextractable = 0
self.corrupt_par2 = 0
 
def print_equal_line(self, size=80):
"""Print an 80 character line of equal signs"""
 
str = ''
 
for i in range(size):
str += '='
 
print str
 
def print_results_table(self):
"""Print a nice table of the results from this run"""
 
# Print the table of good files (if we have any)
if self.good_files > 0:
print
self.print_equal_line()
print 'Files that were extracted perfectly'
self.print_equal_line()
 
for entry in self.output_list:
if entry[0] == 0:
print '%s' % (entry[1], )
 
# Print the table of unverified files (if we have any)
if self.unverified > 0:
print
self.print_equal_line()
print 'Files that failed to verify (and extract)'
self.print_equal_line()
 
for entry in self.output_list:
if entry[0] == 1:
print '%s' % (entry[1], )
 
# Print the table of unextracted files (if we have any)
if self.unextractable > 0:
print
self.print_equal_line()
print 'Files that were verified, but failed to extract'
self.print_equal_line()
 
for entry in self.output_list:
if entry[0] == 2:
print '%s' % (entry[1], )
 
# Print the table of corrupt PAR2 files (if we have any)
if self.corrupt_par2 > 0:
print
self.print_equal_line()
print 'Files that had corrupt par2 files'
self.print_equal_line()
 
for entry in self.output_list:
if entry[0] == 3:
print '%s' % (entry[1], )
 
# Print a blank line at the end
print
 
def add_file(self, status, filename):
 
if status == 0:
self.good_files += 1
elif status == 1:
self.unverified += 1
elif status == 2:
self.unextractable += 1
elif status == 3:
self.corrupt_par2 += 1
else:
# We have a bad value, so raise a ValueError
raise ValueError
 
self.output_list.append([status, filename])
 
# This is the global output variable
output = rarslave_output()
 
################################################################################
# The PAR2 Parser
#
# This was stolen from cfv (see http://cfv.sourceforge.net/ for a copy)
294,9 → 401,9
print 'extra_pars: %s' % (self.extra_pars, )
print 'files: %s' % (self.files, )
print '========== DEBUG INFO ENDS HERE =========='
 
def get_filenames(self):
return get_par2_filenames(parfile)
return get_par2_filenames(self.parfile)
 
def all_there(self):
"""Check if all the files for the parset are present.
427,7 → 534,7
"""Attempt to extract all of the files related to this parset"""
if not self.verified:
self.extracted = False
print 'Not (successfully) verified, not extracting'
output.add_file(1, self.parfile)
return False #failed to extract
 
extract_file = self.__get_extract_file()
439,7 → 546,7
retval = os.system('rar e -o+ "%s"' % (extract_file, ))
 
if retval != 0:
print 'Failed to extract'
output.add_file(2, self.parfile)
self.extracted = False
return self.extracted
 
447,6 → 554,8
self.extracted = True
self.__remove_currentset()
 
output.add_file(0, self.parfile)
 
return self.extracted
 
 
497,7 → 606,7
filenames = get_par2_filenames(i)
create_new = True
except EnvironmentError:
print 'CORRUPT PARFILE: %s' % (i, )
output.add_file(3, i)
continue
 
# if we already have an instance for this set, append
531,7 → 640,7
 
# No debug info
else:
 
# Verify each parset
for p in parsets:
p.verify()
599,6 → 708,9
else:
directory_worker(options.work_dir, options)
 
# Print the results
output.print_results_table()
 
if __name__ == '__main__':
main()
 
/shell_programs/animesorter.dict
18,6 → 18,7
\[AnY\]_Girls_Bravo_Second_Season_-_.+_\[.+\].avi = Girls Bravo
\[SEED-Fansubs\]_Gundam_SEED_Destiny_-_.+.avi = Gundam Seed Destiny
\[Shinsen-Subs\]_Gun_X_Sword_-_.+_\[.+\].avi = Gun X Sword
\[Himitsu\]_Happy_Seven_-_.+_\[.+\].avi = Happy Seven
\[AnY\]_He_is_My_Master_-_.+_\[.+\].avi = He is my Master
\[Ayu-r0ri\]_He_is_My_Master_.+_\[.+\].avi = He is my Master
\[AnY-Nanashi\]_Ichigo_Mashimaro_-_.+_\[.+\].avi = Ichigo Mashimaro
28,6 → 29,8
Kaleido_Star_-_.+_\[Freedom-Rise\]_\[.+\].avi = Kaleido Star
Kamichu\!-.+_HDTV_720p_\[.+\].mkv = Kamichu
Kamichu\!-.+_FAKEHDTV_720p_\[.+\]\.mkv = Kamichu
Kamichu!_-_DVD_.+_[iitran].avi = Kamichu
Kannazuki_no_Miko_-_.+_\[SS\]\.avi = Kannazuki no Miko
\[Triad\]_Magical_Girl_Lyrical_Nanoha_A's_-_.+\.avi = Magical Girl Lyrical Nanoha A's
\[Froth-Bite\]Mahoraba_Heartful_Days_-_.+\[.+\].avi = Mahoraba Heartful Days
\[AnCo\]Mahou_Sensei_Negima_-_.+_\[.+\].avi = Mahou Sensei Negima