Filter "Not scheduled" tracks in smart playlist
  • Hi!
    Can anyone tell how to implement such feature?
    I want to add filter in smart playlist that will add in playlist that tracks, that are not scheduled at current moment. It can be just like checkbox after all filters "Not scheduled"
    Post edited by Ярослав Гребнев at 2018-01-03 12:20:16
  • 1 Comment sorted by
  • Since no one didn't answered I tried to implement it myself.
    Here is hacks, that was edited in version 2.5.1:

    file: /usr/share/airtime/application/models/Block.php
    on method starting with private static $criteria2PeerMap add the following (highlighted by green):
    "bit_rate"     => "DbBitRate",
    "is_scheduled" => "DbIsScheduled",
    "bpm"          => "DbBpm",

    on function starting with public function getContents($filterFiles=false) add in SQL Query (highlighted by green):
    f.filepath AS path,
    f.mime as mime,
    f.is_scheduled as is_scheduled
    FROM cc_blockcontents AS pc

    on function starting with public function getCriteria() add the following (highlighted by green):
    "bit_rate"     => _("Bit Rate (Kbps)"),
    "is_scheduled" => _("Is Scheduled"),
    "bpm"          => _("BPM"),

    file: /usr/share/airtime/application/forms/SmartBlockCriteria.php
    on function started with private $criteriaTypes = array add the following (highlighted by green):
    "bit_rate"     => "n",
    "is_scheduled" => "s",
    "bpm"          => "n",
    on function started with private function getCriteriaOptions($option = null) add the following (highlighted by green):
    "bit_rate"     => _("Bit Rate (Kbps)"),
    "is_scheduled" => _("Is Scheduled"),
    "bpm"          => _("BPM"),
    on function started with public function isValid($params) add the following (highlighted by green):
    "bit_rate" => "DbBitRate",
    "is_scheduled" => "DbIsScheduled",
    "bpm" => "DbBpm",

    After that you can simply add in interface criteria to place only not scheduled tracks
    Is scheduled | Is | FALSE

    image

    You can also set it to TRUE to check if it works

    image