Commit e8508b1c authored by Duncan McNamara's avatar Duncan McNamara
Browse files

Subscriptions: add fromId getter

Usefull for instanciating Subscriptions in a JNI context for the VLC
Android app.
parent e4cb2110
......@@ -1104,6 +1104,7 @@ public:
*/
virtual ServicePtr service( IService::Type type ) const = 0;
virtual SubscriptionPtr subscription( uint64_t id ) const = 0;
/**
* @brief setSubscriptionMaxCachedMedia Sets the maximum number of cached media
* for each subscription
......
......@@ -2595,6 +2595,11 @@ ServicePtr MediaLibrary::service( IService::Type type ) const
return Service::fetch( this, type );
}
SubscriptionPtr MediaLibrary::subscription( uint64_t id ) const
{
return Subscription::fetch( this, id );
}
bool MediaLibrary::setSubscriptionMaxCachedMedia( uint32_t nbCachedMedia )
{
return m_settings.setNbCachedMediaPerSubscription( nbCachedMedia );
......
......@@ -270,6 +270,7 @@ public:
virtual void cacheNewSubscriptionMedia() override;
virtual ServicePtr service( IService::Type type ) const override;
virtual SubscriptionPtr subscription(uint64_t id) const override;
virtual bool setSubscriptionMaxCachedMedia( uint32_t nbCachedMedia ) override;
virtual bool setSubscriptionMaxCacheSize( uint64_t maxCacheSize ) override;
......
......@@ -603,6 +603,11 @@ std::shared_ptr<Subscription> Subscription::fromFile( MediaLibraryPtr ml, int64_
return fetch( ml, req, fileId );
}
SubscriptionPtr Subscription::fromId( MediaLibraryPtr ml, int64_t id)
{
return fetch( ml, id );
}
std::string Subscription::orderBy( const QueryParameters* params )
{
auto desc = params != nullptr && params->desc;
......
......@@ -154,6 +154,7 @@ public:
const QueryParameters* params );
static std::shared_ptr<Subscription> fromFile( MediaLibraryPtr ml, int64_t fileId );
static SubscriptionPtr fromId( MediaLibraryPtr ml, int64_t id );
private:
static std::string orderBy( const QueryParameters* params );
......
Supports Markdown
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