Subversion Repositories programming

Rev

Rev 358 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 358 Rev 359
Line 40... Line 40...
40
          self.S_RAR_NEW,        # Single set of rars,   New style,   starting with .partDD.rar
40
          self.S_RAR_NEW,        # Single set of rars,   New style,   starting with .partDD.rar
41
          self.M_RAR_NEW,        # Multiple set of rars, New style,   starting with .partDD.rar
41
          self.M_RAR_NEW,        # Multiple set of rars, New style,   starting with .partDD.rar
42
 
42
 
43
        ) = range (13)      # WARNING: If adding types, increment this number appropriately
43
        ) = range (13)      # WARNING: If adding types, increment this number appropriately
44
 
44
 
-
 
45
        # Storage for regexes
-
 
46
        self.regexes = {
-
 
47
            self.UNKNOWN_TYPE : None,
-
 
48
            
-
 
49
            self.S_SPLIT_000 : '^.*\.000$',
-
 
50
            self.M_SPLIT_000 : '^.*\.000$',
-
 
51
            self.S_SPLIT_001 : '^.*\.001$',
-
 
52
            self.M_SPLIT_001 : '^.*\.001$',
-
 
53
 
-
 
54
            self.S_PROT_SPLIT_000 : '^.*\.000$',
-
 
55
            self.M_PROT_SPLIT_000 : '^.*\.000$',
-
 
56
            self.S_PROT_SPLIT_001 : '^.*\.001$',
-
 
57
            self.M_PROT_SPLIT_001 : '^.*\.001$',
-
 
58
 
-
 
59
            self.S_RAR_OLD : '^.*\.r00$',
-
 
60
            self.M_RAR_OLD : '^.*\.r00$',
-
 
61
            self.S_RAR_NEW : '^.*\.part0*1\.rar$',
-
 
62
            self.M_RAR_NEW : '^.*\.part0*1\.rar$',
-
 
63
        }
45
 
64
 
46
        self.Par2Parser = Par2Parser
65
        self.Par2Parser = Par2Parser
47
        self.type = self.UNKNOWN_TYPE
66
        self.type = self.__get_type ()
48
        self.heads = []
67
        self.heads = self.__get_extractable_files ()
49
 
68
 
50
    def __get_type (self):
69
    def __get_type (self):
51
        # This will return one of the enums above corresponding to the
70
        # This will return one of the enums above corresponding to the
52
        # best guess about what type of set we're trying to extract.
71
        # best guess about what type of set we're trying to extract.
53
        #
72
        #
Line 161... Line 180...
161
            return self.__apply_regex ('^.*\.part0*1\.rar$', self.Par2Parser.protected_files,
180
            return self.__apply_regex ('^.*\.part0*1\.rar$', self.Par2Parser.protected_files,
162
                    ignorecase=True)
181
                    ignorecase=True)
163
 
182
 
164
        return [] # Return nothing by default (this covers UNKNOWN_TYPE)
183
        return [] # Return nothing by default (this covers UNKNOWN_TYPE)
165
        
184
        
166
    def do_magic (self):
-
 
167
        """Do all the magic to fill our fields by classifying files
-
 
168
           and finding the extractable heads"""
-
 
169
        
-
 
170
        self.type = self.__get_type ()
-
 
171
        self.heads = self.__get_extractable_files ()
-
 
172
 
-
 
173
 
-
 
174
if __name__ == '__main__':
185
if __name__ == '__main__':
175
    pass
186
    pass