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

#include <CoverLocation.h>

Detailed Description

The CoverLocation class.

Public Types

enum  CoverSourceType {
  Invalid =0,
  SayonaraCoverDir,
  LocalPath,
  AudioFile
}
 

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...
 
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...
 
const QStringList & search_urls () const
 Retrieve the urls where a new cover can be searched. More...
 
QString search_url (int idx) const
 
bool has_search_urls () const
 Check for existing search urls. More...
 
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)
 
void enable_freetext_search (bool b)
 
bool is_freetext_search_enabled () const
 
QString to_string () const
 to_string More...
 
QString hash () const
 
void set_hash (const QString &str)
 
bool has_audio_file_source () const
 
QString audio_file_source () const
 
QString audio_file_target () const
 
bool set_audio_file_source (const QString &audio_file_source, const QString &cover_path)
 
QString local_path_hint () const
 
void set_local_path_hint (const QString &base_path)
 
QString preferred_path () const
 

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

◆ 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

◆ 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()

const 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