mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 03:20:17 +01:00
Fix for extension detection, corrected basename for similar files
This commit is contained in:
@@ -63,7 +63,8 @@ class File(Base):
|
||||
self.source = src
|
||||
|
||||
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):
|
||||
"""
|
||||
|
||||
@@ -21,9 +21,9 @@ from pygtktalog.video import Video
|
||||
LOG = get_logger(__name__)
|
||||
RE_FN_START = re.compile(r'(?P<fname_start>'
|
||||
r'(\[[^\]]*\]\s)?'
|
||||
r'(.*)\s'
|
||||
r'([^(]*)\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")
|
||||
|
||||
if ftype == TYPE['link']:
|
||||
fname = fname + " -> " + os.readlink(fullpath)
|
||||
fname = fname + " -> " + os.readlink(fullpath).decode('utf-8')
|
||||
|
||||
fob = {'filename': fname,
|
||||
'path': path,
|
||||
@@ -389,7 +389,7 @@ class Scan(object):
|
||||
result = RE_FN_START.match(fname)
|
||||
test_ = False
|
||||
|
||||
if result and extension in ('jpg', 'gif', 'png'):
|
||||
if result and extension in ('.jpg', '.gif', '.png'):
|
||||
startfrom = result.groupdict()['fname_start']
|
||||
matching_files = []
|
||||
for fn_ in os.listdir(root):
|
||||
|
||||
Reference in New Issue
Block a user