hulu-automuter 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ .DS_Store
2
+ *.swp
3
+ *~.nib
4
+ build/
5
+ *.pbxuser
6
+ *.perspective
7
+ *.perspectivev3
8
+ *.mode1v3
9
+ *.mode2v3
10
+ xcuserdata
11
+ src/
12
+ pkg/
13
+ other/
14
+ old/
15
+ debug.log
data/NOTES ADDED
@@ -0,0 +1,217 @@
1
+ t2.hulu.com/v3/rvenue
2
+ contentplaybackresume
3
+ t2.hulu.com/potentialbugtracking
4
+
5
+
6
+ getPlaylist
7
+ p.hulu.com/Default.aspx
8
+
9
+ adload
10
+ t2.hulu.com/v3/playertracking
11
+
12
+
13
+
14
+ ------------------------------------------------------------------------
15
+ Mon Jul 11 07:44:00 EDT 2011
16
+
17
+
18
+ Search hulu.js for continousPlayCountdownStarted
19
+
20
+ Use this
21
+ http://jsbeautifier.org/
22
+
23
+ output:
24
+ js/pretty.js
25
+
26
+
27
+ if (pid == currentPid && $('player') && $('player').seekAndPlay(t)) {
28
+ $('player').scrollTo();
29
+ $('player').pauseVideo();
30
+
31
+ player.style.visibility = "visible";
32
+
33
+
34
+ $('player').playVideo("e:" + eid);
35
+ Playlist.play(Playlist.current_id, playlist_item_id);
36
+
37
+ contentplaybackresume
38
+ http://t2.hulu.com/v3/potentialbugtracking/contentplaybackresume
39
+
40
+ adstart
41
+ http://t2.hulu.com/v3/playertracking/adstart
42
+
43
+
44
+ Telling your user-agent (web browser) to use Polipo is an operation that depends on the browser. Many user-agents will transparently use Polipo if the environment variable ‘http_proxy’ points at it; e.g.
45
+
46
+ $ export http_proxy=http://localhost:8123/
47
+
48
+
49
+
50
+ 3.8.2 External redirectors
51
+
52
+ Polipo can also use an external process (a Squid-style redirector) to determine which URLs should be redirected. The name of the redirector binary is determined from the variable redirector, and the kind of redirection generated is specified by redirectorRedirectCode, which should be 302 (the default) or 301.
53
+
54
+ For example, to use Adzapper to redirect ads to an innocuous image, just set
55
+
56
+ redirector = /usr/bin/adzapper
57
+
58
+
59
+ Recent as 2011:
60
+
61
+ Video ads on Hulu not blocked
62
+
63
+ https://adblockplus.org/forum/viewtopic.php?t=7839
64
+
65
+ Polipo mailing list
66
+
67
+ http://sourceforge.net/mailarchive/forum.php?forum_name=polipo-users
68
+
69
+
70
+
71
+
72
+
73
+ ruby -r webrick/httpproxy -e 's = WEBrick::HTTPProxyServer.new(:Port
74
+ => 9999, :RequestCallback => Proc.new{|req,res| puts req.request_line,
75
+ req.raw_header}); trap("INT"){s.shutdown}; s.start'
76
+
77
+ ------------------------------------------------------------------------
78
+ Polipo approach is difficult and buggy
79
+
80
+
81
+ IDEA.
82
+
83
+ Chrome plugin
84
+
85
+ monitor web traffic from hulu.com
86
+ When commerical starts or ends, send message to localhost. A Sintra app
87
+ that user starts. This toggle volumn on ane off
88
+
89
+
90
+
91
+ Plus.Tracking
92
+ Beacon.
93
+ PRODUCTION_STANDARD_HOST: "http://t2.hulu.com",
94
+
95
+ getStandardHost: function () {
96
+ return Beacon.production ? Beacon.PRODUCTION_STANDARD_HOST : Beacon.QA_STANDARD_HOST;
97
+ var url = Beacon.getStandardHost() + Beacon.STANDARD_PREFIX + Beacon.region_prefix + '/' + type + '/' + event + '?' + $H(params).toQueryString();
98
+ Beacon.send(url);
99
+
100
+
101
+
102
+ Beacon.send = function (url){
103
+ console.log(url);
104
+ pingImage(url+"&cb="+(new Date).getTime());
105
+ }
106
+
107
+ var _rTracking = new RecommendTracking();
108
+
109
+ Beacon.trackAssetImpression = function (placementId, creativeId) {
110
+ alert("ad");
111
+ console.log("ad");
112
+ console.log(placemendId);
113
+
114
+ var params = {
115
+ placementid: placementId
116
+ };
117
+ if (creativeId != null) {
118
+ params.creativeid = creativeId;
119
+ }
120
+ Beacon.trackStandardBeacon(Beacon.TYPE_REVENUE, Beacon.EVENT_ASSET_IMPRESSION, params);
121
+ };
122
+
123
+ TYPE_REVENUE
124
+
125
+ Beacon.trackStandardBeacon = function (type, event, data) {
126
+ alert("track");
127
+ };
128
+
129
+
130
+
131
+ Object.extend(Beacon, {
132
+ trackStandardBeacon: function (type, event, data) {
133
+ alert("track");
134
+ }});
135
+
136
+ function pingImage(url) {
137
+ alert(url);
138
+ console.log(url);
139
+ var img = new Image();
140
+ if (Prototype.Browser.IE) {
141
+ img.onload = function () {};
142
+ }
143
+ img.src = url;
144
+ return img;
145
+ };
146
+
147
+
148
+ try { __flash__toXML(dispatchPlayerEvent("playerStateChanged","INTROS")) ; } catch (e) { "<undefined/>"; }
149
+
150
+
151
+
152
+ contentplaybackresume
153
+
154
+
155
+ http://t2.hulu.com/v3/potentialbugtracking/contentplaybackresume?a=1&beaconevent=contentplaybackresume&bitrate=650&cb=1310426695706_11&client=Firefox&computerguid=24E10EC7032927E584D286F8324CD64F&contentid=40011284&cpidentifier=The%20Booth&currentstate=CONTENT&distro=hulu&distroplatform=hulu&embedurl=961c34a23740b1fab95d944c7656ee95&exid=1&flash=LNX%2010%2C3%2C181%2C34&language=en&os=Linux%202.6.38-8-generic-pae&packageavailability=shared&packageid=1&pendingstate=&pid=NO_MORE_RELEASES_PLEASE_40011284&planid=0&player=105047&playermode=normal&position=858441&promotion=&region=US&sessionguid=82EFCACDCC738C5F8D8E2A0C9CDCBA58&sitesessionid=6FD9A49B50C1766D0A9C1429C9ADDA34&socialidentites=&timepadding=386921&totalframes=9246&totalmemory=29372416&userbandwidth=1180&userid=0&visit=48
156
+
157
+ adload
158
+
159
+ flv is an ad
160
+
161
+ GET http://t2.hulu.com/v3/playertracking/adload?a=1&beaconevent=adload&bitrate=650&cb=1310426771445_951&client=Firefox&computerguid=24E10EC7032927E584D286F8324CD64F&contentid=4001128
162
+ 4&cpidentifier=The%20Booth&creativeid=136384&distro=hulu&dist
163
+
164
+ GET http://t2.hulu.com/v3/playertracking/adload?a=1&beaconevent=adload&bitrate=650&cb=1310426771445_951&client=Firefox&computerguid=24E10EC7032927E584D286F8324CD64F&contentid=4001128
165
+ 4&cpidentifier=The%20Booth&creativeid=136384&distro=hulu&dist
166
+
167
+ GET http://t2.hulu.com/v3/playertracking/adload?a=1&beaconevent=adload&bitrate=650&cb=1310426771445_951&client=Firefox&computerguid=24E10EC7032927E584D286F8324CD64F&contentid=4001128
168
+ 4&cpidentifier=The%20Booth&creativeid=136384&distro=hulu&dist
169
+
170
+ adstart
171
+
172
+
173
+ GET http://t2.hulu.com/v3/playertracking/adstart?a=1&beaconevent=adstart&bitrate=650&cb=1310426772274_280&client=Firefox&computerguid=24E10EC7032927E584D286F8324CD64F&contentid=40011284&cpidentifier=The%20Booth&creativeid=136384&distro=hulu&distroplatform=hulu&embedurl=961c34a23740b1fab95d944c7656ee95&exid=1&flash=LNX%2010%2C3%2C181%2C34&language=en&os=Linux%202.6.38-8-generic-pae&packageavailability=shared&packageid=1&pid=NO_MORE_RELEASES_PLEASE_40011284&placementid=28920&planid=0&player=105047&playermode=normal&pod=4_1_a&position=1095948&
174
+
175
+ GET http://t2.hulu.com/v3/playertracking/adload?a=1&beaconevent=adload&bitrate=650&cb=1310426771445_951&client=Firefox&computerguid=24E10EC7032927E584D286F8324CD64F&contentid=4001128
176
+ 4&cpidentifier=The%20Booth&creativeid=136384&distro=hulu&dist
177
+
178
+
179
+ GET http://t2.hulu.com/v3/playertracking/adload?a=1&beaconevent=adload&bitrate=650&cb=1310426771445_951&client=Firefox&computerguid=24E10EC7032927E584D286F8324CD64F&contentid=4001128
180
+ 4&cpidentifier=The%20Booth&creativeid=136384&distro=hulu&dist
181
+
182
+ then content playback resume
183
+
184
+
185
+
186
+ Determine platform
187
+
188
+ ruby-1.9.2-p180 :001 > RUBY_PLATFORM
189
+ => "i686-linux"
190
+
191
+ [choi hellenic~]$ ruby -e "puts RUBY_PLATFORM"
192
+ x86_64-darwin10.7.0
193
+
194
+
195
+ Control sound
196
+
197
+ OSX
198
+ sudo osascript -e "set Volume 0"
199
+ - or to 10
200
+
201
+ inux
202
+
203
+ amixer set Master mute
204
+ amixer set Master unmute
205
+
206
+
207
+
208
+ Last login: Fri Jul 1 19:49:01 2011
209
+ loading .bash_profile
210
+ loaded .bash_aliases
211
+ [choi spartan~]$ osascript -e "set Volume 10"
212
+ 1
213
+ [choi spartan~]$ osascript -e "get output volume of (get Volume settings)"
214
+ 56
215
+ [choi spartan~]$ osascript -e "set Volume output volume 10"
216
+ [choi spartan~]$ osascript -e "set Volume output volume 60"
217
+
data/README.markdown ADDED
@@ -0,0 +1,80 @@
1
+ # Hulu Automuter
2
+
3
+
4
+ Hulu Automuter automatically mutes commercials that play while you watch Hulu
5
+ shows and movies in your web browser.
6
+
7
+ [screenshots]
8
+
9
+ Benefits:
10
+
11
+ * You won't have to manually toggle your sound to mute those darn commercials
12
+ * The sound comes back on right on cue
13
+ * Hulu still gets their ad impressions registered: it's as if you paid attention to them
14
+
15
+
16
+ ## Prerequisites
17
+
18
+ * Ruby 1.8.6 or higher (developed on Ruby 1.9.2)
19
+ * OS X or Linux with `amixer` installed
20
+ * a web browser you can configure to use an HTTP proxy (e.g. Chrome, Firefox)
21
+
22
+
23
+ ## Install
24
+
25
+ gem install hulu-automuter
26
+
27
+ If you get an error message saying that hulu-automuter is missing, then you
28
+ probably have a `PATH` issue. Try one of these workarounds:
29
+
30
+ * Put the directory where Rubygems installs executables on your `PATH`
31
+ * Try installing with `sudo gem install hulu-automuter`
32
+
33
+ To upgrade Hulu Automuter to a newer version, just repeat the installation procedure.
34
+
35
+ ## Usage
36
+
37
+ hulu-automuter [ -p port ]
38
+
39
+ Options:
40
+
41
+ -p [port] proxy port to use (default: 8123)
42
+ -v print version number
43
+
44
+ To use hulu-automuter, you need to configure the web browser you want to use
45
+ for watching Hulu to use hulu-automuter as its HTTP proxy.
46
+
47
+ Configure the HTTP proxy setting in your web browser network proxy preferences
48
+ to localhost:proxy-port.
49
+
50
+ For example, if you want to use the default, you should set your browser to use
51
+ a HTTP proxy at localhost:8123.
52
+
53
+ Then you can start hulu-automuter and go to hulu.com in your configured web
54
+ browser.
55
+
56
+ Press `CTRL-c` to stop hulu-automuter.
57
+
58
+
59
+ ## Bug reports and feature requests
60
+
61
+ Please submit these at either of these places:
62
+
63
+ * <https://github.com/danchoi/hulu-automuter/issues>
64
+ * <http://groups.google.com/group/hulu-automuter-users>
65
+
66
+
67
+ ## About the developer
68
+
69
+ My name is Daniel Choi. I specialize in Ruby, Rails, MySQL, PostgreSQL, and iOS
70
+ development. I am based in Cambridge, Massachusetts, USA, and the little
71
+ software company I run with Hoony Youn is called [Kaja Software](http://kajasoftware.com).
72
+
73
+ * Company Email: info@kajasoftware.com
74
+ * Twitter: [@danchoi][twitter]
75
+ * Personal Email: dhchoi@gmail.com
76
+ * My Homepage: <http://danielchoi.com/software>
77
+
78
+ [twitter]:http://twitter.com/#!/danchoi
79
+
80
+
data/Rakefile ADDED
@@ -0,0 +1,54 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib')
7
+
8
+ desc "release and build and push new website"
9
+ task :push => [:release, :web]
10
+
11
+ desc "Bumps version number up one and git commits"
12
+ task :bump do
13
+ basefile = "lib/hulu_automuter/version.rb"
14
+ file = File.read(basefile)
15
+ oldver = file[/VERSION = '(\d.\d.\d)'/, 1]
16
+ newver_i = oldver.gsub(".", '').to_i + 1
17
+ newver = ("%.3d" % newver_i).split(//).join('.')
18
+ puts oldver
19
+ puts newver
20
+ puts "Bumping version: #{oldver} => #{newver}"
21
+ newfile = file.gsub("VERSION = '#{oldver}'", "VERSION = '#{newver}'")
22
+ File.open(basefile, 'w') {|f| f.write newfile}
23
+ `git commit -am 'Bump'`
24
+ end
25
+
26
+ desc "build and push website"
27
+ task :web => :build_webpage do
28
+ puts "Building and pushing website"
29
+ Dir.chdir "../project-webpages" do
30
+ `scp out/hulu_automuter.html zoe2@instantwatcher.com:~/danielchoi.com/public/software/`
31
+ `rsync -avz out/images-hulu_automuter zoe2@instantwatcher.com:~/danielchoi.com/public/software/`
32
+ `rsync -avz out/stylesheets zoe2@instantwatcher.com:~/danielchoi.com/public/software/`
33
+ `rsync -avz out/lightbox2 zoe2@instantwatcher.com:~/danielchoi.com/public/software/`
34
+ end
35
+ #`open http://danielchoi.com/software/hulu_automuter.html`
36
+ end
37
+
38
+ desc "build webpage"
39
+ task :build_webpage do
40
+ `cp README.markdown ../project-webpages/src/hulu_automuter.README.markdown`
41
+ # `cp coverage.markdown ../project-webpages/src/hulu_automuter.coverage.markdown`
42
+ Dir.chdir "../project-webpages" do
43
+ puts `ruby gen.rb hulu_automuter #{HuluAutomuter::VERSION}`
44
+ `open out/hulu_automuter.html`
45
+ end
46
+ end
47
+
48
+
49
+ desc "git push and rake release bumped version"
50
+ task :bumped do
51
+ puts `git push && rake release`
52
+ Rake::Task["web"].execute
53
+ end
54
+
@@ -0,0 +1,110 @@
1
+ # Hulu Automuter
2
+ # by Daniel Choi <dhchoi@gmail.com>
3
+ # License: MIT License (c) 2011 Daniel Choi
4
+
5
+ require 'hulu_automuter/version'
6
+
7
+ port = 8123
8
+
9
+ if ARGV.first =~ /-p/
10
+ port = ARGV[1] || 8123
11
+ elsif ARGV.first =~ /-v/
12
+ puts "HuluAutomuter v#{HuluAutomuter::VERSION}"
13
+ elsif ARGV.first =~ /-h/
14
+ puts DATA.read
15
+ exit
16
+ end
17
+
18
+ require 'webrick/httpproxy'
19
+
20
+ module HuluControl
21
+ class Linux
22
+ def mute
23
+ "amixer set Master mute"
24
+ end
25
+
26
+ def unmute
27
+ "amixer set Master unmute"
28
+ end
29
+ end
30
+
31
+ class OSX
32
+ def initialize
33
+ @last_volume = 70
34
+ end
35
+
36
+ def mute
37
+ vol = `osascript -e "get output volume of (get volume settings)"`.strip.to_i
38
+ if vol > 0
39
+ @last_volume = vol
40
+ puts "Remember last volume: #{@last_volume}"
41
+ end
42
+ %Q|osascript -e "set Volume output volume 0"|
43
+ end
44
+
45
+ def unmute
46
+ %Q|osascript -e "set Volume output volume #{@last_volume}"|
47
+ end
48
+ end
49
+ end
50
+
51
+ hc = case RUBY_PLATFORM
52
+ when /linux/
53
+ HuluControl::Linux.new
54
+ when /darwin/
55
+ HuluControl::OSX.new
56
+ else
57
+ puts "Sorry, your platform (#{RUBY_PLATFORM}) is not supported"
58
+ exit 1
59
+ end
60
+
61
+ proxyproc = Proc.new{|req,res|
62
+ r = req.path
63
+ if r =~ /adload/
64
+ $stdout.puts ["ad loaded", hc.mute].join(', ')
65
+ `#{hc.mute}`
66
+ elsif r =~ /resume/
67
+ $stdout.puts ["content resuming", hc.unmute].join(', ')
68
+ `#{hc.unmute}`
69
+ end
70
+ nil
71
+ }
72
+ $stderr = File.new('/dev/null', 'w')
73
+ s = WEBrick::HTTPProxyServer.new(:Port => port,
74
+ :BindAddress => '0.0.0.0',
75
+ :RequestCallback => proxyproc)
76
+ trap("INT"){s.shutdown}
77
+
78
+ puts "HuluAutomuter is starting on port #{port}"
79
+ puts "Please remember to configure your web browser to use this HTTP proxy"
80
+ puts "Press CTRL-C to stop"
81
+
82
+ s.start
83
+
84
+ puts "Done"
85
+
86
+ __END__
87
+ ----------------------------------------
88
+ Hulu Automuter
89
+ by Daniel Choi <dhchoi@gmail.com>
90
+
91
+ Usage:
92
+
93
+ hulu-automuter [ -p port ]
94
+
95
+ -p [port] proxy port to use (default: 8123)
96
+ -v print version number
97
+
98
+ To use hulu-automuter, you need to configure the web browser you want to use
99
+ for watching Hulu to use hulu-automuter as its HTTP proxy.
100
+
101
+ Configure the HTTP proxy setting in your web browser network proxy preferences
102
+ to localhost:proxy-port.
103
+
104
+ For example, if you want to use the default, you should set your browser to use
105
+ a HTTP proxy at localhost:8123.
106
+
107
+ Then you can start hulu-automuter and go to hulu.com in your configured web
108
+ browser.
109
+
110
+
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "hulu_automuter/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "hulu-automuter"
7
+ s.version = HuluAutomuter::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.required_ruby_version = '>= 1.8.6'
10
+
11
+ s.authors = ["Daniel Choi"]
12
+ s.email = ["dhchoi@gmail.com"]
13
+ s.homepage = "http://danielchoi.com/software/hulu_automuter.html"
14
+ s.summary = %q{Auto-mute Hulu commericials}
15
+ s.description = %q{Auto-mute Hulu commericials}
16
+
17
+ s.rubyforge_project = "hulu_automuter"
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ["lib"]
23
+ end
24
+
25
+
@@ -0,0 +1,20 @@
1
+ # Hulu Automuter
2
+ # by Daniel Choi <dhchoi@gmail.com>
3
+ # License: MIT License (c) 2011 Daniel Choi
4
+
5
+ port = 8123
6
+ require 'webrick/httpproxy'
7
+
8
+ proxyproc = Proc.new{|req,res|
9
+ puts req.path
10
+ nil
11
+ }
12
+ #$stderr = File.new('/dev/null', 'w')
13
+
14
+ s = WEBrick::HTTPProxyServer.new(:Port => port,
15
+ :BindAddress => '0.0.0.0',
16
+ :RequestCallback => proxyproc)
17
+ trap("INT"){s.shutdown}
18
+ puts "starting"
19
+ s.start
20
+
@@ -0,0 +1,3 @@
1
+ module HuluAutomuter
2
+ VERSION = '0.0.1'
3
+ end
Binary file
data/screens/hulu1.png ADDED
Binary file
Binary file
data/screens/hulu2.png ADDED
Binary file
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hulu-automuter
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Daniel Choi
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-07-11 00:00:00 -04:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: Auto-mute Hulu commericials
18
+ email:
19
+ - dhchoi@gmail.com
20
+ executables:
21
+ - hulu-automuter
22
+ extensions: []
23
+
24
+ extra_rdoc_files: []
25
+
26
+ files:
27
+ - .gitignore
28
+ - NOTES
29
+ - README.markdown
30
+ - Rakefile
31
+ - bin/hulu-automuter
32
+ - hulu_automuter.gemspec
33
+ - lib/debug_proxy.rb
34
+ - lib/hulu_automuter/version.rb
35
+ - screens/hulu1-sm.png
36
+ - screens/hulu1.png
37
+ - screens/hulu2-sm.png
38
+ - screens/hulu2.png
39
+ has_rdoc: true
40
+ homepage: http://danielchoi.com/software/hulu_automuter.html
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options: []
45
+
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 1.8.6
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project: hulu_automuter
63
+ rubygems_version: 1.6.1
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Auto-mute Hulu commericials
67
+ test_files: []
68
+