package basic.taobaotv;

import com.wasu.util.NetUtils;

import java.io.UnsupportedEncodingException;

import basic.taobaotv.util.TaobaotvUtil;


/**
 * Created by fanwang on 10/8/16.
 */
public class TaobaoTvManager {

    private static TaobaoTvManager sInstance = null;

    private TaobaoTvManager(){}

    public static TaobaoTvManager getInstance(){
        if(sInstance == null){
            synchronized(TaobaoTvManager.class){
                sInstance = new TaobaoTvManager();
            }
        }

        return sInstance;
    }

    /**
     *
     * @return
     */

    /**
     * 获取淘宝电视的访问地址Url
     * @param mac       设备的mac  不能为空
     * @param token     访问淘宝电视网站的token(可以为空)
     * @return
     */
    public String getTaobaoTvUrl(String mac,String token){
        String user_id = mac;  //we can use mac
        String user_token = token;  //we can create a token

        String taobaotv_url = null;
        try {
            taobaotv_url = TaobaotvUtil.getTvmallUrl(user_id,user_token);
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return taobaotv_url;
    }
}
