Updated path_derivatives to return results in sorted order (largest to smallest)
This commit is contained in:
parent
98b84c17f1
commit
f24e4a7e3c
@ -2263,7 +2263,7 @@ Returns the absolute path to the edited photo on disk as a string. If the photo
|
|||||||
**Note**: will also return None if the edited photo is missing on disk.
|
**Note**: will also return None if the edited photo is missing on disk.
|
||||||
|
|
||||||
#### `path_derivatives`
|
#### `path_derivatives`
|
||||||
Returns list of paths to any derivative preview images associated with the photo. These will be named something like this on Photos 5+:
|
Returns list of paths to any derivative preview images associated with the photo. The list of returned paths is sorted in descieding order by size (the largest, presumably highest quality) preview image will be the first element in the returned list. These will be named something like this on Photos 5+:
|
||||||
|
|
||||||
- `F19E06B8-A712-4B5C-907A-C007D37BDA16_1_101_o.jpeg`
|
- `F19E06B8-A712-4B5C-907A-C007D37BDA16_1_101_o.jpeg`
|
||||||
- `F19E06B8-A712-4B5C-907A-C007D37BDA16_1_102_o.jpeg`
|
- `F19E06B8-A712-4B5C-907A-C007D37BDA16_1_102_o.jpeg`
|
||||||
@ -2275,9 +2275,9 @@ On Photos <=4, they'll be named something like:
|
|||||||
- `UNADJUSTEDNONRAW_thumb_6.jpg`
|
- `UNADJUSTEDNONRAW_thumb_6.jpg`
|
||||||
- `Y6OofYkbR96spbS6XgwOQw_mini_1.jpg`
|
- `Y6OofYkbR96spbS6XgwOQw_mini_1.jpg`
|
||||||
|
|
||||||
I've not yet decoded the suffixes to know which preview is used for which purpose but in general, if you look for the largest file, you'll get the highest resolution preview.
|
I've not yet decoded the suffixes to know which preview is used for which purpose but in general, if you look for the largest file, you'll get the highest resolution preview. Note that video files and Live images may have both a `.mov` video preview as well as a `.jpeg` still-image preview (the JPEG file is the one Photos displays as the "cover" for the video.)
|
||||||
|
|
||||||
Returns empty list if no preview images are found.
|
Returns empty list if no preview images are found.
|
||||||
|
|
||||||
#### `path_raw`
|
#### `path_raw`
|
||||||
Returns the absolute path to the associated raw photo on disk as a string, if photo is part of a RAW+JPEG pair, otherwise returns None. See [notes on Raw Photos](#raw-photos).
|
Returns the absolute path to the associated raw photo on disk as a string, if photo is part of a RAW+JPEG pair, otherwise returns None. See [notes on Raw Photos](#raw-photos).
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# Sphinx build info version 1
|
# Sphinx build info version 1
|
||||||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
|
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
|
||||||
config: 6bda10155f57538a94b20a353aeff4af
|
config: 210ecd9d654dea5d4c21627449ca1d63
|
||||||
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Overview: module code — osxphotos 0.42.19 documentation</title>
|
<title>Overview: module code — osxphotos 0.42.20 documentation</title>
|
||||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
|
<link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
|
||||||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>osxphotos.photoinfo.photoinfo — osxphotos 0.42.19 documentation</title>
|
<title>osxphotos.photoinfo.photoinfo — osxphotos 0.42.20 documentation</title>
|
||||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="../../../_static/alabaster.css" type="text/css" />
|
<link rel="stylesheet" href="../../../_static/alabaster.css" type="text/css" />
|
||||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||||
@ -853,7 +853,7 @@
|
|||||||
|
|
||||||
<span class="nd">@property</span>
|
<span class="nd">@property</span>
|
||||||
<span class="k">def</span> <span class="nf">path_derivatives</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
<span class="k">def</span> <span class="nf">path_derivatives</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||||
<span class="sd">""" Return any derivative (preview) images associated with the photo as a list of paths """</span>
|
<span class="sd">""" Return any derivative (preview) images associated with the photo as a list of paths, sorted by file size (largest first) """</span>
|
||||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_db</span><span class="o">.</span><span class="n">_db_version</span> <span class="o"><=</span> <span class="n">_PHOTOS_4_VERSION</span><span class="p">:</span>
|
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_db</span><span class="o">.</span><span class="n">_db_version</span> <span class="o"><=</span> <span class="n">_PHOTOS_4_VERSION</span><span class="p">:</span>
|
||||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_path_derivatives_4</span><span class="p">()</span>
|
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_path_derivatives_4</span><span class="p">()</span>
|
||||||
|
|
||||||
@ -865,6 +865,7 @@
|
|||||||
<span class="o">/</span> <span class="n">directory</span>
|
<span class="o">/</span> <span class="n">directory</span>
|
||||||
<span class="p">)</span>
|
<span class="p">)</span>
|
||||||
<span class="n">files</span> <span class="o">=</span> <span class="n">derivative_path</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">uuid</span><span class="si">}</span><span class="s2">*.*"</span><span class="p">)</span>
|
<span class="n">files</span> <span class="o">=</span> <span class="n">derivative_path</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">uuid</span><span class="si">}</span><span class="s2">*.*"</span><span class="p">)</span>
|
||||||
|
<span class="n">files</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">files</span><span class="p">,</span> <span class="n">reverse</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">f</span><span class="p">:</span> <span class="n">f</span><span class="o">.</span><span class="n">stat</span><span class="p">()</span><span class="o">.</span><span class="n">st_size</span><span class="p">)</span>
|
||||||
<span class="c1"># return list of filename but skip .THM files (these are actually low-res thumbnails in JPEG format but with .THM extension)</span>
|
<span class="c1"># return list of filename but skip .THM files (these are actually low-res thumbnails in JPEG format but with .THM extension)</span>
|
||||||
<span class="k">return</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span> <span class="k">for</span> <span class="n">filename</span> <span class="ow">in</span> <span class="n">files</span> <span class="k">if</span> <span class="n">filename</span><span class="o">.</span><span class="n">suffix</span> <span class="o">!=</span> <span class="s2">".THM"</span><span class="p">]</span>
|
<span class="k">return</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span> <span class="k">for</span> <span class="n">filename</span> <span class="ow">in</span> <span class="n">files</span> <span class="k">if</span> <span class="n">filename</span><span class="o">.</span><span class="n">suffix</span> <span class="o">!=</span> <span class="s2">".THM"</span><span class="p">]</span>
|
||||||
|
|
||||||
@ -889,6 +890,7 @@
|
|||||||
<span class="n">derivatives_path</span> <span class="o">=</span> <span class="n">derivatives_root</span> <span class="o">/</span> <span class="s2">"00"</span> <span class="o">/</span> <span class="n">file_id</span>
|
<span class="n">derivatives_path</span> <span class="o">=</span> <span class="n">derivatives_root</span> <span class="o">/</span> <span class="s2">"00"</span> <span class="o">/</span> <span class="n">file_id</span>
|
||||||
<span class="k">if</span> <span class="n">derivatives_path</span><span class="o">.</span><span class="n">is_dir</span><span class="p">():</span>
|
<span class="k">if</span> <span class="n">derivatives_path</span><span class="o">.</span><span class="n">is_dir</span><span class="p">():</span>
|
||||||
<span class="n">files</span> <span class="o">=</span> <span class="n">derivatives_path</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span>
|
<span class="n">files</span> <span class="o">=</span> <span class="n">derivatives_path</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span>
|
||||||
|
<span class="n">files</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">files</span><span class="p">,</span> <span class="n">reverse</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">f</span><span class="p">:</span> <span class="n">f</span><span class="o">.</span><span class="n">stat</span><span class="p">()</span><span class="o">.</span><span class="n">st_size</span><span class="p">)</span>
|
||||||
<span class="k">return</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span> <span class="k">for</span> <span class="n">filename</span> <span class="ow">in</span> <span class="n">files</span><span class="p">]</span>
|
<span class="k">return</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span> <span class="k">for</span> <span class="n">filename</span> <span class="ow">in</span> <span class="n">files</span><span class="p">]</span>
|
||||||
|
|
||||||
<span class="c1"># didn't find derivatives path</span>
|
<span class="c1"># didn't find derivatives path</span>
|
||||||
@ -897,6 +899,7 @@
|
|||||||
<span class="n">derivatives_path</span> <span class="o">=</span> <span class="n">derivatives_root</span> <span class="o">/</span> <span class="n">subdir</span> <span class="o">/</span> <span class="n">file_id</span>
|
<span class="n">derivatives_path</span> <span class="o">=</span> <span class="n">derivatives_root</span> <span class="o">/</span> <span class="n">subdir</span> <span class="o">/</span> <span class="n">file_id</span>
|
||||||
<span class="k">if</span> <span class="n">derivatives_path</span><span class="o">.</span><span class="n">is_dir</span><span class="p">():</span>
|
<span class="k">if</span> <span class="n">derivatives_path</span><span class="o">.</span><span class="n">is_dir</span><span class="p">():</span>
|
||||||
<span class="n">files</span> <span class="o">=</span> <span class="n">derivatives_path</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span>
|
<span class="n">files</span> <span class="o">=</span> <span class="n">derivatives_path</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span>
|
||||||
|
<span class="n">files</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">files</span><span class="p">,</span> <span class="n">reverse</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">f</span><span class="p">:</span> <span class="n">f</span><span class="o">.</span><span class="n">stat</span><span class="p">()</span><span class="o">.</span><span class="n">st_size</span><span class="p">)</span>
|
||||||
<span class="k">return</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span> <span class="k">for</span> <span class="n">filename</span> <span class="ow">in</span> <span class="n">files</span><span class="p">]</span>
|
<span class="k">return</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span> <span class="k">for</span> <span class="n">filename</span> <span class="ow">in</span> <span class="n">files</span><span class="p">]</span>
|
||||||
|
|
||||||
<span class="c1"># didn't find a derivatives path</span>
|
<span class="c1"># didn't find a derivatives path</span>
|
||||||
|
|||||||
2
docs/_static/documentation_options.js
vendored
2
docs/_static/documentation_options.js
vendored
@ -1,6 +1,6 @@
|
|||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
|
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
|
||||||
VERSION: '0.42.19',
|
VERSION: '0.42.20',
|
||||||
LANGUAGE: 'None',
|
LANGUAGE: 'None',
|
||||||
COLLAPSE_INDEX: false,
|
COLLAPSE_INDEX: false,
|
||||||
BUILDER: 'html',
|
BUILDER: 'html',
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>osxphotos command line interface (CLI) — osxphotos 0.42.19 documentation</title>
|
<title>osxphotos command line interface (CLI) — osxphotos 0.42.20 documentation</title>
|
||||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
||||||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Index — osxphotos 0.42.19 documentation</title>
|
<title>Index — osxphotos 0.42.20 documentation</title>
|
||||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
||||||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Welcome to osxphotos’s documentation! — osxphotos 0.42.19 documentation</title>
|
<title>Welcome to osxphotos’s documentation! — osxphotos 0.42.20 documentation</title>
|
||||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
||||||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>osxphotos — osxphotos 0.42.19 documentation</title>
|
<title>osxphotos — osxphotos 0.42.20 documentation</title>
|
||||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
||||||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||||||
|
|||||||
Binary file not shown.
@ -5,7 +5,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>osxphotos package — osxphotos 0.42.19 documentation</title>
|
<title>osxphotos package — osxphotos 0.42.20 documentation</title>
|
||||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
||||||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||||||
@ -1139,7 +1139,7 @@ Photos 5 mangles filenames upon import</p>
|
|||||||
<dl class="py method">
|
<dl class="py method">
|
||||||
<dt id="osxphotos.PhotoInfo.path_derivatives">
|
<dt id="osxphotos.PhotoInfo.path_derivatives">
|
||||||
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">path_derivatives</span></code><a class="headerlink" href="#osxphotos.PhotoInfo.path_derivatives" title="Permalink to this definition">¶</a></dt>
|
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">path_derivatives</span></code><a class="headerlink" href="#osxphotos.PhotoInfo.path_derivatives" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd><p>Return any derivative (preview) images associated with the photo as a list of paths</p>
|
<dd><p>Return any derivative (preview) images associated with the photo as a list of paths, sorted by file size (largest first)</p>
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="py method">
|
<dl class="py method">
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Search — osxphotos 0.42.19 documentation</title>
|
<title>Search — osxphotos 0.42.20 documentation</title>
|
||||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Export your photos — osxphotos 0.42.19 documentation</title>
|
<title>Export your photos — osxphotos 0.42.20 documentation</title>
|
||||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
||||||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
""" version info """
|
""" version info """
|
||||||
|
|
||||||
__version__ = "0.42.19"
|
__version__ = "0.42.20"
|
||||||
@ -820,7 +820,7 @@ class PhotoInfo:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def path_derivatives(self):
|
def path_derivatives(self):
|
||||||
""" Return any derivative (preview) images associated with the photo as a list of paths """
|
""" Return any derivative (preview) images associated with the photo as a list of paths, sorted by file size (largest first) """
|
||||||
if self._db._db_version <= _PHOTOS_4_VERSION:
|
if self._db._db_version <= _PHOTOS_4_VERSION:
|
||||||
return self._path_derivatives_4()
|
return self._path_derivatives_4()
|
||||||
|
|
||||||
@ -832,6 +832,7 @@ class PhotoInfo:
|
|||||||
/ directory
|
/ directory
|
||||||
)
|
)
|
||||||
files = derivative_path.glob(f"{self.uuid}*.*")
|
files = derivative_path.glob(f"{self.uuid}*.*")
|
||||||
|
files = sorted(files, reverse=True, key=lambda f: f.stat().st_size)
|
||||||
# return list of filename but skip .THM files (these are actually low-res thumbnails in JPEG format but with .THM extension)
|
# return list of filename but skip .THM files (these are actually low-res thumbnails in JPEG format but with .THM extension)
|
||||||
return [str(filename) for filename in files if filename.suffix != ".THM"]
|
return [str(filename) for filename in files if filename.suffix != ".THM"]
|
||||||
|
|
||||||
@ -856,6 +857,7 @@ class PhotoInfo:
|
|||||||
derivatives_path = derivatives_root / "00" / file_id
|
derivatives_path = derivatives_root / "00" / file_id
|
||||||
if derivatives_path.is_dir():
|
if derivatives_path.is_dir():
|
||||||
files = derivatives_path.glob("*")
|
files = derivatives_path.glob("*")
|
||||||
|
files = sorted(files, reverse=True, key=lambda f: f.stat().st_size)
|
||||||
return [str(filename) for filename in files]
|
return [str(filename) for filename in files]
|
||||||
|
|
||||||
# didn't find derivatives path
|
# didn't find derivatives path
|
||||||
@ -864,6 +866,7 @@ class PhotoInfo:
|
|||||||
derivatives_path = derivatives_root / subdir / file_id
|
derivatives_path = derivatives_root / subdir / file_id
|
||||||
if derivatives_path.is_dir():
|
if derivatives_path.is_dir():
|
||||||
files = derivatives_path.glob("*")
|
files = derivatives_path.glob("*")
|
||||||
|
files = sorted(files, reverse=True, key=lambda f: f.stat().st_size)
|
||||||
return [str(filename) for filename in files]
|
return [str(filename) for filename in files]
|
||||||
|
|
||||||
# didn't find a derivatives path
|
# didn't find a derivatives path
|
||||||
|
|||||||
@ -503,13 +503,10 @@ def test_path_derivatives(photosdb):
|
|||||||
assert len(photos) == 1
|
assert len(photos) == 1
|
||||||
p = photos[0]
|
p = photos[0]
|
||||||
path = p.path_derivatives
|
path = p.path_derivatives
|
||||||
derivs = sorted(
|
derivs = [
|
||||||
[
|
"D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068_1_100_o.jpeg",
|
||||||
"D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068_1_105_c.jpeg",
|
"D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068_1_105_c.jpeg",
|
||||||
"D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068_1_100_o.jpeg",
|
]
|
||||||
]
|
|
||||||
)
|
|
||||||
path = sorted(path)
|
|
||||||
for i, p in enumerate(path):
|
for i, p in enumerate(path):
|
||||||
assert p.endswith(derivs[i])
|
assert p.endswith(derivs[i])
|
||||||
|
|
||||||
|
|||||||
@ -563,13 +563,10 @@ def test_path_derivatives(photosdb):
|
|||||||
assert len(photos) == 1
|
assert len(photos) == 1
|
||||||
p = photos[0]
|
p = photos[0]
|
||||||
path = p.path_derivatives
|
path = p.path_derivatives
|
||||||
derivs = sorted(
|
derivs = [
|
||||||
[
|
"D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068_1_100_o.jpeg",
|
||||||
"D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068_1_105_c.jpeg",
|
"D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068_1_105_c.jpeg",
|
||||||
"D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068_1_100_o.jpeg",
|
]
|
||||||
]
|
|
||||||
)
|
|
||||||
path = sorted(path)
|
|
||||||
for i, p in enumerate(path):
|
for i, p in enumerate(path):
|
||||||
assert p.endswith(derivs[i])
|
assert p.endswith(derivs[i])
|
||||||
|
|
||||||
|
|||||||
@ -425,14 +425,11 @@ def test_path_derivatives(photosdb):
|
|||||||
|
|
||||||
photos = photosdb.photos(uuid=[UUID_DICT["has_adjustments"]])
|
photos = photosdb.photos(uuid=[UUID_DICT["has_adjustments"]])
|
||||||
p = photos[0]
|
p = photos[0]
|
||||||
derivs = sorted(
|
derivs = [
|
||||||
[
|
"/resources/proxies/derivatives/00/00/1/Y6OofYkbR96spbS6XgwOQw_thumb_1.jpg",
|
||||||
"/resources/proxies/derivatives/00/00/1/Y6OofYkbR96spbS6XgwOQw_thumb_1.jpg",
|
"/resources/proxies/derivatives/00/00/1/Y6OofYkbR96spbS6XgwOQw_mini_1.jpg",
|
||||||
"/resources/proxies/derivatives/00/00/1/Y6OofYkbR96spbS6XgwOQw_mini_1.jpg",
|
]
|
||||||
]
|
for i, p in enumerate(p.path_derivatives):
|
||||||
)
|
|
||||||
path = sorted(p.path_derivatives)
|
|
||||||
for i, p in enumerate(path):
|
|
||||||
assert p.endswith(derivs[i])
|
assert p.endswith(derivs[i])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user