Exemple #1
0
        public bool Add(VideoSubscription subscription)
        {
            if (this.Dictionary.ContainsKey(string.Format("{0}@{1}", subscription.Slug, subscription.Provider.ToLower()))) return false;

            base.Add(subscription);
            return true;
        }
Exemple #2
0
        public Channel(VideoSubscription subscription)
            : base(subscription.Name)
        {
            this.Text = subscription.Name;
            this.Slug = subscription.Slug;
            this.Provider = subscription.Provider;

            this.Icon = new NodeIcon("video", Assets.Images.Icons.Png._16.video);

            this.Menu.Add("markaswatched", new ToolStripMenuItem(i18n.MarkAsWatched, Assets.Images.Icons.Png._16.read, new EventHandler(MenuMarkAllAsWatchedClicked)));
            this.Menu.Add("markasunwatched", new ToolStripMenuItem(i18n.MarkAsUnwatched, Assets.Images.Icons.Png._16.unread, new EventHandler(MenuMarkAllAsUnWatchedClicked)));
        }
Exemple #3
0
        public static Channel CreateChannel(VideoSubscription subscription)
        {
            Channel channel = null;
            switch (subscription.Provider.ToLower())
            {
                case "youtube": channel = new Youtube(subscription); break;
                case "bliptv": channel = new BlipTv(subscription); break;
                default: break;
            }

            if(channel==null) throw new NotImplementedException(string.Format("Module video's channel factory have been asked for an invalid channel-provider: '{0}'", subscription.Provider)); // throw an exception if video channel was not associated with a valid provider.
            return channel;
        }
Exemple #4
0
        public override bool AddSubscriptionFromUrl(string link)
        {
            foreach (KeyValuePair<string, Provider> pair in Providers.Instance.Dictionary)
            {
                if (!((VideoProvider) pair.Value).LinkValid(link)) continue;

                string slug = (pair.Value as VideoProvider).GetSlug(link);
                var videoSubscription = new VideoSubscription
                                            {
                                                Name = slug,
                                                Slug = slug,
                                                Provider = pair.Value.Name
                                            };

                string channelKey = string.Format("{0}@{1}", videoSubscription.Slug, videoSubscription.Provider.ToLower());
                if (Subscriptions.Instance.Dictionary.ContainsKey(channelKey))
                {
                    MessageBox.Show(string.Format(i18n.VideoChannelSubscriptionsAlreadyExists, Subscriptions.Instance.Dictionary[channelKey].Name), i18n.SubscriptionExists, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return true;
                }

                using (Channel channel = ChannelFactory.CreateChannel(videoSubscription))
                {
                    if (!channel.IsValid()) continue;
                    if (Subscriptions.Instance.Add(videoSubscription)) this.MenuRefresh(this, new EventArgs());
                    return true;
                }
            }

            return false;
        }
Exemple #5
0
        public void ConsumeSubscription(string entryUrl)
        {
            Match match = this._subscriptionConsumerRegex.Match(entryUrl);
            if (!match.Success) return;

            string name = match.Groups["Name"].Value;
            string provider = match.Groups["Provider"].Value;
            string slug = match.Groups["Slug"].Value;

            var subscription = new VideoSubscription { Name = name, Provider = provider, Slug = slug };
            Subscriptions.Instance.Add(subscription);
        }