This documentation is outdated since the release Smarty 2.8, current module of collection of tv viewing — MiStats.
Television viewing statistics
First of all, it is necessary to raise the MongoDB server, which will store subscriber TV viewing data. Minimum supported version of MongoDB — 3.4.
Next, section INSTALLED_APPS smarty configuration file needs to add a module viewstats, as well as specify the data to connect to the raised MongoDB server:MONGODB_HOST — MongoDB server address, data type strap;MONGODB_PORT — MongoDB server port, data type int;MONGODB_NAME — Name of database, type of data strap;MONGODB_USERNAME — User name for authorization, data type strap;MONGODB_PASSWORD — Password for authorization, type of data strap;MONGODB_AUTH_METHOD — Authorization method (depending on MongoDB version), data type strap;
And identify any missing migration team:
smarty_manage migrate --settings=settings.smartyExample configuration:
INSTALLED_APPS += 'viewstats', ///... )MONGODB_HOST = '127.0.0.1' MONGODB_PORT = 27017 MONGODB_NAME = 'Test' MONGODB_USERNAME = 'Test' MONGODB_PASSWORD = 'Password' MONGODB_AUTH_METHOD = 'SCRAM-SHA-1'
In order for subscriber devices to start sending statistics to the server, it is necessary to enable its sending in the administration panel on the page « STB and application settings» (checkbox « Enable the collection of statistical data on the Smarty» server).

Creating smart channel sorting
smarty_manage create_channel_sorting_by_popularity --settings=settings.When executing this command, a sorting of channels is created based on television viewing statistics, based on the specified parameters in the team.
The necessary parameters to execute this command:
-client_id - a list of customer identifiers, through a comma, for which caching is necessary;
-days_number &# 8212; the number of days during which you should consider tv viewing;
- criterion — a characteristic by which to measure popularity. Possible values:watch — by total channel viewing time;watch_sessions — by number of channel inclusions;average — the average viewing time of the channel;median_watch_time — by median channel viewing time.
Additional parameters of the team:-devices — a list of devices for which you should take into account the statistics of tv viewing (transfer system device names, default — all);-tariffs — a list of tariffs for which you should take into account the statistics of tv viewing (tariff identifiers are transmitted, by default — all);--accounts_active — consider statistics only from active accounts.
Creating a selection of popular TV channels
smarty_manage create_channel_selection_by_popularity --settings=settings;Parameters:-client_id This option is mandatory and determines the Client identifier for which the selection will be created.-days_number this parameter is mandatory and determines the number of days during which you should take into account television viewing.- criterion This parameter is mandatory and determines the characteristic on which the selection will be created. Possible values: watch (total channel viewing time), watch_sessions (number of channel viewing sessions), average (average channel viewing time), median_watch_time (median viewing time).-devices parameter for creating a collection for certain devices (by default, the collection is created for all devices).--accounts_active The parameter allows you to create a selection only based on active accounts. Possible values: true, false. By default falsely.-tariffs selection of certain tariffs to create a collection (all tariffs are taken into account by default).--selection_size The parameter determines the size of the set created. In the absence of information about a sufficient number of channels, channels without statistics are added to the desired number. By default 17.
Example of using a command:
Creating for Client=1 a selection of weekly popular channels by viewing time:
smarty_manage create_channel_selection_by_popularity --client_id=1 --days_number=7 --criterion=watch_time --settings=settings;
Creating a selection of popular television programs
smarty_manage create_epg_selection_by_popularity --settings=settings.Parameters:-client_id This option is mandatory and determines the Client identifier for which the selection will be created.-days_number this parameter is mandatory and determines the number of days during which information on transfers is collected.-devices parameter for creating a collection for certain devices (by default, the collection is created for all devices).-tariffs selection of certain tariffs to create a collection (all tariffs are taken into account by default).--selection_size The parameter determines the size of the set created. In the absence of information on a sufficient number of transmissions, transmissions without statistics are added to the desired number. By default 17.-categories - parameter for creating a selection of certain categories of channels (all categories are taken into account by default), id categories can be seen in the section Content Settings - TV Categories.-channels only those channels whose id is specified in this parameter are considered.--election_name - the name of the collection. If not specified, the selection will be called "Days_number ($selection_size)".
Example of using a command:
Create a selection of 27 popular programs for Client=1 in 30 days with categories "Children" (id=2) and "Educational" (id=7):
smarty_manage create_epg_selection_by_popularity --selection_name="Children's cognitive" --client_id=1 --days_number=30 --selection_size=27 --categories=2 --categories=7 --settings=settings;
Creating a selection of popular films of the archive video library
Team:
smarty_manage create_vodpvr_selection_by_popularity --client_id=1 --days_number=3 --settings=settings;
The team creates a selection of popular videos from the archive video library based on the viewing of users.
Mandatory parameters:
-client_id - determines the Client identifier, within which the collection will be formed.
-days_number the number of days for which television viewing statistics are taken.
Optional parameters:
-channels - a list of channels, the transmissions of which take into account the statistics of television viewing.
-categories - a list of categories of channels, the transmissions of which take into account the statistics of television viewing.
--selection_size Maximum amount of content in the collection. Default 17.
--election_name - the name of the collection. The default is "Popular Videos X (Y)" or "Popular Videos X (Y)" where X is the days_number value and Y is selection_size.
Example of using a command:
Removal of films/series that were recorded more than 2 weeks ago:
smarty_manage create_vodpvr_selection_by_popularity --client_id=1 --days_number=7 --selection_size=30 --selection_name="Popular in the Archive" --channels=1 --channels=2 --categories=1 --categories=2 --settings=settings.
