Created
June 18, 2014 22:02
-
-
Save wpjunior/fe4be75bd4e985d4be72 to your computer and use it in GitHub Desktop.
Netflix Simple Laucher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Simple Netflix laucher | |
# AUTHOR: Wilson Júnior <[email protected]> | |
import os | |
from gi.repository import ( | |
Gdk, Gtk, WebKit, Soup) | |
class NetflixWindow(Gtk.Window): | |
def __init__(self, cookie_path="~/.netflix.cookie", | |
*args, **kwargs): | |
super(NetflixWindow, self).__init__(*args, **kwargs) | |
cookiejar = Soup.CookieJarText.new( | |
os.path.expanduser(cookie_path), False) | |
cookiejar.set_accept_policy(Soup.CookieJarAcceptPolicy.ALWAYS) | |
session = WebKit.get_default_session() | |
session.add_feature(cookiejar) | |
self.connect('key_press_event', self.on_key_press_event) | |
self.connect('destroy', Gtk.main_quit) | |
self.connect('delete-event', Gtk.main_quit) | |
self.fullscreen() | |
self.scroll = Gtk.ScrolledWindow() | |
self.web = WebKit.WebView() | |
self.add(self.scroll) | |
self.scroll.add(self.web) | |
self.show_all() | |
self.web.open('http://netflix.com.br') | |
def on_key_press_event(self, window, event): | |
if event.keyval == Gdk.KEY_Escape: | |
Gtk.main_quit() | |
if __name__ == '__main__': | |
app = NetflixWindow() | |
Gtk.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment