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

The CoverLocation class. More...

#include <CoverLocation.h>

Public Member Functions

 Location ()
 Default constructor. Creates an invalid Location with the Sayonara logo as cover.
 
 Location (const Location &cl)
 
Locationoperator= (const Location &cl)
 
bool is_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...
 
QList< Fetcher::FetchUrlsearch_urls (bool also_inactive) const
 Retrieve the urls where a new cover can be searched. More...
 
Fetcher::FetchUrl search_url (int idx) const
 Search urls contains urls from Google, Discogs or Audioscrobbler. They are ordered as configured in the Cover preferences Dialog. More...
 
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)
 Set a new search term for a specific cover fetcher Cover fetcher strings can be found in the Cover::Fetcher::Base implementations by calling Cover::Fetcher::Base::identifier() More...
 
void set_search_urls (const QList< Fetcher::FetchUrl > &urls)
 Set urls where to look for Covers in the internet. More...
 
void enable_freetext_search (bool b)
 When enabling freetext search you specify the search string yourself and it is not generated automatically as usually. Usually, search APIs of a provider have special reserved fields for albums and artist which are populated automatically by Sayonara. More...
 
bool is_freetext_search_enabled () const
 
QString to_string () const
 to_string More...
 
QString hash () const
 Every combination of album and artist will result in a specific hash. You can find those hashes in the database, for example. More...
 
bool has_audio_file_source () const
 Indicates if it is possible to fetch the cover directly from the audio file. If you call this method very often for albums this may end up in poor performance. More...
 
QString audio_file_source () const
 Returns the path to the music file where a cover is stored. You can extract the cover by using Tagging::Covers::extract_cover. More...
 
QString audio_file_target () const
 When retrieving the audio_file_source, and you want to save it afterwards, store it at the place returned by this method. So Cover::Lookup will find it. Also see hash() More...
 
QString local_path_dir () const
 Calculates the directory where the cover is located. More...
 
QStringList local_path_hints () const
 Get the paths audio file where a cover is stored in the same directory. More...
 
QString local_path () const
 Get the path which is nearest to the audio files.
Repair/Create a link in the Sayonara cover directory This method does I/O work so handle with care. More...
 
QString preferred_path () const
 Use this to retrieve a filepath where a copy of the cover is stored. More...
 
QString alternative_path () const
 

Static Public Member Functions

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 xcover_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 MetaData &md, bool check_for_coverart)
 
static Location cover_location (const QUrl &url, const QString &target_path)
 fetch a cover from a specific url More...
 
static Location cover_location (const QList< QUrl > &urls, const QString &target_path)
 
static QString invalid_path ()
 
static Location invalid_location ()
 returns an invalid location More...
 
static QString get_cover_directory (const QString &append_path)
 returns the standard cover directory More...
 

Detailed Description

The CoverLocation class.

Member Function Documentation

◆ audio_file_source()

QString Cover::Location::audio_file_source ( ) const

Returns the path to the music file where a cover is stored. You can extract the cover by using Tagging::Covers::extract_cover.

Returns

◆ audio_file_target()

QString Cover::Location::audio_file_target ( ) const

When retrieving the audio_file_source, and you want to save it afterwards, store it at the place returned by this method. So Cover::Lookup will find it. Also see hash()

Returns

◆ cover_location() [1/6]

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/6]

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/6]

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() [4/6]

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() [5/6]

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() [6/6]

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

◆ enable_freetext_search()

void Cover::Location::enable_freetext_search ( bool  b)

When enabling freetext search you specify the search string yourself and it is not generated automatically as usually. Usually, search APIs of a provider have special reserved fields for albums and artist which are populated automatically by Sayonara.

Parameters
b

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

bool Cover::Location::has_audio_file_source ( ) const

Indicates if it is possible to fetch the cover directly from the audio file. If you call this method very often for albums this may end up in poor performance.

Returns

◆ has_search_urls()

bool Cover::Location::has_search_urls ( ) const

Check for existing search urls.

Returns

◆ hash()

QString Cover::Location::hash ( ) const

Every combination of album and artist will result in a specific hash. You can find those hashes in the database, for example.

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

bool Cover::Location::is_valid ( ) const

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

Returns

◆ local_path()

QString Cover::Location::local_path ( ) const

Get the path which is nearest to the audio files.
Repair/Create a link in the Sayonara cover directory This method does I/O work so handle with care.

Returns

◆ local_path_dir()

QString Cover::Location::local_path_dir ( ) const

Calculates the directory where the cover is located.

Returns

◆ local_path_hints()

QStringList Cover::Location::local_path_hints ( ) const

Get the paths audio file where a cover is stored in the same directory.

Returns

◆ preferred_path()

QString Cover::Location::preferred_path ( ) const

Use this to retrieve a filepath where a copy of the cover is stored.

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

Fetcher::FetchUrl Cover::Location::search_url ( int  idx) const

Search urls contains urls from Google, Discogs or Audioscrobbler. They are ordered as configured in the Cover preferences Dialog.

Parameters
idx
Returns

◆ search_urls()

QList<Fetcher::FetchUrl> Cover::Location::search_urls ( bool  also_inactive) const

Retrieve the urls where a new cover can be searched.

Returns

◆ set_search_term() [1/2]

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

Set a new search term.

Parameters
search_term

◆ set_search_term() [2/2]

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

Set a new search term for a specific cover fetcher Cover fetcher strings can be found in the Cover::Fetcher::Base implementations by calling Cover::Fetcher::Base::identifier()

Parameters
search_termA searchterm suitable for the specific Cover::Fetcher::Base. For example "Master of puppets Metallica"
cover_fetcher_identifier

◆ set_search_urls()

void Cover::Location::set_search_urls ( const QList< Fetcher::FetchUrl > &  urls)

Set urls where to look for Covers in the internet.

Parameters
urls

◆ to_string()

QString Cover::Location::to_string ( ) const

to_string

Returns

◆ xcover_location()

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

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

Parameters
album
Returns
CoverLocation object