diff options
| author | jvoisin | 2013-03-06 13:23:52 +0100 |
|---|---|---|
| committer | jvoisin | 2013-03-06 13:23:52 +0100 |
| commit | b7848465cb833c36843921e32fa4903fe2bc73f4 (patch) | |
| tree | 19a9a57baa0239217ddddca171083e8a436e5d81 /MAT | |
| parent | 16487c064343d6d0f710d7b0ca8f7060b4289528 (diff) | |
Some minor syntastic sugar
Diffstat (limited to 'MAT')
| -rw-r--r-- | MAT/archive.py | 11 | ||||
| -rw-r--r-- | MAT/misc.py | 4 | ||||
| -rw-r--r-- | MAT/parser.py | 2 | ||||
| -rw-r--r-- | MAT/strippers.py | 2 |
4 files changed, 9 insertions, 10 deletions
diff --git a/MAT/archive.py b/MAT/archive.py index 1dcddef..8127665 100644 --- a/MAT/archive.py +++ b/MAT/archive.py | |||
| @@ -47,16 +47,15 @@ class ZipStripper(GenericArchiveStripper): | |||
| 47 | Check if a ZipInfo object is clean of metadatas added | 47 | Check if a ZipInfo object is clean of metadatas added |
| 48 | by zip itself, independently of the corresponding file metadatas | 48 | by zip itself, independently of the corresponding file metadatas |
| 49 | ''' | 49 | ''' |
| 50 | if fileinfo.comment != '': | 50 | if fileinfo.comment: |
| 51 | return False | 51 | return False |
| 52 | elif fileinfo.date_time != 0: | 52 | elif fileinfo.date_time: |
| 53 | return False | 53 | return False |
| 54 | elif fileinfo.create_system != 0: | 54 | elif fileinfo.create_system: |
| 55 | return False | 55 | return False |
| 56 | elif fileinfo.create_version != 0: | 56 | elif fileinfo.create_version: |
| 57 | return False | 57 | return False |
| 58 | else: | 58 | return True |
| 59 | return True | ||
| 60 | 59 | ||
| 61 | def is_clean(self): | 60 | def is_clean(self): |
| 62 | ''' | 61 | ''' |
diff --git a/MAT/misc.py b/MAT/misc.py index 28ee892..582f34e 100644 --- a/MAT/misc.py +++ b/MAT/misc.py | |||
| @@ -24,7 +24,7 @@ class TorrentStripper(parser.GenericParser): | |||
| 24 | decoded = bencode.bdecode(f.read()) | 24 | decoded = bencode.bdecode(f.read()) |
| 25 | for key in self.fields: | 25 | for key in self.fields: |
| 26 | try: | 26 | try: |
| 27 | if decoded[key] != '': | 27 | if decoded[key]: |
| 28 | return False | 28 | return False |
| 29 | except KeyError: | 29 | except KeyError: |
| 30 | pass | 30 | pass |
| @@ -39,7 +39,7 @@ class TorrentStripper(parser.GenericParser): | |||
| 39 | decoded = bencode.bdecode(f.read()) | 39 | decoded = bencode.bdecode(f.read()) |
| 40 | for key in self.fields: | 40 | for key in self.fields: |
| 41 | try: | 41 | try: |
| 42 | if decoded[key] != '': | 42 | if decoded[key]: |
| 43 | metadata[key] = decoded[key] | 43 | metadata[key] = decoded[key] |
| 44 | except KeyError: | 44 | except KeyError: |
| 45 | pass | 45 | pass |
diff --git a/MAT/parser.py b/MAT/parser.py index e5acbf8..d6b7faf 100644 --- a/MAT/parser.py +++ b/MAT/parser.py | |||
| @@ -101,7 +101,7 @@ class GenericParser(object): | |||
| 101 | ''' | 101 | ''' |
| 102 | for field in fieldset: | 102 | for field in fieldset: |
| 103 | remove = self._should_remove(field) | 103 | remove = self._should_remove(field) |
| 104 | if remove is True: | 104 | if remove: |
| 105 | try: | 105 | try: |
| 106 | metadata[field.name] = field.value | 106 | metadata[field.name] = field.value |
| 107 | except: | 107 | except: |
diff --git a/MAT/strippers.py b/MAT/strippers.py index 2bd17e1..bde58ca 100644 --- a/MAT/strippers.py +++ b/MAT/strippers.py | |||
| @@ -60,7 +60,7 @@ try: | |||
| 60 | import exiftool | 60 | import exiftool |
| 61 | STRIPPERS['image/jpeg'] = exiftool.JpegStripper | 61 | STRIPPERS['image/jpeg'] = exiftool.JpegStripper |
| 62 | STRIPPERS['image/png'] = exiftool.PngStripper | 62 | STRIPPERS['image/png'] = exiftool.PngStripper |
| 63 | except OSError: # if exiftool is not installed, use hachoir | 63 | except OSError: # if exiftool is not installed, use hachoir instead |
| 64 | print('Unable to find exiftool: limited images support') | 64 | print('Unable to find exiftool: limited images support') |
| 65 | STRIPPERS['image/jpeg'] = images.JpegStripper | 65 | STRIPPERS['image/jpeg'] = images.JpegStripper |
| 66 | STRIPPERS['image/png'] = images.PngStripper | 66 | STRIPPERS['image/png'] = images.PngStripper |
