Sayonara Player
|
#include <AbstractStreamHandler.h>
Used to interprete website data as streams. Some methods have to be overridden, to map their functions to their specific database functions. The track list is held in a map, which is accessible through its station name. It can be accessed via the get_tracks() method.
Signals | |
void | sig_error () |
void | sig_data_available () |
Public Member Functions | |
AbstractStreamHandler (QObject *parent=nullptr) | |
bool | parse_station (const QString &url, const QString &station_name) |
Retrieves data from the station and tries to interprete it via the parse_content() method. More... | |
MetaDataList | get_tracks (const QString &station_name) |
get_tracks More... | |
void | save (const QString &station_name, const QString &url) |
Saves the station. Calls the add_stream() method. More... | |
virtual bool | get_all_streams (StreamMap &streams)=0 |
This method should return all stations in database. More... | |
virtual bool | add_stream (const QString &station_name, const QString &url)=0 |
This method should add a new station to database. If the station already exists, there should be a corresponding error handling. More... | |
virtual bool | delete_stream (const QString &station_name)=0 |
Delete a station from the database. More... | |
virtual bool | update_url (const QString &station_name, const QString &url)=0 |
Update the url of a station. More... | |
virtual bool | rename_stream (const QString &station_name, const QString &url)=0 |
Rename the station. More... | |
void | clear () |
Clears all station content. | |
Protected Attributes | |
DatabaseConnector * | _db =nullptr |
PlaylistHandler * | _playlist =nullptr |
QMap< QString, MetaDataList > | _station_contents |
QString | _station_name |
bool | _blocked |
|
pure virtual |
This method should add a new station to database. If the station already exists, there should be a corresponding error handling.
station_name | station name |
url | url |
Implemented in StreamHandlerPodcasts, and StreamHandlerStreams.
|
pure virtual |
Delete a station from the database.
station_name | the station to be deleted |
Implemented in StreamHandlerPodcasts, and StreamHandlerStreams.
|
pure virtual |
This method should return all stations in database.
streams | target StreamMap |
Implemented in StreamHandlerPodcasts, and StreamHandlerStreams.
MetaDataList AbstractStreamHandler::get_tracks | ( | const QString & | station_name | ) |
get_tracks
station_name |
bool AbstractStreamHandler::parse_station | ( | const QString & | url, |
const QString & | station_name | ||
) |
Retrieves data from the station and tries to interprete it via the parse_content() method.
url | url to retrieve the data from |
station_name | the station name |
|
pure virtual |
Rename the station.
station_name | new name of the station |
url | old URL of the station |
Implemented in StreamHandlerPodcasts, and StreamHandlerStreams.
void AbstractStreamHandler::save | ( | const QString & | station_name, |
const QString & | url | ||
) |
Saves the station. Calls the add_stream() method.
station_name | The station name. |
url | the station url. |
|
pure virtual |
Update the url of a station.
station_name | the station to be updated |
url | the new url |
Implemented in StreamHandlerPodcasts, and StreamHandlerStreams.