|
MythTV master
|
Database API. More...
#include <libmythmetadata/imagemanager.h>
Public Member Functions | |
| int | GetImages (const QString &ids, ImageList &files, ImageList &dirs, const QString &refine="") const |
| Read database images/dirs by id. More... | |
| bool | GetDescendants (const QString &ids, ImageList &files, ImageList &dirs) const |
| Return images and all of their descendants. More... | |
| int | InsertDbImage (ImageItemK &im, bool checkForDuplicate=false) const |
| Adds new image to database, optionally checking for existing filepath. More... | |
| bool | UpdateDbImage (ImageItemK &im) const |
| Updates or creates database image or dir. More... | |
| QStringList | RemoveFromDB (const ImageList &imList) const |
| Remove images/dirs from database. More... | |
| bool | SetHidden (bool hide, const QString &ids) const |
| Sets hidden status of an image/dir in database. More... | |
| bool | SetCover (int dir, int id) const |
| Set the thumbnail(s) to be used for a dir. More... | |
| bool | SetOrientation (int id, int orientation) const |
| Sets image orientation in Db. More... | |
| bool | ReadAllImages (ImageHash &files, ImageHash &dirs) const |
| Read all database images and dirs as map. No filters or ordering applied. More... | |
| void | ClearDb (int devId, const QString &action) |
| Clear Db for device & remove device. More... | |
| int | GetChildren (const QString &ids, ImageList &files, ImageList &dirs, const QString &refine="") const |
| Read immediate children of a dir. More... | |
| bool | GetImageTree (int id, ImageList &files, const QString &refine) const |
| Returns all files in the sub-tree of a dir. More... | |
| int | GetDirectory (int id, ImagePtr &parent, ImageList &files, ImageList &dirs, const QString &refine) const |
| Read a dir and its immediate children from Db. More... | |
| void | GetDescendantCount (int id, bool all, int &dirs, int &pics, int &videos, int &sizeKb) const |
| Return counts of dirs, pics, videos and size in the subtree of a dir. More... | |
Protected Member Functions | |
| ImageDb (QString table) | |
| ImageItem * | CreateImage (const MSqlQuery &query) const |
| Create image from Db query data. More... | |
| int | ReadImages (ImageList &dirs, ImageList &files, const QString &selector) const |
| Read selected database images/dirs. More... | |
Protected Attributes | |
| QString | m_table |
| Db table name. More... | |
Database API.
Requires a filesystem adapter Only handles a single id format, ie. local ids or remote ids Provides ordering & filters (SQL does the work)
Definition at line 273 of file imagemanager.h.
Definition at line 303 of file imagemanager.h.
| void ImageDb< FS >::ClearDb | ( | int | devId, |
| const QString & | action | ||
| ) |
Clear Db for device & remove device.
| devId | Device id, 0 to clear all devices |
| action | The myth protocol message. Determines whether/how much information is removed from the database. |
Definition at line 756 of file imagemanager.cpp.
|
protected |
Create image from Db query data.
| query | Db query result |
Definition at line 533 of file imagemanager.cpp.
| int ImageDb< FS >::GetChildren | ( | const QString & | ids, |
| ImageList & | files, | ||
| ImageList & | dirs, | ||
| const QString & | refine = "" |
||
| ) | const |
Read immediate children of a dir.
| [in,out] | dirs | List of child subdirs |
| [in,out] | files | List of child files |
| [in] | ids | Comma-separated list of dir ids |
| [in] | refine | SQL clause to refine selection & apply ordering |
Definition at line 596 of file imagemanager.cpp.
Referenced by ImageDbReader::GetChildren().
| void ImageDb< FS >::GetDescendantCount | ( | int | id, |
| bool | all, | ||
| int & | dirs, | ||
| int & | pics, | ||
| int & | videos, | ||
| int & | sizeKb | ||
| ) | const |
Return counts of dirs, pics, videos and size in the subtree of a dir.
| [in] | id | Dir id |
| [in] | all | Sum whole table (without filtering on dir path) |
| [in,out] | dirs | Number of dirs in parent sub-tree |
| [in,out] | pics | Number of pictures in parent sub-tree |
| [in,out] | videos | Number of videos in parent sub-tree |
| [in,out] | sizeKb | Size in KiB of parent sub-tree |
Definition at line 1034 of file imagemanager.cpp.
Referenced by ImageDbReader::GetDescendantCount().
| bool ImageDb< FS >::GetDescendants | ( | const QString & | ids, |
| ImageList & | files, | ||
| ImageList & | dirs | ||
| ) | const |
Return images and all of their descendants.
| [in] | ids | Image ids |
| [in,out] | files | Ordered/filtered files |
| [in,out] | dirs | Ordered/filtered dirs |
Definition at line 656 of file imagemanager.cpp.
Referenced by ImageDbReader::GetDescendants().
| int ImageDb< FS >::GetDirectory | ( | int | id, |
| ImagePtr & | parent, | ||
| ImageList & | files, | ||
| ImageList & | dirs, | ||
| const QString & | refine | ||
| ) | const |
Read a dir and its immediate children from Db.
| [in] | id | Dir id |
| [out] | parent | Dir item |
| [in,out] | dirs | Ordered/filtered child subdirs |
| [in,out] | files | Ordered/filtered child files |
| [in] | refine | SQL clause for filtering/ordering child images |
Definition at line 614 of file imagemanager.cpp.
Referenced by ImageDbReader::GetDirectory().
| int ImageDb< FS >::GetImages | ( | const QString & | ids, |
| ImageList & | files, | ||
| ImageList & | dirs, | ||
| const QString & | refine = "" |
||
| ) | const |
Read database images/dirs by id.
| [in] | ids | Comma-separated list of ids |
| [in,out] | files | List of files |
| [in,out] | dirs | List of dirs |
| [in] | refine | SQL clause to refine selection & apply ordering |
Definition at line 576 of file imagemanager.cpp.
Referenced by ImageDbReader::GetImages().
| bool ImageDb< FS >::GetImageTree | ( | int | id, |
| ImageList & | files, | ||
| const QString & | refine | ||
| ) | const |
Returns all files in the sub-tree of a dir.
| [in,out] | files | List of images within sub-tree. Direct children first, then depth-first traversal of peer sub-dirs. Each level ordered as per refine criteria |
| id | Dir id | |
| refine | SQL clause defining filter & ordering criteria |
Definition at line 705 of file imagemanager.cpp.
Referenced by ImageDbReader::GetImageTree().
| int ImageDb< FS >::InsertDbImage | ( | ImageItemK & | im, |
| bool | checkForDuplicate = false |
||
| ) | const |
Adds new image to database, optionally checking for existing filepath.
| im | Image to add |
| checkForDuplicate | If true, the image will not be added if its filepath already exists in Db. |
Definition at line 792 of file imagemanager.cpp.
Read all database images and dirs as map. No filters or ordering applied.
| [in,out] | files | Map <filepath, image> |
| [in,out] | dirs | Map <filepath, dir> |
Definition at line 725 of file imagemanager.cpp.
|
protected |
Read selected database images/dirs.
| [out] | dirs | List of the dirs |
| [out] | files | List of the files |
| selector | SQL clause specifying selection and ordering of images |
Definition at line 999 of file imagemanager.cpp.
Remove images/dirs from database.
Item does not need to exist in db
| imList | List of items to delete |
Definition at line 893 of file imagemanager.cpp.
Set the thumbnail(s) to be used for a dir.
| dir | Dir id |
| id | Image id to use as cover/thumbnail |
Definition at line 949 of file imagemanager.cpp.
Sets hidden status of an image/dir in database.
| hide | True = hidden, False = unhidden |
| ids | List of item ids |
Definition at line 923 of file imagemanager.cpp.
Sets image orientation in Db.
| id | Image id |
| orientation | Exif orientation code |
Definition at line 973 of file imagemanager.cpp.
| bool ImageDb< FS >::UpdateDbImage | ( | ImageItemK & | im | ) | const |
Updates or creates database image or dir.
Item does not need to pre-exist
| im | Image or dir |
Definition at line 850 of file imagemanager.cpp.
|
protected |
Db table name.
Definition at line 309 of file imagemanager.h.