Commit 6ff9e16c authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

ArtworkUrl -> ArtworkMrl

parent 1f9548c2
......@@ -38,7 +38,7 @@ class IAlbum
*/
virtual unsigned int releaseYear() const = 0;
virtual const std::string& shortSummary() const = 0;
virtual const std::string& artworkUrl() const = 0;
virtual const std::string& artworkMrl() const = 0;
virtual time_t lastSyncDate() const = 0;
/**
* @brief tracks fetches album tracks from the database
......
......@@ -36,5 +36,5 @@ public:
virtual const std::string& shortBio() const = 0;
virtual std::vector<AlbumPtr> albums() const = 0;
virtual std::vector<MediaPtr> media() const = 0;
virtual const std::string& artworkUrl() const = 0;
virtual const std::string& artworkMrl() const = 0;
};
......@@ -33,7 +33,7 @@ class IMovie
virtual const std::string& title() const = 0;
virtual time_t releaseDate() const = 0;
virtual const std::string& shortSummary() const = 0;
virtual const std::string& artworkUrl() const = 0;
virtual const std::string& artworkMrl() const = 0;
virtual const std::string& imdbId() const = 0;
virtual std::vector<MediaPtr> files() = 0;
};
......
......@@ -34,7 +34,7 @@ class IShow
virtual time_t releaseDate() const = 0;
virtual time_t lastSyncDate() const = 0;
virtual const std::string& shortSummary() const = 0;
virtual const std::string& artworkUrl() const = 0;
virtual const std::string& artworkMrl() const = 0;
virtual const std::string& tvdbId() = 0;
virtual std::vector<ShowEpisodePtr> episodes() = 0;
};
......
......@@ -33,7 +33,7 @@ class IShowEpisode
virtual ~IShowEpisode(){}
virtual unsigned int id() const = 0;
virtual const std::string& artworkUrl() const = 0;
virtual const std::string& artworkMrl() const = 0;
virtual unsigned int episodeNumber() const = 0;
virtual time_t lastSyncDate() const = 0;
virtual const std::string& name() const = 0;
......
......@@ -41,7 +41,7 @@ Album::Album(DBConnection dbConnection, sqlite::Row& row)
>> m_artistId
>> m_releaseYear
>> m_shortSummary
>> m_artworkUrl
>> m_artworkMrl
>> m_lastSyncDate
>> m_nbTracks
>> m_isPresent;
......@@ -122,18 +122,18 @@ bool Album::setShortSummary( const std::string& summary )
return true;
}
const std::string& Album::artworkUrl() const
const std::string& Album::artworkMrl() const
{
return m_artworkUrl;
return m_artworkMrl;
}
bool Album::setArtworkUrl( const std::string& artworkUrl )
bool Album::setArtworkMrl( const std::string& artworkMrl )
{
static const std::string req = "UPDATE " + policy::AlbumTable::Name
+ " SET artwork_url = ? WHERE id_album = ?";
if ( sqlite::Tools::executeUpdate( m_dbConnection, req, artworkUrl, m_id ) == false )
+ " SET artwork_mrl = ? WHERE id_album = ?";
if ( sqlite::Tools::executeUpdate( m_dbConnection, req, artworkMrl, m_id ) == false )
return false;
m_artworkUrl = artworkUrl;
m_artworkMrl = artworkMrl;
return true;
}
......@@ -236,7 +236,7 @@ bool Album::createTable(DBConnection dbConnection )
"artist_id UNSIGNED INTEGER,"
"release_year UNSIGNED INTEGER,"
"short_summary TEXT,"
"artwork_url TEXT,"
"artwork_mrl TEXT,"
"last_sync_date UNSIGNED INTEGER,"
"nb_tracks UNSIGNED INTEGER DEFAULT 0,"
"is_present BOOLEAN NOT NULL DEFAULT 1"
......
......@@ -69,8 +69,8 @@ class Album : public IAlbum, public DatabaseHelpers<Album, policy::AlbumTable>
bool setReleaseYear( unsigned int date, bool force );
virtual const std::string& shortSummary() const override;
bool setShortSummary( const std::string& summary );
virtual const std::string& artworkUrl() const override;
bool setArtworkUrl( const std::string& artworkUrl );
virtual const std::string& artworkMrl() const override;
bool setArtworkMrl( const std::string& artworkMrl );
virtual time_t lastSyncDate() const override;
virtual std::vector<MediaPtr> tracks() const override;
std::shared_ptr<AlbumTrack> addTrack(std::shared_ptr<Media> media, unsigned int trackNb , unsigned int discNumber);
......@@ -94,7 +94,7 @@ class Album : public IAlbum, public DatabaseHelpers<Album, policy::AlbumTable>
unsigned int m_artistId;
unsigned int m_releaseYear;
std::string m_shortSummary;
std::string m_artworkUrl;
std::string m_artworkMrl;
time_t m_lastSyncDate;
unsigned int m_nbTracks;
bool m_isPresent;
......
......@@ -38,7 +38,7 @@ Artist::Artist( DBConnection dbConnection, sqlite::Row& row )
row >> m_id
>> m_name
>> m_shortBio
>> m_artworkUrl
>> m_artworkMrl
>> m_nbAlbums
>> m_isPresent;
}
......@@ -113,20 +113,20 @@ bool Artist::addMedia(Media* media)
return sqlite::Tools::insert( m_dbConnection, req, media->id(), artistForeignKey ) != 0;
}
const std::string& Artist::artworkUrl() const
const std::string& Artist::artworkMrl() const
{
return m_artworkUrl;
return m_artworkMrl;
}
bool Artist::setArtworkUrl( const std::string& artworkUrl )
bool Artist::setArtworkMrl( const std::string& artworkMrl )
{
if ( m_artworkUrl == artworkUrl )
if ( m_artworkMrl == artworkMrl )
return true;
static const std::string req = "UPDATE " + policy::ArtistTable::Name +
" SET artwork_url = ? WHERE id_artist = ?";
if ( sqlite::Tools::executeUpdate( m_dbConnection, req, artworkUrl, m_id ) == false )
" SET artwork_mrl = ? WHERE id_artist = ?";
if ( sqlite::Tools::executeUpdate( m_dbConnection, req, artworkMrl, m_id ) == false )
return false;
m_artworkUrl = artworkUrl;
m_artworkMrl = artworkMrl;
return true;
}
......@@ -170,7 +170,7 @@ bool Artist::createTable( DBConnection dbConnection )
"id_artist INTEGER PRIMARY KEY AUTOINCREMENT,"
"name TEXT COLLATE NOCASE UNIQUE ON CONFLICT FAIL,"
"shortbio TEXT,"
"artwork_url TEXT,"
"artwork_mrl TEXT,"
"nb_albums UNSIGNED INT DEFAULT 0,"
"is_present BOOLEAN NOT NULL DEFAULT 1"
")";
......
......@@ -53,8 +53,8 @@ public:
virtual std::vector<AlbumPtr> albums() const override;
virtual std::vector<MediaPtr> media() const override;
bool addMedia( Media* media );
virtual const std::string& artworkUrl() const override;
bool setArtworkUrl( const std::string& artworkUrl );
virtual const std::string& artworkMrl() const override;
bool setArtworkMrl( const std::string& artworkMrl );
bool updateNbAlbum( int increment );
std::shared_ptr<Album> unknownAlbum();
......@@ -68,7 +68,7 @@ private:
unsigned int m_id;
std::string m_name;
std::string m_shortBio;
std::string m_artworkUrl;
std::string m_artworkMrl;
unsigned int m_nbAlbums;
bool m_isPresent;
......
......@@ -35,7 +35,7 @@ Movie::Movie(DBConnection dbConnection, sqlite::Row& row )
>> m_title
>> m_releaseDate
>> m_summary
>> m_artworkUrl
>> m_artworkMrl
>> m_imdbId;
}
......@@ -87,18 +87,18 @@ bool Movie::setShortSummary( const std::string& summary )
return true;
}
const std::string&Movie::artworkUrl() const
const std::string&Movie::artworkMrl() const
{
return m_artworkUrl;
return m_artworkMrl;
}
bool Movie::setArtworkUrl( const std::string& artworkUrl )
bool Movie::setArtworkMrl( const std::string& artworkMrl )
{
static const std::string req = "UPDATE " + policy::MovieTable::Name
+ " SET artwork_url = ? WHERE id_movie = ?";
if ( sqlite::Tools::executeUpdate( m_dbConnection, req, artworkUrl, m_id ) == false )
+ " SET artwork_mrl = ? WHERE id_movie = ?";
if ( sqlite::Tools::executeUpdate( m_dbConnection, req, artworkMrl, m_id ) == false )
return false;
m_artworkUrl = artworkUrl;
m_artworkMrl = artworkMrl;
return true;
}
......@@ -132,7 +132,7 @@ bool Movie::createTable( DBConnection dbConnection )
"title TEXT UNIQUE ON CONFLICT FAIL,"
"release_date UNSIGNED INTEGER,"
"summary TEXT,"
"artwork_url TEXT,"
"artwork_mrl TEXT,"
"imdb_id TEXT"
")";
return sqlite::Tools::executeRequest( dbConnection, req );
......
......@@ -51,8 +51,8 @@ class Movie : public IMovie, public DatabaseHelpers<Movie, policy::MovieTable>
bool setReleaseDate(time_t date);
virtual const std::string& shortSummary() const override;
bool setShortSummary(const std::string& summary);
virtual const std::string& artworkUrl() const override;
bool setArtworkUrl(const std::string& artworkUrl);
virtual const std::string& artworkMrl() const override;
bool setArtworkMrl(const std::string& artworkMrl);
virtual const std::string& imdbId() const override;
bool setImdbId(const std::string& imdbId);
virtual std::vector<MediaPtr> files() override;
......@@ -66,7 +66,7 @@ class Movie : public IMovie, public DatabaseHelpers<Movie, policy::MovieTable>
std::string m_title;
time_t m_releaseDate;
std::string m_summary;
std::string m_artworkUrl;
std::string m_artworkMrl;
std::string m_imdbId;
friend struct policy::MovieTable;
......
......@@ -35,7 +35,7 @@ Show::Show( DBConnection dbConnection, sqlite::Row& row )
>> m_name
>> m_releaseDate
>> m_shortSummary
>> m_artworkUrl
>> m_artworkMrl
>> m_lastSyncDate
>> m_tvdbId;
}
......@@ -88,18 +88,18 @@ bool Show::setShortSummary( const std::string& summary )
return true;
}
const std::string& Show::artworkUrl() const
const std::string& Show::artworkMrl() const
{
return m_artworkUrl;
return m_artworkMrl;
}
bool Show::setArtworkUrl( const std::string& artworkUrl )
bool Show::setArtworkMrl( const std::string& artworkMrl )
{
static const std::string req = "UPDATE " + policy::ShowTable::Name
+ " SET artwork_url = ? WHERE id_show = ?";
if ( sqlite::Tools::executeUpdate( m_dbConnection, req, artworkUrl, m_id ) == false )
+ " SET artwork_mrl = ? WHERE id_show = ?";
if ( sqlite::Tools::executeUpdate( m_dbConnection, req, artworkMrl, m_id ) == false )
return false;
m_artworkUrl = artworkUrl;
m_artworkMrl = artworkMrl;
return true;
}
......@@ -142,7 +142,7 @@ bool Show::createTable(DBConnection dbConnection)
"name TEXT, "
"release_date UNSIGNED INTEGER,"
"short_summary TEXT,"
"artwork_url TEXT,"
"artwork_mrl TEXT,"
"last_sync_date UNSIGNED INTEGER,"
"tvdb_id TEXT"
")";
......
......@@ -54,8 +54,8 @@ class Show : public IShow, public DatabaseHelpers<Show, policy::ShowTable>
bool setReleaseDate( time_t date );
virtual const std::string& shortSummary() const override;
bool setShortSummary( const std::string& summary );
virtual const std::string& artworkUrl() const override;
bool setArtworkUrl( const std::string& artworkUrl );
virtual const std::string& artworkMrl() const override;
bool setArtworkMrl( const std::string& artworkMrl );
virtual time_t lastSyncDate() const override;
virtual const std::string& tvdbId() override;
bool setTvdbId( const std::string& summary );
......@@ -71,7 +71,7 @@ class Show : public IShow, public DatabaseHelpers<Show, policy::ShowTable>
std::string m_name;
time_t m_releaseDate;
std::string m_shortSummary;
std::string m_artworkUrl;
std::string m_artworkMrl;
time_t m_lastSyncDate;
std::string m_tvdbId;
......
......@@ -33,7 +33,7 @@ ShowEpisode::ShowEpisode(DBConnection dbConnection, sqlite::Row& row )
: m_dbConnection( dbConnection )
{
row >> m_id
>> m_artworkUrl
>> m_artworkMrl
>> m_episodeNumber
>> m_lastSyncDate
>> m_name
......@@ -57,18 +57,18 @@ unsigned int ShowEpisode::id() const
return m_id;
}
const std::string& ShowEpisode::artworkUrl() const
const std::string& ShowEpisode::artworkMrl() const
{
return m_artworkUrl;
return m_artworkMrl;
}
bool ShowEpisode::setArtworkUrl( const std::string& artworkUrl )
bool ShowEpisode::setArtworkMrl( const std::string& artworkMrl )
{
static const std::string req = "UPDATE " + policy::ShowEpisodeTable::Name
+ " SET artwork_url = ? WHERE id_episode = ?";
if ( sqlite::Tools::executeUpdate( m_dbConnection, req, artworkUrl, m_id ) == false )
+ " SET artwork_mrl = ? WHERE id_episode = ?";
if ( sqlite::Tools::executeUpdate( m_dbConnection, req, artworkMrl, m_id ) == false )
return false;
m_artworkUrl = artworkUrl;
m_artworkMrl = artworkMrl;
return true;
}
......@@ -153,7 +153,7 @@ bool ShowEpisode::createTable( DBConnection dbConnection )
const std::string req = "CREATE TABLE IF NOT EXISTS " + policy::ShowEpisodeTable::Name
+ "("
"id_episode INTEGER PRIMARY KEY AUTOINCREMENT,"
"artwork_url TEXT,"
"artwork_mrl TEXT,"
"episode_number UNSIGNED INT,"
"last_sync_date UNSIGNED INT,"
"title TEXT,"
......
......@@ -50,8 +50,8 @@ class ShowEpisode : public IShowEpisode, public DatabaseHelpers<ShowEpisode, pol
ShowEpisode(const std::string& name, unsigned int episodeNumber, unsigned int showId );
virtual unsigned int id() const override;
virtual const std::string& artworkUrl() const override;
bool setArtworkUrl( const std::string& artworkUrl );
virtual const std::string& artworkMrl() const override;
bool setArtworkMrl( const std::string& artworkMrl );
virtual unsigned int episodeNumber() const override;
virtual time_t lastSyncDate() const override;
virtual const std::string& name() const override;
......@@ -70,7 +70,7 @@ class ShowEpisode : public IShowEpisode, public DatabaseHelpers<ShowEpisode, pol
private:
DBConnection m_dbConnection;
unsigned int m_id;
std::string m_artworkUrl;
std::string m_artworkMrl;
unsigned int m_episodeNumber;
time_t m_lastSyncDate;
std::string m_name;
......
......@@ -308,7 +308,7 @@ std::shared_ptr<Album> VLCMetadataService::handleAlbum( std::shared_ptr<Media> m
{
auto artwork = vlcMedia.meta( libvlc_meta_ArtworkURL );
if ( artwork.length() != 0 )
album->setArtworkUrl( artwork );
album->setArtworkMrl( artwork );
}
}
}
......@@ -452,8 +452,8 @@ bool VLCMetadataService::link( std::shared_ptr<Media> media, std::shared_ptr<Alb
// If we have an albumArtist (meaning the track was properly tagged, we
// can assume this artist is a correct match. We can use the thumbnail from
// the current album for the albumArtist, if none has been set before.
if ( albumArtist != nullptr && albumArtist->artworkUrl().empty() == true && album != nullptr )
albumArtist->setArtworkUrl( album->artworkUrl() );
if ( albumArtist != nullptr && albumArtist->artworkMrl().empty() == true && album != nullptr )
albumArtist->setArtworkMrl( album->artworkMrl() );
if ( albumArtist != nullptr )
albumArtist->addMedia( media.get() );
......
......@@ -151,17 +151,17 @@ TEST_F( Albums, SetShortSummary )
ASSERT_EQ( a->shortSummary(), a2->shortSummary() );
}
TEST_F( Albums, SetArtworkUrl )
TEST_F( Albums, SetArtworkMrl )
{
auto a = ml->createAlbum( "album" );
a->setArtworkUrl( "artwork" );
ASSERT_EQ( a->artworkUrl(), "artwork" );
a->setArtworkMrl( "artwork" );
ASSERT_EQ( a->artworkMrl(), "artwork" );
Reload();
auto a2 = ml->album( a->id() );
ASSERT_EQ( a->artworkUrl(), a2->artworkUrl() );
ASSERT_EQ( a->artworkMrl(), a2->artworkMrl() );
}
TEST_F( Albums, FetchAlbumFromTrack )
......
......@@ -71,21 +71,21 @@ TEST_F( Artists, ShortBio )
ASSERT_EQ( a2->shortBio(), bio );
}
TEST_F( Artists, ArtworkUrl )
TEST_F( Artists, ArtworkMrl )
{
auto a = ml->createArtist( "Dream seaotter" );
ASSERT_NE( a, nullptr );
ASSERT_EQ( a->artworkUrl(), "" );
ASSERT_EQ( a->artworkMrl(), "" );
std::string artwork("/tmp/otter.png");
a->setArtworkUrl( artwork );
ASSERT_EQ( a->artworkUrl(), artwork );
a->setArtworkMrl( artwork );
ASSERT_EQ( a->artworkMrl(), artwork );
Reload();
auto a2 = ml->artist( "Dream seaotter" );
ASSERT_NE( a2, nullptr );
ASSERT_EQ( a2->artworkUrl(), artwork );
ASSERT_EQ( a2->artworkMrl(), artwork );
}
TEST_F( Artists, Albums )
......
......@@ -77,17 +77,17 @@ TEST_F( Movies, SetShortSummary )
ASSERT_EQ( m2->shortSummary(), "great movie" );
}
TEST_F( Movies, SetArtworkUrl )
TEST_F( Movies, SetArtworkMrl )
{
auto m = ml->createMovie( "movie" );
ASSERT_EQ( m->artworkUrl().length(), 0u );
m->setArtworkUrl( "artwork" );
ASSERT_EQ( m->artworkUrl(), "artwork" );
ASSERT_EQ( m->artworkMrl().length(), 0u );
m->setArtworkMrl( "artwork" );
ASSERT_EQ( m->artworkMrl(), "artwork" );
Reload();
auto m2 = ml->movie( "movie" );
ASSERT_EQ( m2->artworkUrl(), "artwork" );
ASSERT_EQ( m2->artworkMrl(), "artwork" );
}
TEST_F( Movies, SetImdbId )
......
......@@ -81,17 +81,17 @@ TEST_F( Shows, SetShortSummary )
ASSERT_EQ( s->shortSummary(), s2->shortSummary() );
}
TEST_F( Shows, SetArtworkUrl )
TEST_F( Shows, SetArtworkMrl )
{
auto s = ml->createShow( "show" );
s->setArtworkUrl( "artwork" );
ASSERT_EQ( s->artworkUrl(), "artwork" );
s->setArtworkMrl( "artwork" );
ASSERT_EQ( s->artworkMrl(), "artwork" );
Reload();
auto s2 = ml->show( "show" );
ASSERT_EQ( s->artworkUrl(), s2->artworkUrl() );
ASSERT_EQ( s->artworkMrl(), s2->artworkMrl() );
}
TEST_F( Shows, SetTvdbId )
......@@ -152,15 +152,15 @@ TEST_F( Shows, SetEpisodeArtwork )
{
auto show = ml->createShow( "show" );
auto e = show->addEpisode( "episode 1", 1 );
bool res = e->setArtworkUrl( "path-to-art" );
bool res = e->setArtworkMrl( "path-to-art" );
ASSERT_TRUE( res );
ASSERT_EQ( e->artworkUrl(), "path-to-art" );
ASSERT_EQ( e->artworkMrl(), "path-to-art" );
Reload();
show = std::static_pointer_cast<Show>( ml->show( "show" ) );
auto episodes = show->episodes();
ASSERT_EQ( episodes[0]->artworkUrl(), e->artworkUrl() );
ASSERT_EQ( episodes[0]->artworkMrl(), e->artworkMrl() );
}
TEST_F( Shows, SetEpisodeSeasonNumber )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment