keep original file name
This commit is contained in:
parent
2ad28d1958
commit
2b5ab1fcc4
@ -25,7 +25,8 @@ def get_jpg_info(fpath):
|
||||
size = os.path.getsize(fpath)
|
||||
|
||||
photo = Photo(hash=get_hash(fpath), path=fpath, format=mime, size=size,
|
||||
width=dimensions[0], height=dimensions[1], orientation=orientation)
|
||||
width=dimensions[0], height=dimensions[1],
|
||||
orientation=orientation, fname=os.path.basename(fpath))
|
||||
return PhotoSet(date=date, date_real=date, lat=lat, lon=lon, files=[photo])
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ def get_photosets(files):
|
||||
# process raws
|
||||
for item in chain(*[byext[ext] for ext in files_raw]):
|
||||
itemmeta = Photo(hash=get_hash(item), path=item, size=os.path.getsize(item),
|
||||
format=special_magic(item))
|
||||
format=special_magic(item), fname=os.path.basename(item))
|
||||
fprefix = os.path.basename(item)[::-1].split(".", 1)[-1][::-1]
|
||||
fmatch = "{}.jpg".format(fprefix.lower()) # if we're inspecting "foobar.raw", match it with "foobar.jpg"
|
||||
# TODO does this account for extension mappinh like jpeg->jpg?
|
||||
@ -80,7 +80,7 @@ def get_photosets(files):
|
||||
# process other known formats
|
||||
for item in chain(*[byext[ext] for ext in files_video]):
|
||||
itemmeta = Photo(hash=get_hash(item), path=item, size=os.path.getsize(item),
|
||||
format=special_magic(item))
|
||||
format=special_magic(item), fname=os.path.basename(item))
|
||||
mtime = get_mtime(item)
|
||||
photosets.append(PhotoSet(date=mtime, date_real=mtime, files=[itemmeta]))
|
||||
|
||||
|
@ -92,10 +92,11 @@ class Photo(Base):
|
||||
hash = Column(String(length=64), unique=True)
|
||||
path = Column(Unicode)
|
||||
format = Column(String(length=64)) # TODO how long can a mime string be
|
||||
fname = Column(String(length=64)) # seems generous enough
|
||||
|
||||
def to_json(self):
|
||||
j = {attr: getattr(self, attr) for attr in
|
||||
{"uuid", "size", "width", "height", "orientation", "format", "hash"}}
|
||||
{"uuid", "size", "width", "height", "orientation", "format", "hash", "fname"}}
|
||||
j["set"] = self.set.uuid if self.set else None
|
||||
return j
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
<li>
|
||||
<strong>Versions:</strong> {{ image.files|length }}
|
||||
</li>
|
||||
{% if image.lat != 0 %}
|
||||
{% if image.lat %}
|
||||
<li>
|
||||
<strong>Coordinates:</strong> <a href="/map?zoom=13&i={{ image.uuid }}">{{ image.lat }}, {{ image.lon }}</a>
|
||||
</li>
|
||||
@ -65,7 +65,10 @@
|
||||
</a>
|
||||
<div class="pure-u-3-4">
|
||||
<div>
|
||||
{{ img.uuid }}
|
||||
{{ img.uuid }}
|
||||
</div>
|
||||
<div>
|
||||
{{ img.fname }}
|
||||
</div>
|
||||
<div>
|
||||
{{ img.path | basename }}
|
||||
|
Loading…
Reference in New Issue
Block a user