Sayonara Player
Public Member Functions | Static Public Member Functions | List of all members
Cover::Location Class Reference

#include <CoverLocation.h>

Detailed Description

The CoverLocation class.

Public Member Functions

 Location (const Location &cl)
 
Locationoperator= (const Location &cl)
 
bool valid () const
 returns if the current location is a valid or a standard constructed location More...
 
QStringList local_paths () const
 returns paths of images in the directory where the soundfiles are located. More...
 
void add_local_path (const QString &path)
 adds an local path to other local paths More...
 
QString preferred_path () const
 Returns the most suitable path for covers. Usually this is the first of local_paths(). If not, the cover_path() is taken. If this file does not exist either, the fallback path is returned (logo) More...
 
QString cover_path () const
 Returns the standard cover path in the .Sayonara directory. More...
 
QString identifer () const
 This identifier may be used in order to check how the cover algorithm determined the locations. More...
 
QStringList search_urls () const
 Retrieve the urls where a new cover can be searched. More...
 
bool has_search_urls () const
 Check for existing search urls. More...
 
QMap< QString, QString > all_search_urls () const
 
QString search_term () const
 Search term for a free search. As a human you would type that search term into your browser. More...
 
void set_search_term (const QString &search_term)
 Set a new search term. More...
 
void set_search_term (const QString &search_term, const QString &cover_fetcher_identifier)
 
void set_search_urls (const QStringList &urls)
 
QString to_string () const
 to_string More...
 

Static Public Member Functions

static bool is_invalid (const QString &cover_path)
 returns if path is the same as the invalid location path More...
 
static Location cover_location (const QString &album_name, const QString &artist_name)
 creates CoverLocation by taking the md5 sum between album_name and artist_name More...
 
static Location cover_location (const QString &album_name, const QStringList &artists)
 overloaded. Picks major artist out of artists and calls cover_location(const QString& album_name, const QString& artist_name) More...
 
static Location cover_location (const Album &album)
 overloaded. Calls cover_location(const QString& album_name, const QStringList& artists) More...
 
static Location cover_location (const QString &artist)
 Creates cover token of the form artist_<md5sum of artist> More...
 
static Location cover_location (const Artist &artist)
 overloaded. extracts artist name and calls cover_location(const QString& artist) More...
 
static Location cover_location (const MetaData &md)
 overloaded. if MetaData::album_id < 0 calls cover_location(const QString& album_name, const QString& artist_name) else extract Album from database and calls cover_location(const Album& album) More...
 
static Location cover_location (const QUrl &url, const QString &target_path)
 fetch a cover from a specific url More...
 
static Location invalid_location ()
 returns an invalid location More...
 
static QString get_cover_directory (const QString &append_path)
 returns the standard cover directory More...
 

Member Function Documentation

◆ add_local_path()

void Cover::Location::add_local_path ( const QString &  path)

adds an local path to other local paths

Parameters
pathnew path

◆ cover_location() [1/7]

static Location Cover::Location::cover_location ( const QString &  album_name,
const QString &  artist_name 
)
static

creates CoverLocation by taking the md5 sum between album_name and artist_name

Parameters
album_nameAlbum name
artist_nameArtist name
Returns
CoverLocation object

◆ cover_location() [2/7]

static Location Cover::Location::cover_location ( const QString &  album_name,
const QStringList &  artists 
)
static

overloaded. Picks major artist out of artists and calls cover_location(const QString& album_name, const QString& artist_name)

Parameters
album_nameAlbum name
artistsList of artists
Returns
CoverLocation object

◆ cover_location() [3/7]

static Location Cover::Location::cover_location ( const Album album)
static

overloaded. Calls cover_location(const QString& album_name, const QStringList& artists)

Parameters
album
Returns
CoverLocation object

◆ cover_location() [4/7]

static Location Cover::Location::cover_location ( const QString &  artist)
static

Creates cover token of the form artist_<md5sum of artist>

Parameters
artistArtist name
Returns
CoverLocation object

◆ cover_location() [5/7]

static Location Cover::Location::cover_location ( const Artist artist)
static

overloaded. extracts artist name and calls cover_location(const QString& artist)

Parameters
artistArtist object
Returns
CoverLocation object

◆ cover_location() [6/7]

static Location Cover::Location::cover_location ( const MetaData md)
static

overloaded. if MetaData::album_id < 0 calls cover_location(const QString& album_name, const QString& artist_name) else extract Album from database and calls cover_location(const Album& album)

Parameters
Metadataobject
Returns
CoverLocation object

◆ cover_location() [7/7]

static Location Cover::Location::cover_location ( const QUrl &  url,
const QString &  target_path 
)
static

fetch a cover from a specific url

Parameters
urlurl, the cover has to be fetched from
target_pathpath where the found image has to be saved
Returns
CoverLocation object

◆ cover_path()

QString Cover::Location::cover_path ( ) const

Returns the standard cover path in the .Sayonara directory.

Returns

◆ get_cover_directory()

static QString Cover::Location::get_cover_directory ( const QString &  append_path)
static

returns the standard cover directory

Returns
usually ~/.Sayonara/covers

◆ has_search_urls()

bool Cover::Location::has_search_urls ( ) const

Check for existing search urls.

Returns

◆ identifer()

QString Cover::Location::identifer ( ) const

This identifier may be used in order to check how the cover algorithm determined the locations.

Returns

◆ invalid_location()

static Location Cover::Location::invalid_location ( )
static

returns an invalid location

Returns
CoverLocation object

◆ is_invalid()

static bool Cover::Location::is_invalid ( const QString &  cover_path)
static

returns if path is the same as the invalid location path

Parameters
cover_paththe path to be compared
Returns

◆ local_paths()

QStringList Cover::Location::local_paths ( ) const

returns paths of images in the directory where the soundfiles are located.

Returns

◆ preferred_path()

QString Cover::Location::preferred_path ( ) const

Returns the most suitable path for covers. Usually this is the first of local_paths(). If not, the cover_path() is taken. If this file does not exist either, the fallback path is returned (logo)

Returns

◆ search_term()

QString Cover::Location::search_term ( ) const

Search term for a free search. As a human you would type that search term into your browser.

Returns

◆ search_urls()

QStringList Cover::Location::search_urls ( ) const

Retrieve the urls where a new cover can be searched.

Returns

◆ set_search_term()

void Cover::Location::set_search_term ( const QString &  search_term)

Set a new search term.

Parameters
search_term

◆ to_string()

QString Cover::Location::to_string ( ) const

to_string

Returns

◆ valid()

bool Cover::Location::valid ( ) const

returns if the current location is a valid or a standard constructed location

Returns