MythTV  master
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ImageHandler< DBFS > Class Template Reference

A handler for image operations. Requires a database/filesystem adapter. More...

#include <imagemanager.h>

Inheritance diagram for ImageHandler< DBFS >:
Inheritance graph
[legend]
Collaboration diagram for ImageHandler< DBFS >:
Collaboration graph
[legend]

Public Member Functions

QStringList HandleRename (const QString &id, const QString &newBase) const
 Change name of an image/dir. More...
 
QStringList HandleDelete (const QString &ids) const
 Deletes images/dirs. More...
 
QStringList HandleDbCreate (QStringList defs) const
 Creates images for files created by a copy operation. More...
 
QStringList HandleDbMove (const QString &ids, const QString &srcPath, QString destPath) const
 Updates images that have been renamed. More...
 
QStringList HandleHide (bool hide, const QString &ids) const
 Hides/unhides images/dirs. More...
 
QStringList HandleTransform (int transform, const QString &ids) const
 Change orientation of pictures by applying a transformation. More...
 
QStringList HandleDirs (const QString &destId, bool rescan, const QStringList &relPaths) const
 Creates new image directories. More...
 
QStringList HandleCover (int dir, int cover) const
 Updates/resets cover thumbnail for an image dir. More...
 
QStringList HandleIgnore (const QString &exclusions) const
 Updates exclusion list for images. More...
 
QStringList HandleScanRequest (const QString &command, int devId=DEVICE_INVALID) const
 Process scan requests. More...
 
QStringList HandleCreateThumbnails (const QStringList &message) const
 Creates thumbnails on-demand. More...
 
QStringList HandleGetMetadata (const QString &id) const
 Read meta data for an image. More...
 

Protected Member Functions

 ImageHandler ()
 
 ~ImageHandler () override
 
void RemoveFiles (ImageList &images) const
 Deletes images and dirs from the filesystem. More...
 

Protected Attributes

ImageThumb< DBFS > * m_thumbGen {nullptr}
 Thumbnail generator. More...
 
ImageScanThread< DBFS > * m_scanner {nullptr}
 File scanner. More...
 

Detailed Description

template<class DBFS>
class ImageHandler< DBFS >

A handler for image operations. Requires a database/filesystem adapter.

Definition at line 341 of file imagemanager.h.

Constructor & Destructor Documentation

◆ ImageHandler()

template<class DBFS >
ImageHandler< DBFS >::ImageHandler ( )
inlineprotected

Definition at line 359 of file imagemanager.h.

◆ ~ImageHandler()

template<class DBFS >
ImageHandler< DBFS >::~ImageHandler ( )
inlineoverrideprotected

Definition at line 363 of file imagemanager.h.

Member Function Documentation

◆ HandleRename()

template<class DBFS >
QStringList ImageHandler< DBFS >::HandleRename ( const QString &  id,
const QString &  newBase 
) const

Change name of an image/dir.

Renames file, updates db and thumbnail

Parameters
idFile/dir id
newBaseNew file basename
Returns
QStringList Error message or "OK"

Definition at line 1209 of file imagemanager.cpp.

Referenced by MainServer::ProcessRequestWork().

◆ HandleDelete()

template<class DBFS >
QStringList ImageHandler< DBFS >::HandleDelete ( const QString &  ids) const

Deletes images/dirs.

Removes files and dirs, updates db and thumbnails. Dirs containing other files will not be deleted. Only fails if nothing is deleted.

Parameters
idsCsv list of dir/file ids
Returns
QStringList Error message or "OK"

Definition at line 1285 of file imagemanager.cpp.

Referenced by MainServer::ProcessRequestWork().

◆ HandleDbCreate()

template<class DBFS >
QStringList ImageHandler< DBFS >::HandleDbCreate ( QStringList  defs) const

Creates images for files created by a copy operation.

Creates skeleton database entries from image state definitions in order to retain state of the copied images. Initiates a scan to populate them fully and generate thumbnails. This retains

Parameters
defsA list of image definitions in the form <id><sep><type><sep><filepath><sep><hidden> <sep><orientation><sep><cover id> where <sep> is the first list item. Dirs must follow their children (files & subdirs)
Returns
QStringList Error message or "OK"

Definition at line 1328 of file imagemanager.cpp.

Referenced by MainServer::ProcessRequestWork().

◆ HandleDbMove()

template<class DBFS >
QStringList ImageHandler< DBFS >::HandleDbMove ( const QString &  ids,
const QString &  srcPath,
QString  destPath 
) const

Updates images that have been renamed.

Updates filepaths of moved images, renames thumbnail and initiates scanner to repair other attributes

Parameters
idsCsv of image ids to rename
srcPathImages current parent path
destPathImages new parent path
Returns
QStringList Error message or "OK"

Definition at line 1387 of file imagemanager.cpp.

◆ HandleHide()

template<class DBFS >
QStringList ImageHandler< DBFS >::HandleHide ( bool  hide,
const QString &  ids 
) const

Hides/unhides images/dirs.

Updates hidden status in db and updates clients

Parameters
hidehide flag: 0 = Show, 1 = Hide
idsCsv list of file/dir ids
Returns
QStringList Error message or "OK"

Definition at line 1454 of file imagemanager.cpp.

◆ HandleTransform()

template<class DBFS >
QStringList ImageHandler< DBFS >::HandleTransform ( int  transform,
const QString &  ids 
) const

Change orientation of pictures by applying a transformation.

Updates orientation in Db and thumbnail. Does not update file Exif data. Only fails if nothing is modified.

Parameters
transformtransformation id,
idsCsv list of file ids
Returns
QStringList Error message or "OK"

Definition at line 1476 of file imagemanager.cpp.

◆ HandleDirs()

template<class DBFS >
QStringList ImageHandler< DBFS >::HandleDirs ( const QString &  destId,
bool  rescan,
const QStringList &  relPaths 
) const

Creates new image directories.

Creates dirs in filesystem and optionally updates Db.

Parameters
destIdParent dir
rescanWhether to start a scan after creating the dirs
relPathsList of relative paths of new dirs
Returns
QStringList Error message or "OK"

Definition at line 1523 of file imagemanager.cpp.

◆ HandleCover()

template<class DBFS >
QStringList ImageHandler< DBFS >::HandleCover ( int  dir,
int  cover 
) const

Updates/resets cover thumbnail for an image dir.

Parameters
dirDirectory id
coverId to use as cover. 0 resets dir to use its own thumbnail
Returns
QStringList Error message or "OK"

Definition at line 1579 of file imagemanager.cpp.

◆ HandleIgnore()

template<class DBFS >
QStringList ImageHandler< DBFS >::HandleIgnore ( const QString &  exclusions) const

Updates exclusion list for images.

Stores new exclusions setting & rescans. Exclusions is a global setting that dictates which files the scanner ignores. However it is set by any client (last writer wins). Glob characters * and ? are valid.

Parameters
exclusionsCsv list of exclusion patterns
Returns
QStringList Error message or "OK"

Definition at line 1602 of file imagemanager.cpp.

Referenced by MainServer::ProcessRequestWork().

◆ HandleScanRequest()

template<class DBFS >
QStringList ImageHandler< DBFS >::HandleScanRequest ( const QString &  command,
int  devId = DEVICE_INVALID 
) const

Process scan requests.

Handles start scan, stop scan, clear Db and scan progress queries

Parameters
commandIMAGE_SCAN, START | STOP | QUERY | CLEAR
devIdDevice id. Only used for CLEAR
Returns
QStringList Error message or "OK"

Definition at line 1622 of file imagemanager.cpp.

Referenced by Image::GetSyncStatus(), MainServer::ProcessRequestWork(), Image::StartSync(), and Image::StopSync().

◆ HandleCreateThumbnails()

template<class DBFS >
QStringList ImageHandler< DBFS >::HandleCreateThumbnails ( const QStringList &  message) const

Creates thumbnails on-demand.

Display requests are the highest priority. Thumbnails required for an image node will be created before those that are part of a directory thumbnail. A THUMBNAIL_CREATED event is broadcast for each image.

Parameters
messageFor Directory flag, image id

Definition at line 1668 of file imagemanager.cpp.

Referenced by Image::CreateThumbnail(), and MainServer::customEvent().

◆ HandleGetMetadata()

template<class DBFS >
QStringList ImageHandler< DBFS >::HandleGetMetadata ( const QString &  id) const

Read meta data for an image.

Reads exif tags from a picture or FFMPEG video tags

Parameters
idImage id
Returns
QStringList Error message or "OK", seperator token, list of <tag name><seperator><tag value>. Clients must use the embedded seperator to split the tags.

Definition at line 1178 of file imagemanager.cpp.

Referenced by MainServer::customEvent().

◆ RemoveFiles()

template<class DBFS >
void ImageHandler< DBFS >::RemoveFiles ( ImageList images) const
protected

Deletes images and dirs from the filesystem.

Dirs will only be deleted if empty. Items are deleted in reverse order so that parent dirs at front of list will be empty once their subdirs at back of list have been deleted. Files/dirs that failed to delete are removed from the list.

Parameters
[in,out]imagesList of images/dirs to delete. On return the files that were successfully deleted.

Definition at line 1700 of file imagemanager.cpp.

Member Data Documentation

◆ m_thumbGen

template<class DBFS >
ImageThumb<DBFS>* ImageHandler< DBFS >::m_thumbGen {nullptr}
protected

Thumbnail generator.

Definition at line 371 of file imagemanager.h.

◆ m_scanner

template<class DBFS >
ImageScanThread<DBFS>* ImageHandler< DBFS >::m_scanner {nullptr}
protected

File scanner.

Definition at line 372 of file imagemanager.h.


The documentation for this class was generated from the following files: