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 isValid () const
 returns if the current location is a valid or a standard constructed location More...
 
QString hashPath () 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::UrlsearchUrls () const
 Retrieve the urls where a new cover can be searched. More...
 
bool hasSearchUrls () const
 Check for existing search urls. More...
 
QString searchTerm () const
 Search term for a free search. As a human you would type that search term into your browser. More...
 
void setSearchTerm (const QString &searchTerm)
 Set a new search term. More...
 
void setSearchTerm (const QString &searchTerm, const QString &coverFetcherIdentifier)
 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 setSearchUrls (const QList< Fetcher::Url > &urls)
 Set urls where to look for Covers in the internet. More...
 
void enableFreetextSearch (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...
 
QString toString () 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 hasAudioFileSource () 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 audioFileSource () 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 audioFileTarget () 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 localPathDir () const
 Calculates the directory where the cover is located. More...
 
QStringList localPathHints () const
 Get the paths audio file where a cover is stored in the same directory. More...
 
QString localPath () 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 preferredPath () const
 Use this to retrieve a filepath where a copy of the cover is stored. More...
 
QString alternativePath () const
 

Static Public Member Functions

static Location coverLocation (const QString &albumName, const QString &artistName)
 creates CoverLocation by taking the md5 sum between albumName and artistName More...
 
static Location coverLocation (const QString &albumName, const QStringList &artists)
 overloaded. Picks major artist out of artists and calls coverLocation(const QString& albumName, const QString& artistName) More...
 
static Location xcoverLocation (const Album &album)
 overloaded. Calls coverLocation(const QString& albumName, const QStringList& artists) More...
 
static Location coverLocation (const QString &artist)
 Creates cover token of the form artist_<md5sum of artist> More...
 
static Location coverLocationRadio (const QString &radioStation)
 
static Location coverLocation (const Artist &artist)
 overloaded. extracts artist name and calls coverLocation(const QString& artist) More...
 
static Location coverLocation (const MetaData &md)
 overloaded. if MetaData::albumId < 0 calls coverLocation(const QString& albumName, const QString& artistName) else extract Album from database and calls coverLocation(const Album& album) More...
 
static Location coverLocation (const MetaData &md, bool checkForCoverart)
 
static Location coverLocation (const QList< QUrl > &urls, const QString &token)
 fetch a cover from a specific url More...
 
static QString invalidPath ()
 
static Location invalidLocation ()
 returns an invalid location More...
 

Detailed Description

The CoverLocation class.

Member Function Documentation

◆ audioFileSource()

QString Cover::Location::audioFileSource ( ) 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

◆ audioFileTarget()

QString Cover::Location::audioFileTarget ( ) 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

◆ coverLocation() [1/6]

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

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

Parameters
artistArtist object
Returns
CoverLocation object

◆ coverLocation() [2/6]

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

overloaded. if MetaData::albumId < 0 calls coverLocation(const QString& albumName, const QString& artistName) else extract Album from database and calls coverLocation(const Album& album)

Parameters
Metadataobject
Returns
CoverLocation object

◆ coverLocation() [3/6]

static Location Cover::Location::coverLocation ( const QList< QUrl > &  urls,
const QString &  token 
)
static

fetch a cover from a specific url

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

◆ coverLocation() [4/6]

static Location Cover::Location::coverLocation ( const QString &  albumName,
const QString &  artistName 
)
static

creates CoverLocation by taking the md5 sum between albumName and artistName

Parameters
albumNameAlbum name
artistNameArtist name
Returns
CoverLocation object

◆ coverLocation() [5/6]

static Location Cover::Location::coverLocation ( const QString &  albumName,
const QStringList &  artists 
)
static

overloaded. Picks major artist out of artists and calls coverLocation(const QString& albumName, const QString& artistName)

Parameters
albumNameAlbum name
artistsList of artists
Returns
CoverLocation object

◆ coverLocation() [6/6]

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

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

Parameters
artistArtist name
Returns
CoverLocation object

◆ enableFreetextSearch()

void Cover::Location::enableFreetextSearch ( 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

◆ hasAudioFileSource()

bool Cover::Location::hasAudioFileSource ( ) 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

◆ 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

◆ hashPath()

QString Cover::Location::hashPath ( ) const

Returns the standard cover path in the .Sayonara directory.

Returns

◆ hasSearchUrls()

bool Cover::Location::hasSearchUrls ( ) 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

◆ invalidLocation()

static Location Cover::Location::invalidLocation ( )
static

returns an invalid location

Returns
CoverLocation object

◆ isValid()

bool Cover::Location::isValid ( ) const

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

Returns

◆ localPath()

QString Cover::Location::localPath ( ) 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

◆ localPathDir()

QString Cover::Location::localPathDir ( ) const

Calculates the directory where the cover is located.

Returns

◆ localPathHints()

QStringList Cover::Location::localPathHints ( ) const

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

Returns

◆ preferredPath()

QString Cover::Location::preferredPath ( ) const

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

Returns

◆ searchTerm()

QString Cover::Location::searchTerm ( ) const

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

Returns

◆ searchUrls()

QList<Fetcher::Url> Cover::Location::searchUrls ( ) const

Retrieve the urls where a new cover can be searched.

Returns

◆ setSearchTerm() [1/2]

void Cover::Location::setSearchTerm ( const QString &  searchTerm)

Set a new search term.

Parameters
search_term

◆ setSearchTerm() [2/2]

void Cover::Location::setSearchTerm ( const QString &  searchTerm,
const QString &  coverFetcherIdentifier 
)

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

◆ setSearchUrls()

void Cover::Location::setSearchUrls ( const QList< Fetcher::Url > &  urls)

Set urls where to look for Covers in the internet.

Parameters
urls

◆ toString()

QString Cover::Location::toString ( ) const

to_string

Returns

◆ xcoverLocation()

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

overloaded. Calls coverLocation(const QString& albumName, const QStringList& artists)

Parameters
album
Returns
CoverLocation object