public ActionResult Mix(int id)
        {
            hypster_tv_DAL.c_Mix curr_mix = new hypster_tv_DAL.c_Mix();


            string request_url1 = "http://8tracks.com/mixes/" + id + ".xml?api_key=443c4639830c723d8b866f08b79abbab5918770e";

            XPathDocument     doc1       = new XPathDocument(request_url1);
            XPathNavigator    navigator1 = doc1.CreateNavigator();
            XPathNodeIterator nodes1     = navigator1.Select("/response/mix");

            List <hypster_tv_DAL.c_Mix> mixes_list = new List <hypster_tv_DAL.c_Mix>();

            while (nodes1.MoveNext())
            {
                XPathNavigator navigator2 = nodes1.Current;
                curr_mix.Mix_ID    = navigator2.SelectSingleNode("id").Value;
                curr_mix.Mix_Cover = navigator2.SelectSingleNode("cover-urls/sq250").Value;
                curr_mix.Mix_Tags  = navigator2.SelectSingleNode("tag-list-cache").Value;
            }



            if (hypster_tv_DAL.Mobile_Device_Recognition.CheckIfTablet(Request.UserAgent))
            {
                return(View("MixT", curr_mix));
            }


            return(View(curr_mix));
        }
Пример #2
0
        public string GetNextSearchMix(string id)
        {
            hypster_tv_DAL.c_Mix ret_mix = new hypster_tv_DAL.c_Mix();


            try
            {
                string tag_enc = "";
                if (id != null && id != "")
                {
                    tag_enc = id.ToLower().Replace('_', ' ');
                    tag_enc = HttpUtility.UrlEncode(tag_enc);
                }

                string request_url1 = "http://8tracks.com/mixes.xml?per_page=40&q=" + tag_enc + "&sort=popular&api_key=443c4639830c723d8b866f08b79abbab5918770e";

                XPathDocument     doc1       = new XPathDocument(request_url1);
                XPathNavigator    navigator1 = doc1.CreateNavigator();
                XPathNodeIterator nodes1     = navigator1.Select("/response/mixes/mix");

                List <hypster_tv_DAL.c_Mix> mixes_list = new List <hypster_tv_DAL.c_Mix>();
                while (nodes1.MoveNext())
                {
                    hypster_tv_DAL.c_Mix curr_mix = new hypster_tv_DAL.c_Mix();

                    XPathNavigator navigator2 = nodes1.Current;
                    curr_mix.Mix_ID    = navigator2.SelectSingleNode("id").Value;
                    curr_mix.Mix_Cover = navigator2.SelectSingleNode("cover-urls/sq250").Value;
                    curr_mix.Mix_Tags  = navigator2.SelectSingleNode("tag-list-cache").Value;

                    mixes_list.Add(curr_mix);
                }


                Random random = new Random();
                if (mixes_list.Count > 0)
                {
                    ret_mix = mixes_list[random.Next(0, mixes_list.Count - 1)];
                }
            }
            catch (Exception ex)
            {
            }


            return(ret_mix.Mix_ID + "|" + ret_mix.Mix_Cover);
        }
Пример #3
0
        //
        // GET: /mixes/



        public ActionResult Index()
        {
            string request_url1 = "http://8tracks.com/mixes.xml?per_page=72&tag=&sort=popular&api_key=443c4639830c723d8b866f08b79abbab5918770e";
            List <hypster_tv_DAL.c_Mix> mixes_list = new List <hypster_tv_DAL.c_Mix>();

            try
            {
                XPathDocument     doc1       = new XPathDocument(request_url1);
                XPathNavigator    navigator1 = doc1.CreateNavigator();
                XPathNodeIterator nodes1     = navigator1.Select("/response/mixes/mix");


                while (nodes1.MoveNext())
                {
                    hypster_tv_DAL.c_Mix curr_mix = new hypster_tv_DAL.c_Mix();

                    XPathNavigator navigator2 = nodes1.Current;
                    curr_mix.Mix_ID    = navigator2.SelectSingleNode("id").Value;
                    curr_mix.Mix_Cover = navigator2.SelectSingleNode("cover-urls/sq133").Value;
                    curr_mix.Mix_Name  = navigator2.SelectSingleNode("name").Value;
                    curr_mix.Mix_Tags  = navigator2.SelectSingleNode("tag-list-cache").Value;

                    mixes_list.Add(curr_mix);
                }
            }
            catch (Exception ex)
            {
            }


            if (hypster_tv_DAL.Mobile_Device_Recognition.CheckIfTablet(Request.UserAgent))
            {
                return(View("IndexT", mixes_list));
            }

            return(View(mixes_list));
        }