BrowseCommand

Stores browse parameters and results of browse operations.

Synopsis:

#include <qplayer/qplayer.h>

namespace QPlayer {

    class BrowseCommand : public BaseCommand
    {
        Q_OBJECT

    public:

        explicit BrowseCommand( int mediaSourceId, 
                                QString mediaNodeId, 
                                int limit = -1, 
                                int offset = 0 );
    
        inline QList< MediaNode > result()
        {
            return m_result;
        }
    
        inline void setResult( QList< MediaNode > result )
        {
            m_result = result;
        }
    
        int mediaSourceId() const;

        QString mediaNodeId() const;

        int limit() const;

        int offset() const;
    
    signals:

        void complete( BrowseCommand *command );

        void error( BrowseCommand *command );
    
    };

}

Library:

libqplayer

Description:

Stores browse parameters and results of browse operations. The results are represented as a list of media nodes. When creating a BrowseCommand object, you must provide the IDs of the folder media node to browse and the media source that the node is located on. To start browsing a new media source with an unknown directory structure, pass in "/" for the media node ID to indicate the root folder. You can also provide a limit on how many nodes can be stored in the results and specify the offset to start browsing from in the folder.

We recommend using these last two parameters whenever possible because retrieving all media nodes can be very slow due to either a large number of nodes or the device type (e.g., DLNA). You can define the limit and offset parameters to organize browse results into fixed-size sets of nodes. For example, you can read the first 25 nodes in a media source folder, then the next 25, and so on. This strategy reduces the command processing time and restricts memory usage.

When the underlying player has finished browsing the media source, the BrowseCommand object emits a complete signal to notify clients that the browse results can now be read. Clients can then call the result() method to retrieve the list of media nodes found. From that list, they can read information on individual nodes or further explore the media source by issuing browse requests on nodes found in the list.

If the browse() command fails, the object emits an error signal. You can then call errorMessage() to retrieve a QString describing the error.