Opened 5 years ago

Closed 4 years ago

#12424 closed Patch - Feature (Fixed)

Replacement Gallery using MythUI & Storage Groups

Reported by: Roger Siddons <dizygotheca@…> Owned by: Roger Siddons
Priority: minor Milestone: 0.28
Component: Plugin - MythGallery Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Notes

Tested with Qt 4.8 and Qt 5.2.1

Backend manages images in Storage Group and supports multiple frontends/service clients.

Backend generates thumbnails for FE's and service clients. They are pre-generated in a (low-priority) background thread to improve FE performance. They are also generated on-demand when necessary.

Thumbnails reside in <BE user>/.mythtv/tmp/Photographs. FE's cache displayed images & thumbnails in <FE user>/.mythtv/cache/themecache/<themedir>. Both caches are synced to the Db to prevent cache overflow.

The Thumbnail View screen implements zoom by switching buttonlist widgets. A theme must define an "images0" buttonlist (most zoomed-out) and can optionally define others to enable zoom. The default theme provides 10x6, 8x4, 6x3, 4x2 views.

Provides basic management functions (Create Dir, Delete, Copy/Move?) which can be password-protected to thwart little fingers/prevent data loss.

Provides some basic animated slideshow transitions using zoom, rotate, fade, translate and a framework for easily adding more.

Displays Exif metadata and date/orientaton of videos. Images can be sorted by metadata timestamp. Photos are auto-rotated using Exif data; video auto-rotation TBD.

Never writes Exif metadata to image files. Exif standards are poorly defined and modification may lead to corruption/data loss. Images may (should) have read-only permissions. Orientation overrides are stored in Db only.

The menu is a 'smart' in that the displayed optons depend upon the item(s) selected.

Deficiencies/Known Issues.

Uses current schema (>1318). However its use of the db has changed and is not compatible with old 'New Image Gallery'. Clear image database ("gallery_files" table) first. It abuses the current schema - a schema update is required to tidy it up.

Does not yet support mythmediaserver.

Services API is incomplete.

Videos are not played in correct orientation.

Slideshow zoom wobbles between 70% - 110% zoom.

Not integrated with shutdown. Initial scans of large libraries will take a significant time to generate thumbnails.

Patches (No dependencies)

  1. MythUI image centring. Images that are smaller than a widget are centred, but the image zoom is currently ignored. This results in a slideshow image being displaced when it is zoomed. This patch improves the problem but it may not be a complete solution as the image still wobbles when being zoomed.

  1. MythUI image re-sizing. An image is currently re-sized before being orientated. This results in the bottom of portrait-orientated pics going off-screen. This patch orientates an image before determining its size.

  1. MythUI image orientation. Orientation is currently inverted -portrait images are shown upside-down.
  1. Replacement gallery. Lots of new/deleted/renamed files but all isolated Gallery code, except for frontend/main (key bindings & startup) and mythuifilebrowser (to make it sub-classable)

Attachments (15)

0001-Centre-zoomed-images.patch (3.5 KB) - added by Roger Siddons <dizygotheca@…> 5 years ago.
Patch 1
0002-Orient-before-resize.patch (2.0 KB) - added by Roger Siddons <dizygotheca@…> 5 years ago.
Patch 2
0003-Fix-image-orientation.patch (1.7 KB) - added by Roger Siddons <dizygotheca@…> 5 years ago.
Patch 3
0004-Replacement-Gallery-using-MythUI-storage-groups.patch (652.8 KB) - added by Roger Siddons <dizygotheca@…> 5 years ago.
Gallery
0005-Cache-FE-gallery-images-in-remotecache-for-Minimyth2.patch (3.5 KB) - added by dizygotheca@… 5 years ago.
Minimyth2 customisation
0006-MediaMonitor-Support-ejection-of-specific-device.patch (1.4 KB) - added by Roger Siddons <dizygotheca@…> 4 years ago.
0007-RemoteFile-Fix-writing-of-local-files.patch (1.9 KB) - added by Roger Siddons <dizygotheca@…> 4 years ago.
0008-RemoteFile-CopyFile-Don-t-overwrite-existing-files-b.patch (8.0 KB) - added by Roger Siddons <dizygotheca@…> 4 years ago.
0009-RemoteFile-Add-Move-operation.patch (8.3 KB) - added by Roger Siddons <dizygotheca@…> 4 years ago.
0010-MythUI-Don-t-draw-empty-text.patch (1.1 KB) - added by Roger Siddons <dizygotheca@…> 4 years ago.
0011-MythUI-Signal-when-image-loaded.patch (4.3 KB) - added by Roger Siddons <dizygotheca@…> 4 years ago.
0012-MythUI-Empty-menu-getter.patch (727 bytes) - added by Roger Siddons <dizygotheca@…> 4 years ago.
0013-Gallery-Redesign-to-support-local-media.patch (606.7 KB) - added by Roger Siddons <dizygotheca@…> 4 years ago.
0014-Gallery-Use-common-orientation.patch (7.9 KB) - added by Roger Siddons <dizygotheca@…> 4 years ago.
0015-MythUI-Handle-deviant-image-orientation-behaviour-by.patch (7.0 KB) - added by Roger Siddons <dizygotheca@…> 4 years ago.

Download all attachments as: .zip

Change History (38)

Changed 5 years ago by Roger Siddons <dizygotheca@…>

Patch 1

Changed 5 years ago by Roger Siddons <dizygotheca@…>

Patch 2

Changed 5 years ago by Roger Siddons <dizygotheca@…>

Patch 3

Changed 5 years ago by Roger Siddons <dizygotheca@…>

Gallery

comment:1 Changed 5 years ago by warpme@…

Roger, This work looks very interesting. I have Q regarding images cache location on FE side. Is it possible to change cache from themecache to remotecache ? I'm asking as themecache is usually highly static while remotecache is much more dynamic. In diskless systems static nature of themecache seems to be convenient for squashfs ro share while remotecache can be NFS share to central server storage. I'm using such approach with high success in minimyth2. When this change will be in place - I'll love to give it try in my home/minimyth2 :-)

Changed 5 years ago by dizygotheca@…

Minimyth2 customisation

comment:2 Changed 5 years ago by Roger Siddons <dizygotheca@…>

Warpme,

Gallery can not specify the cache location - it is determined in the depths of MythUIImage which presumably uses themecache as most images are/were theme elements.

Your point makes sense though. Gallery images may be scaled differently by each theme, but there will be no conflict (due to the cache naming) and moving them out of the themecache prevents needless duplication where themes use the same sized widgets (or the default gallery theme).

It's something to consider if/when it gets adopted. In the meantime I've attached a patch (lightly tested) that crudely diverts gallery images to remotecache for you. Note the storage group is hard-coded.

comment:3 Changed 5 years ago by warpme@…

Roger, I applied this first on my test BE (300 test pictures). I really like Your work. Some things needs to be polished but overall look is VERY promising. After so good experience I applied patches to production environment (7k pictures). On production I'm not able to finish initial scan. BE segfaults after sometime after starting scan. Looking on traces I see segfault in image.scanner. GDB produced +10M log file before I killed it. I suspect it is because massive amount of threads launched by image.scanner. I can try to produce GDB trace but this will be multi-tenths MB file... Let me know how can I help You with loving this issue.

comment:4 Changed 5 years ago by warpme@…

heh: s/loving/solving/ damn spellchecker

comment:5 Changed 4 years ago by paulh

Milestone: unknown0.28
Owner: set to paulh
Status: newaccepted

comment:6 Changed 4 years ago by Roger Siddons <dizygotheca@…>

In 3a927aa939603457c2902ddd9c1ea5d77bea82d6/mythtv:

Effects: Centre zoomed images

Images that are smaller than a widget are centred, but the image zoom is
currently ignored. This results in a slideshow image being displaced when
it is zoomed. This patch improves the problem but it may not be a complete
solution as the image still wobbles when being zoomed.

Refs #12424

Signed-off-by: Paul Harrison <pharrison@…>

comment:7 Changed 4 years ago by Roger Siddons <dizygotheca@…>

In ac51819c747dabca1b05cd17f402948a56af25a3/mythtv:

ImageLoader?: Orient before resize

An image is currently re-sized before being orientated. This results in the
bottom of portrait-orientated pics going off-screen. This patch orientates an
image before re-sizing it.

Refs #12424

Signed-off-by: Paul Harrison <pharrison@…>

comment:8 Changed 4 years ago by Roger Siddons <dizygotheca@…>

In 94bf989f3bb2d954a22dbe8e826114d9cd21a155/mythtv:

MythImage?: Fix image orientation

Image re-orientation is currently inverted -portrait images are shown
upside-down.

Refs #12424

Signed-off-by: Paul Harrison <pharrison@…>

comment:9 Changed 4 years ago by Roger Siddons <dizygotheca@…>

Resolution: fixed
Status: acceptedclosed

In e845eae3e846cd83873cf3844971b29fc6bc5219/mythtv:

Replacement Gallery using MythUI & storage groups

Tested with Qt 4.8 and Qt 5.2.1

Backend manages images in Storage Group and supports multiple
frontends/service clients.

Backend generates thumbnails for FE's and service clients. They are
pre-generated in a (low-priority) background thread to improve FE performance.
They are also generated on-demand when necessary.

Thumbnails reside in <BE user>/.mythtv/tmp/Photographs. FE's cache displayed
images & thumbnails in <FE user>/.mythtv/cache/themecache/<themedir>. Both
caches are synced to the Db to prevent cache overflow.

The Thumbnail View screen implements zoom by switching buttonlist widgets.
A theme must define an "images0" buttonlist (most zoomed-out) and can
optionally define others to enable zoom. The default theme provides 10x6, 8x4,
6x3, 4x2 views.

Provides basic management functions (Create Dir, Delete, Copy/Move?) which can
be password-protected to thwart little fingers/prevent data loss.

Provides some basic animated slideshow transitions using zoom, rotate, fade,
translate and a framework for easily adding more.

Displays Exif metadata and date/orientaton of videos.
Images can be sorted by metadata timestamp.
Photos are auto-rotated using Exif data; video auto-rotation TBD.

Never writes Exif metadata to image files.
Exif standards are poorly defined and modification may lead to corruption/data
loss. Images may (should) have read-only permissions. Orientation overrides are
stored in Db only.

The menu is 'smart', in that the displayed optons depend upon the item(s)
selected.

Deficiencies/Known? Issues.

Uses current schema (>1318). However its use of the db has changed and is not
compatible with old 'New Image Gallery'. Clear image database ("gallery_files"
table) first. It abuses the current schema - a schema update is required to
tidy it up.

Does not yet support mythmediaserver.

Services API is incomplete.

Videos are not played in correct orientation.

Slideshow zoom wobbles between 70% - 110% zoom.

Not integrated with shutdown. Initial scans of large libraries will take a
significant time to generate thumbnails.

Closes #12424

Signed-off-by: Paul Harrison <pharrison@…>

comment:10 Changed 4 years ago by paulh

Resolution: fixed
Status: closednew

comment:11 Changed 4 years ago by Roger Siddons <dizygotheca@…>

Version 1 (above) has numerous issues, mainly that it doesn't support frontend devices (CD's/USBs)

Following patches contain a replacement Version 2 - a major redesign.

Patches 0006-0012 add Myth support for the new design. Patch 0013 is the new design - mostly internal changes. Patches 0014 & 0015 provide a fix (work-around) for an issue peculiar to Qt 5.4.1

Changed 4 years ago by Roger Siddons <dizygotheca@…>

Changed 4 years ago by Roger Siddons <dizygotheca@…>

Changed 4 years ago by Roger Siddons <dizygotheca@…>

Changed 4 years ago by Roger Siddons <dizygotheca@…>

Changed 4 years ago by Roger Siddons <dizygotheca@…>

Changed 4 years ago by Roger Siddons <dizygotheca@…>

Changed 4 years ago by Roger Siddons <dizygotheca@…>

Changed 4 years ago by Roger Siddons <dizygotheca@…>

Changed 4 years ago by Roger Siddons <dizygotheca@…>

Changed 4 years ago by Roger Siddons <dizygotheca@…>

comment:12 Changed 4 years ago by Karl Egly

Owner: changed from paulh to Roger Siddons
Status: newassigned

Roger, assigning your open patches to yourself. Feel free to unassign if you prefer a review.

comment:13 Changed 4 years ago by Roger Siddons <rsiddons@…>

In 0aa6b70874650ff169d563c9f0be863252ab02e7/mythtv:

MediaMonitor?: Support ejection of specific device

Mediamonitor only supports device ejection via its own dialog.

This patch allows MediaMonitor? clients to eject devices directly.

Refs #12424

comment:14 Changed 4 years ago by Roger Siddons <rsiddons@…>

In ade5ca7f623d0e4a23fc970534060571e4b168a4/mythtv:

RemoteFile::CopyFile?: Don't overwrite existing files by default

CopyFile? doesn't check for a file's existance before writing to it.
For storage groups containing multiple dirs this can lead to multiple versions of a remote file (only
one of which will be read).

This patch will fail the copy operation (by default) if the destination file already exists.
If the overwrite flag is set the destination file is deleted first, ensuring that multiple versions
are never created.

It also adds optional verification that the copy succeeded (by comparing file sizes) as writing can fail
silently if the filesystem fills up.

Refs #12424

comment:15 Changed 4 years ago by Roger Siddons <rsiddons@…>

In 096b94929c76f8999181a0c1022040422b0d24c7/mythtv:

RemoteFile?: Add Move operation

Adds support for moving files.
Between local/remote locations the source is copied and only deleted if destination has an identical file size.
Remote files can only be moved within the same storage group.
Local->local & remote->remote moves invoke a filesystem rename (which may resort to a copy/delete itself).

Refs #12424

comment:16 Changed 4 years ago by Roger Siddons <rsiddons@…>

In 59edfabaa6a90e6fdb4a3fe00dd9871b98e31a49/mythtv:

MythUI: Don't draw empty text

Text items containing only spaces result in errors:

QPainter::begin: Paint device returned engine == 0, type: 3
2015-10-10 16:50:23.512923 E MythPainter::GetImageFromTextLayout?: Invalid canvas.
2015-10-10 16:50:23.512939 D MythPainter::DrawTextLayout?: Rendered image is null.

The QRect created by the formatting is empty but not null and we shouldn't try to render it.

(Empty photo EXIF comments are typically 100+ spaces).

Refs #12424

comment:17 Changed 4 years ago by Roger Siddons <rsiddons@…>

In 79945bf6f3efecb3de7522a3ecdc544ffc740bbf/mythtv:

MythUI: Signal when image loaded

Emit a signal when MythUIImage finishes loading an image in a background thread.

Required for Gallery slideshows, which wait for an image to load before starting a transition to display it.

Refs #12424

comment:18 Changed 4 years ago by Roger Siddons <rsiddons@…>

In e46231a050909364f3accefd936cee5788be16c6/mythtv:

MythUI: Empty menu getter

Menu construction is sometimes convoluted.
Add support to prevent empty menus being displayed.

Refs #12424

comment:19 Changed 4 years ago by Roger Siddons <rsiddons@…>

In 4bf9dac8c5d68a5475a31cc23f9490944fffb6ad/mythtv:

Gallery: Redesign to support local media

Current design only manages storage group images.

This rewrite:

  • Also manages local media (USBs/CDs etc) attached to frontend.
  • Adds caching to improve UI responsiveness
  • Improves metadata handling (Exif/Ffmpeg? tags)

A generic Image Manager is now provided by libmythmetadata.
Frontend uses one instance to manage local media.
Another instance is used by backend to manage the storage group.
UI uses both instances seamlessly.

This patch refactors lots of internal Gallery files. External changes are:

mythcorecontext: Add support for mythffprobe, used to retrieve metadata tags for videos.
mythuifilebrowser: Reverts changes introduced by 8970202e7dc94ec4f634fb9f2fd6a0c780f5dbf9. Import dialog (mythuimultifilebrowser) is no longer needed.
mythfrontend/main: Add mediamonitor support & key binding fixes.
mainserver: Image messages/events
theme: Image screen & mythuifilebrowser removal

Although schema hasn't changed, the use of the database has changed. You must reset/clear the image database ("gallery_files") and rescan.

Refs #12424

comment:20 Changed 4 years ago by Roger Siddons <rsiddons@…>

In 79a35d3c32747ed004ecd981431d3524252675e0/mythtv:

Gallery: Use common orientation

Images are rotated to their correct orientation in 2 places;

  • MythImage?, when loading an image
  • Gallery, when creating thumbnails

This patch removes the duplicated orientation code by making the MythImage? functionality accessible to the Gallery.

Refs #12424

comment:21 Changed 4 years ago by Roger Siddons <rsiddons@…>

In f48a8c7cf6e652aa6d93246bc7a927566dddcbe6/mythtv:

MythUI: Handle deviant image orientation behaviour by Qt 5.4.1

When loading a QImage, Qt 5.4.1 automatically orientates the image.
All other versions of Qt (4, 5.2, 5.4.0, 5.4.2) load the raw image without applying orientation.
In Qt 5.5 the behaviour will be optional.
See https://codereview.qt-project.org/#/c/110685/

This causes Gallery images to be mis-orientated (as orientation is applied twice)

This patch applies orientation compensation when running with Qt 5.4.1

Tested on Qt 5.2.1, 5.4.1 & 5.4.2

Refs #12424

comment:22 Changed 4 years ago by angela.schmid@…

Roger, reading your last two comments about thumbnail orientation and the made changes, my patch in #12278 might be obsolete now.

comment:23 Changed 4 years ago by Roger Siddons

Resolution: Fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.