
import time
import domestic
import twccommon.PluginManager

# CHANGE THIS LIST TO RUN DIFFERENT PRODUCTS
default = [
    "TornadoWatch",
    "CurrentSkyTemp",
    "CurrentWinds",
    "CurrentGusts",
    "CurrentHumidity",
    "CurrentApparentTemp",
    "CurrentDewpoint",
    "CurrentCeiling",
    "CurrentVisibility",
    "CurrentPressure",
    "CurrentMTDPrecip",
    "SummaryForecast",
    "Shortcast",
    "HourlyForecast",
    "AirQualityForecast",
    "UVForecast",
    "ExtendedForecast",
    "Date",
]


# DON'T CHANGE BELOW THIS LINE -- THIS MEANS YOU TONY :-)
class LongFormLDL(domestic.Playlist):
    
    def _tornadoWatch(self):
        return 0
    
    def getSchedule(self, theme, params):
        
        schedule = [] 
        y,m,d,H,M,S,dow,jd,dst = time.localtime()
        twccommon.Log.info("Long Form LDL playlist chosen")
        sched = default

        for prodName in sched:
            prod = self._getProduct(prodName, theme, params)
            if prod.isValid():
                schedule.append((prod, prod.getDuration()))
        return schedule
    
    
def init(config):
    global _config, _pm
    _config = config
    _pm = twccommon.PluginManager.PluginManager(_config.productPluginRoot)
    
    
def uninit():
    pass

    
def getPlaylist():
    return LongFormLDL(_config, _pm)
     
     
