[gnome-music: 2/11] Merge regex for blocks in stripping
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music: 2/11] Merge regex for blocks in stripping
- Date: Fri, 26 Jul 2013 14:11:20 +0000 (UTC)
commit ac0540106538fe631dc630140b9ee754f9efca13
Author: Arnel A. Borja <arnelborja src gnome org>
Date: Wed Jul 24 20:17:14 2013 +0800
Merge regex for blocks in stripping
gnomemusic/albumArtCache.py | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)
---
diff --git a/gnomemusic/albumArtCache.py b/gnomemusic/albumArtCache.py
index 30ca722..47f2bb9 100644
--- a/gnomemusic/albumArtCache.py
+++ b/gnomemusic/albumArtCache.py
@@ -13,10 +13,7 @@ class AlbumArtCache:
instance = None
degrees = pi / 180
- brackets = re.compile('\[(.*?)\]', re.DOTALL)
- curly_brackets = re.compile('\{(.*?)\}', re.DOTALL)
- angle_brackets = re.compile('\<(.*?)\>', re.DOTALL)
- parentheses = re.compile('\((.*?)\)', re.DOTALL)
+ blocks = re.compile('(\[(.*?)\]|\{(.*?)\}|\<(.*?)\>|\((.*?)\))', re.DOTALL)
invalid_chars = re.compile('[()<>\[\]{}_! #$^&*+=|\\\/"\'?~]', re.DOTALL)
multiple_spaces = re.compile('\t|\s+', re.DOTALL)
@@ -233,10 +230,7 @@ class AlbumArtCache:
def _strip_invalid_entities(self, original):
# Strip blocks
- string = self.brackets.sub('', original)
- string = self.curly_brackets.sub('', string)
- string = self.angle_brackets.sub('', string)
- string = self.parentheses.sub('', string)
+ string = self.blocks.sub('', original)
# Strip invalid chars
string = self.invalid_chars.sub('', string)
# Remove double spaces
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]