Пример #1
0
        /// <summary>
        /// transforme les tweets en liste d'entrées de playlist
        /// </summary>
        /// <param name="youtube_client"></param>
        /// <param name="soundcloud_client"></param>
        /// <returns></returns>
        public List<Music.PlayListEntry> getPlaylistEntriesFromTweets(Youtube.Youtube youtube_client, SoundCloud.SoundCloud soundcloud_client)
        {
            List<Music.PlayListEntry> res = new List<PlayListEntry>();
            List<IMention> tweets;
            try
            {
                tweets = (from t in this.getTweets().ToList() where t.CreatedAt >= this.last_update && t.Urls.Count() > 0 select t).ToList();
            }
            catch(NullReferenceException e)
            {
                Console.WriteLine("Une erreur est survenue lors de la récupération des tweets.");
                return res;
            }
            Console.WriteLine("analizing tweets");
            foreach(IMention t in tweets)
            {
                string user = t.CreatedBy.Name;
                string url = t.Urls[0].ExpandedURL;
                ITrack track = null;
                if (Youtube.Youtube.isCompatible(url))
                    track = youtube_client.resolveTrack(url);
                else if (SoundCloud.SoundCloud.isCompatible(url))
                    track = soundcloud_client.resolveTrack(url);
                if(track != null)
                    res.Add(new PlayListEntry(track, user, false));
            }

            this.last_update = DateTime.Now;
            return res;
        }
Пример #2
0
        static void Main(string[] args)
        {
            Playlist playlist = new Playlist();
            Youtube.Youtube youtube_client = new Youtube.Youtube();
            SoundCloud.SoundCloud soundcloud_client = new SoundCloud.SoundCloud("bb9515b11ad6d190d296583917f534fd");


            Console.ReadLine();
        }