Commit Graph

584 Commits (8a1d5d9eae87bc4ec0a7ef6bf0f92c9a4f6cbd48)

Author SHA1 Message Date
voussoir 8a12a24e8e Add tag_autocomplete.js.
Instead of embedding the entire tag list in the search.html template
every single time, this script loads the tags from the new,
cache-enabled endpoint /all_tags.json. Then we can use html5
datalists to create autocomplete forms on the search and photo pages.
2018-07-22 20:19:05 -07:00
voussoir bbf07f4401 Fix image thumbnail wrong variable bug.
How long has that been there?
2018-07-22 20:19:05 -07:00
voussoir 5ac3a8a121 Add caching.cached_endpoint decorator for 304'ing any url. 2018-07-22 20:19:05 -07:00
voussoir d740e6d686 Oops, fix read_filebytes not stopping at the range_max properly. 2018-07-22 20:18:58 -07:00
voussoir 4c65ccaf68 Big! Liberate Groupables from strict heirarchy. Multiple parents.
I found that the strict heirarchy was not satisfying the situation
where one tag is the intersection of two others, but we can only
pick one as the parent

For example, does red_jacket belong under clothes.red_clothes or
clothes.jackets? A search for "red_clothes AND jackets" might
give us someone wearing red pants and a black jacket, so this
definitely needs to be a separate tag, but picking only one
parent for it is not sufficient. Now, a search for red_clothes
and a search for jackets will both find our red_jacket photo.

The change also applies to Albums because why not, and I'm sure
a similar case can be made.

Unfortunately this means tags no longer have one true qualname.
The concept of qualnames has not been completely phased out but
it's in progress.

This commit is very big because I was not sure for a long time
whether to go through with it, and so much stuff had to change
that I don't want to go back and figure out what could be grouped
together.
2018-07-20 13:09:06 -07:00
voussoir c2cfa99752 Alphabetize imports in endpoints files. 2018-07-18 18:37:21 -07:00
voussoir 4987db4bd0 Switch to f-string formatting in many places. 2018-07-18 18:36:36 -07:00
voussoir 4a39873fed Increase default tag cache to 10,000. 2018-07-18 18:27:18 -07:00
voussoir 38bac41eb9 Add helpers.split_easybake_string for prelim parsing.
Helps to remove some distractions from the main easybake method.
2018-07-15 14:23:43 -07:00
voussoir f06b0915ab Add new_photo_kwargs to the create_or_get call.
Due to the closure, it was already working just fine, but I
want the explicitness of having it there.
2018-07-15 13:52:08 -07:00
voussoir 57a9e0d4dc Move PDB.close out of the sqlmixin, into main class.
Doesn't really deserve to be with the sql stuff.
2018-07-15 13:27:04 -07:00
voussoir 5c97086df3 Improve hotkey framework by making own file & register function. 2018-07-14 14:19:13 -07:00
voussoir 2901fefe65 Add more clipboard feature hotkeys. 2018-07-14 02:54:39 -07:00
voussoir 984f6eb3c7 Add a clear button to the clipboard tray. 2018-07-14 02:49:45 -07:00
voussoir c37b54b456 Add dividers and rearrange some of the table column parsing. 2018-07-13 19:22:05 -07:00
voussoir 2f83bc2808 Add a simple docstring to the flask launch files. 2018-06-30 12:59:10 -07:00
voussoir 0852630cd1 Alphabetize _extract_table_name. 2018-06-30 12:55:30 -07:00
voussoir c930228d3f Rearrange order of Album.delete ops to not void FK contraint. 2018-06-30 12:51:09 -07:00
voussoir c736c33165 Add caching of tag synonyms. 2018-05-06 21:09:15 -07:00
voussoir c6b71f1a0d Revert caching of qualified names. Causing too many problems.
The world is just not ready for it. Was having issues about the
parents being deleted / renamed and needing to propogate those
changes in a not-ugly way.
Will reassess in the future.
2018-05-06 21:09:09 -07:00
voussoir 0c8a57b6aa Make the assert methods public. 2018-05-06 21:09:09 -07:00
voussoir 40c255b0d0 Pass object instantiations through a cacher.
I want the system to only have one instance of a particular
object at any time, so that we can effectively cache things
in them.
2018-05-06 21:09:08 -07:00
voussoir 11fda94968 Make the SQL_COLUMNS code a bit easier to read. 2018-05-06 21:09:02 -07:00
voussoir db28b6819c Replace individual cache instantiations with all at once. 2018-05-06 21:08:56 -07:00
voussoir 96d79f2b25 Oops, let separate loading of pragmas for not-first-time load.
Since DB_INIT was only run during first time setup, all future
loads were not running the pragmas, not even the FK restriction.
2018-05-03 19:02:53 -07:00
voussoir 64449569ea Rearrange statements during tag delete to not voilate FK. 2018-05-03 18:59:50 -07:00
voussoir 23cc769357 Take advantage of parent's cached_qualname when making mine. 2018-05-03 18:45:57 -07:00
voussoir 943deb9bf7 Move child-lifting code to its own helper method. 2018-05-03 18:32:44 -07:00
voussoir ae46b097e4 Let get_tag_by_name return inputted Tag right away.
For caller's convenience most functions assume you are passing
name as a string, but if you already have the Tag we'll just use it.
2018-05-03 18:20:48 -07:00
voussoir a0e3e037c1 Bail out of join_group early if already immediate parent.
I'd rather make the extra select than a delete and reinsert.
2018-05-03 18:18:13 -07:00
voussoir 22269af2ca Always use False for leave commit before joining new group. 2018-05-03 18:10:12 -07:00
voussoir a8fc1206d9 Oops, move get_root_tags into alphabetical position. 2018-05-02 17:41:46 -07:00
voussoir 4002cc660e Don't use shortlink for zoom url. It breaks caching. 2018-05-01 21:03:10 -07:00
voussoir 58d450a856 Fix handling of the event that a file loses its thumbnail.
In which case return_filepath is None and the relative_to breaks.
2018-05-01 20:41:38 -07:00
voussoir 1626a6fa11 Optimize PDB.get_root_albums and get_root_tags.
Achieves in a single query what used to require a ton of
individual get_parent calls.
2018-05-01 20:32:45 -07:00
voussoir 8c356df6fd Add P_photos to batchify some api operations. 2018-05-01 18:09:35 -07:00
voussoir 6d349aa235 Update to do list with more batching ideas. 2018-05-01 18:06:27 -07:00
voussoir 48396d6ab6 Add Album.remove_photos for batch removals. 2018-05-01 18:05:07 -07:00
voussoir 698981dd29 Move _uncache_sums call out of _add_photo, into callers. 2018-05-01 17:48:56 -07:00
voussoir fa97512586 Use batches of 999 for get_things_by_id.
SQLite has a limit on how many variables you can use per query.
2018-05-01 17:48:02 -07:00
voussoir 97e1f881d0 Move video thumbnailing code to helpers. 2018-04-28 20:36:33 -07:00
voussoir 5bc2bbdacb Move image thumbnailing code to helpers. 2018-04-28 20:33:05 -07:00
voussoir 41823394eb Use PDB.get_albums_by_id for Photo.get_albums. 2018-04-28 19:17:11 -07:00
voussoir 62496d183e Use PDB.get_tags_by_id for Photo.get_tags. 2018-04-28 19:14:58 -07:00
voussoir b19682d1a5 Replace Photo.sorted_tags with jinja filter. 2018-04-28 19:05:51 -07:00
voussoir 50592f0ab4 Rework tab titles from "Album X" to "X | Albums" etc.
To prioritize the most unique and relevant piece of information.
2018-04-27 20:04:24 -07:00
voussoir df7fbeae0a Minor clarity improvements to required_feature logic. 2018-04-27 20:04:18 -07:00
voussoir e2cf9344c1 Copy the inputted new_photo_kwargs so as not to damage it.
Also I learned that pop takes a fallback.
2018-04-20 15:31:41 -07:00
voussoir fec5eaf21e Add Tag.normalize_name to be called by PDB.normalize_tagname. 2018-04-20 15:28:27 -07:00
voussoir bdec6cf4a3 Add filter to generate /file/ link with appropriate basename.
Because inlining the |urlencode every time is easy to forget.
2018-04-19 19:29:06 -07:00