Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- init() ->
- dyngen_task:add_task(5*60*1000,sioltv_tvimport,fun ?MODULE:tv_importchans/0),
- tv_importchans().
- tv_importchans() ->
- {_,_,_,Chanl1uns} = sioltv_core:channel_streams_tv("fronttv"),
- Chanl1 = lists:keysort(#tvchan.index,Chanl1uns),
- Chanl = [[{<<"name">>,Chan#tvchan.name},{<<"coreidext">>,Chan#tvchan.docid},
- {<<"coreid">>,Chan#tvchan.id},{<<"bkdid">>,Chan#tvchan.key}] || Chan <- Chanl1],
- case ets:info(io2tv,size) of
- undefined ->
- ets:new(io2tv, [named_table,public,{heir,whereis(dyngen_task),<<>>}]);
- _ ->
- ok
- end,
- ets:insert(io2tv,{allchans,Chanl}),
- SaveToEts = fun(Chan) ->
- [{_,Name},_,_,{_,Key}] = Chan,
- ets:insert(io2tv,{Name,Chan}),
- ets:insert(io2tv,{util:tobin(string:to_lower(util:tolist(Name))),Chan}),
- ets:insert(io2tv,{Key,Chan})
- end,
- [SaveToEts(Chan) || Chan <- Chanl].
Add Comment
Please, Sign In to add comment