omroepgelderland / nielsen-asrun
用于生成尼尔森混合审计AsRunLogs和节目前一天文件的生成器。
dev-main
2024-08-22 19:02 UTC
Requires
- php: ^8.1
- ext-date: *
- ext-iconv: *
Requires (Dev)
- bartlett/php-compatinfo: 7.1.4
- phpstan/phpstan: 1.11.9
- phpunit/phpunit: ^10.5
This package is auto-updated.
Last update: 2024-09-22 19:09:17 UTC
README
生成在广播前一天发送的“节目前一天”文件和广播结束后发送的“运行日志”文件。请参阅docs目录以获取格式规范和使用方法。
安装
此库需要PHP8.1.0或更高版本。推荐安装方式是通过Composer。
composer require omroepgelderland/nielsen-asrun
使用示例
use nielsen_asrun\Entry; use nielsen_asrun\Log; use nielsen_asrun\PromoType; use nielsen_asrun\RepeatCode; use nielsen_asrun\TypologySource; $log = Log::create_asrunlog([ 'typology_source' => TypologySource::None, 'encoding' => 'iso-8859-1', 'broadcast_day' => new \DateTime('2024-06-17'), 'author' => 'Omroep Brabant', 'channel_name' => 'OB', 'channel_abbreviation' => 'tvbrab' ]); // Add a program entry $log->add_entry(Entry::create_program_entry([ 'channel_id' => 234, 'omroepen' => ['OB'], 'starttime' => new \DateTime('2024-06-17 02:00:00'), 'endtime' => new \DateTime('2024-06-17 02:03:29'), 'prog_id' => '4453719', 'unharmonized_title' => 'KRAAK.', 'repeat_code' => RepeatCode::Last7Days ])); // Add a break entry $log->add_entry(Entry::create_break_entry([ 'channel_id' => 234, 'omroepen' => ['OB'], 'starttime' => new \DateTime('2024-06-17 06:57:04'), 'endtime' => new \DateTime('2024-06-17 06:59:54'), 'unharmonized_title' => '64' ])); // Add a promo entry $log->add_entry(Entry::create_promo_entry([ 'channel_id' => 234, 'omroepen' => ['OB'], 'starttime' => new \DateTime('2024-06-17 02:03:30'), 'endtime' => new \DateTime('2024-06-17 02:03:34'), 'unharmonized_title' => 'BÜMPAT BUMPER AFL. TERUGKIJKEN BRABANT+ - 2023', 'promo_type_id' => PromoType::Promo, 'promo_id' => '4365342' ])); // Add a station id entry $log->add_entry(Entry::create_station_id_entry([ 'channel_id' => 234, 'omroepen' => ['OB'], 'starttime' => new \DateTime('2024-06-17 07:04:53'), 'endtime' => new \DateTime('2024-06-17 07:05:00'), 'unharmonized_title' => 'SID 206 BOSFIETS - 2024-03-25 - 2024-07-01', 'promo_id' => '4435714' ])); // Merge consecutive breaks $log->merge_breaks(); // Save to file \file_put_contents($log->get_filename(), $log);