def outPut(self):
    sql = ("SELECT * FROM\n            (SELECT * FROM %s WHERE online = 1 ORDER BY delay DESC) AS delay\n            GROUP BY LOWER(delay.title)\n            HAVING delay.title != '' and delay.title != 'CCTV-' AND delay.delay < 500\n            ORDER BY level ASC, length(title) ASC, title ASC\n            " % self.DB.table)
    result = self.DB.query(sql)
    with open('tv.m3u8', 'w') as f:
        f.write('#EXTM3U\n')
        for item in result:
            className = '其他频道'
            if (item[4] == 1):
                className = '中央频道'
            elif (item[4] == 2):
                className = '地方频道'
            elif (item[4] == 3):
                className = '地方频道'
            elif (item[4] == 7):
                className = '广播频道'
            else:
                className = '其他频道'
            f.write(('#EXTINF:-1, group-title="%s", %s\n' % (className, item[1])))
            f.write(('%s\n' % item[3]))
def outPut(self):
    sql = ("SELECT * FROM\n            (SELECT * FROM %s WHERE online = 1 ORDER BY delay DESC) AS delay\n            GROUP BY LOWER(delay.title)\n            HAVING delay.title !=  and delay.title != 'CCTV-' AND delay.delay < 500\n            ORDER BY level ASC, length(title) ASC, title ASC\n            " % self.DB.table)
    result = self.DB.query(sql)
    with open('tv.m3u8', 'w') as f:
        f.write('#EXTM3U\n')
        for item in result:
            className = '其他频道'
            if (item[4] == 1):
                className = '中央频道'
            elif (item[4] == 2):
                className = '地方频道'
            elif (item[4] == 3):
                className = '地方频道'
            elif (item[4] == 7):
                className = '广播频道'
            else:
                className = '其他频道'
            f.write(('#EXTINF:-1, group-title="%s", %s\n' % (className, item[1])))
            f.write(('%s\n' % item[3]))