1
0
mirror of https://github.com/gryf/pygtktalog.git synced 2025-12-17 11:30:19 +01:00

Fix for extension detection, corrected basename for similar files

This commit is contained in:
2016-09-18 12:47:40 +02:00
parent 577b93b534
commit a87da6b27c
2 changed files with 6 additions and 5 deletions

View File

@@ -63,7 +63,8 @@ class File(Base):
self.source = src self.source = src
def __repr__(self): def __repr__(self):
return "<File('%s', %s)>" % (str(self.filename), str(self.id)) return "<File('%s', %s)>" % (self.filename.encode('utf-8'),
str(self.id))
def get_all_children(self): def get_all_children(self):
""" """

View File

@@ -21,9 +21,9 @@ from pygtktalog.video import Video
LOG = get_logger(__name__) LOG = get_logger(__name__)
RE_FN_START = re.compile(r'(?P<fname_start>' RE_FN_START = re.compile(r'(?P<fname_start>'
r'(\[[^\]]*\]\s)?' r'(\[[^\]]*\]\s)?'
r'(.*)\s' r'([^(]*)\s'
r'((\(\d{4}\))\s)?).*' r'((\(\d{4}\))\s)?).*'
r'(\[[A-Z0-9]{8}\])\..*') r'(\[[A-Fa-f0-9]{8}\])\..*')
@@ -293,7 +293,7 @@ class Scan(object):
errors="replace") errors="replace")
if ftype == TYPE['link']: if ftype == TYPE['link']:
fname = fname + " -> " + os.readlink(fullpath) fname = fname + " -> " + os.readlink(fullpath).decode('utf-8')
fob = {'filename': fname, fob = {'filename': fname,
'path': path, 'path': path,
@@ -389,7 +389,7 @@ class Scan(object):
result = RE_FN_START.match(fname) result = RE_FN_START.match(fname)
test_ = False test_ = False
if result and extension in ('jpg', 'gif', 'png'): if result and extension in ('.jpg', '.gif', '.png'):
startfrom = result.groupdict()['fname_start'] startfrom = result.groupdict()['fname_start']
matching_files = [] matching_files = []
for fn_ in os.listdir(root): for fn_ in os.listdir(root):