RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
{
"channels":[
{
"myid":"001",
"chid":"127",
"title":"Первый",
"group":"Общественные",
"is-visible":"true"
},
{
"myid":"006",
"chid":"213",
"title":"НТВ HD",
"group":"Общественные",
"is-visible":"true"
},
{
"myid":"007",
"chid":"502",
"title":"ТНТ",
"group":"Общественные",
"is-visible":"true"
},
{
"myid":"008",
"chid":"506",
"title":"СТС",
"group":"Общественные",
"is-visible":"true"
},
{
"myid":"009",
"chid":"503",
"title":"Пятница!",
"group":"Общественные",
"is-visible":"true"
},
{
"myid":"025",
"chid":"516",
"title":"Кинохит",
"group":"Фильмы\/сериалы",
"is-visible":"true"
},
{
"myid":"026",
"chid":"509",
"title":"Киномикс",
"group":"Фильмы\/сериалы",
"is-visible":"true"
},
{
"myid":"027",
"chid":"164",
"title":"Мужское кино",
"group":"Фильмы\/сериалы",
"is-visible":"true"
}
]
}
func parseJsonProvidersStruct(data: Data) -> [ProviderStruct] {
var channels = [ProviderStruct]()
do {
let jsonResult = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.mutableContainers) as? NSDictionary
// Parse JSON Data
let jsonChannels = jsonResult!["channels"] as! [AnyObject]
for jsonChannel in jsonChannels {
let element = ElementStruct(myid: jsonChannel["myid"] as! String, chid: jsonChannel["chid"] as! String, title: jsonChannel["title"] as! String, isVisible: jsonChannel["is-visible"] as! String == "true" ? true : false)
let group = GroupStruct(group: jsonChannel["group"] as! String, element: [element])
let provider = ProviderStruct(group: [group])
channels.append(provider)
}
} catch {
print("Read JSON ProviderStruct file error: \(error)")
}
return channels
}