diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/Scallywag b/Scallywag index ad8f8a8..40ed384 100755 --- a/Scallywag +++ b/Scallywag @@ -21,14 +21,12 @@ class Config: class Scallywag: def on_btnRefresh_clicked( self, object, data=None ): + # TODO implement refresh self.status("refresh pressed") def on_btnSearch_clicked( self, object, data=None ): self.status("search pressed") - - - # clear the results_store # seeders, leechers, size, name self.results_store.clear() @@ -36,10 +34,6 @@ class Scallywag: for row in self.results_store: self.results_store.remove(row) - # prove to me that the results_store is populated - for row in self.results_store: - print(row[:]) - for column in self.results_tree_view.get_columns(): self.results_tree_view.remove_column(column) @@ -47,7 +41,6 @@ class Scallywag: self.results_tree_view.set_model(self.results_store) # add search result entries to the results store - # TODO add retrieval from search textentry search_field = self.builder.get_object("txtSearch") search_terms = search_field.get_text() @@ -55,10 +48,6 @@ class Scallywag: print( result.__str__() ) self.results_store.append( [ result.seeders, result.leechers, result.size, result.title, result.author, result.url ]) - # prove to me that the results_store is populated - for row in self.results_store: - print(row[:]) - for i, col_title in enumerate( [ "Seeders", "Leechers", "Size", "Title", "Author", "Url" ] ): # renderer creation renderer = Gtk.CellRendererText() @@ -69,8 +58,6 @@ class Scallywag: # add column to tvw self.results_tree_view.append_column(column) - - def get_current_proxy(self): return self.mnuPulldown.get_active_text() @@ -80,9 +67,7 @@ class Scallywag: self.status( str.format( "Changed PirateBay proxy site to {0}", self.config.proxy ) ) - def get_results(self, search_terms): - self.searcher = searcher.Scraper( self.config ) results = self.searcher.get_results( search_terms ) @@ -95,11 +80,10 @@ class Scallywag: selection = self.results_tree_view.get_selection() (tm, ti) = selection.get_selected() url = tm.get_value(ti, 5) - # TODO scrape url for magnet link then pass to xdg-open magnet = self.searcher.get_magnet( url ) - subprocess.call(["xdg-open", magnet]) + subprocess.Popen( "xdg-open {0}".format(magnet), shell=True ) self.status("Opening Magnet with xdg-open...") @@ -149,7 +133,6 @@ class Scallywag: self.window.show_all() - if __name__ == "__main__": main = Scallywag("config.ini") diff --git a/rsrc/Scraper/__pycache__/__init__.cpython-36.pyc b/rsrc/Scraper/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 08dedf6..0000000 Binary files a/rsrc/Scraper/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/rsrc/Scraper/__pycache__/proxylister.cpython-36.pyc b/rsrc/Scraper/__pycache__/proxylister.cpython-36.pyc deleted file mode 100644 index 58896eb..0000000 Binary files a/rsrc/Scraper/__pycache__/proxylister.cpython-36.pyc and /dev/null differ diff --git a/rsrc/Scraper/__pycache__/searcher.cpython-36.pyc b/rsrc/Scraper/__pycache__/searcher.cpython-36.pyc deleted file mode 100644 index e69a64b..0000000 Binary files a/rsrc/Scraper/__pycache__/searcher.cpython-36.pyc and /dev/null differ diff --git a/rsrc/Scraper/searcher.py b/rsrc/Scraper/searcher.py index 8a1b5d3..0deb6a7 100644 --- a/rsrc/Scraper/searcher.py +++ b/rsrc/Scraper/searcher.py @@ -33,13 +33,11 @@ class Scraper: def craft_url(self, protocol, proxy, search_terms): # https://pirate.blue/s/?q=Raising+Arizona&category=0&page=0&orderby=99 f = { 'q': search_terms, 'category': 0, 'page': 0, 'orderby': 99 } - return str.format( "{0}://{1}/s/?{2}", protocol, proxy, urllib.parse.urlencode(f) ) - + url = str.format( "{0}://{1}/s/?{2}", protocol, proxy, urllib.parse.urlencode(f) ) + print(url) + return url def get_results(self, search_terms): - print("Fetching from") - print(self.config.proxy) - url = self.craft_url( "https", self.config.proxy, search_terms ) fetch_results = self.client.get( url ) @@ -76,7 +74,7 @@ class Scraper: title = tr.xpath('td[2]/div[1]/a[1]/text()')[0] seeders = tr.xpath('td[3]/text()')[0] leechers = tr.xpath('td[4]/text()')[0] - author = tr.xpath('td[2]/font/a/text()')[0] + author = tr.xpath('td[2]/font/a/text()') size_unprocessed = tr.xpath('td[2]/font/text()')[0] url = tr.xpath('td/div[@class="detName"]/a[@class="detLink"]/@href')[0] diff --git a/rsrc/gui/#winMain.glade# b/rsrc/gui/#winMain.glade# deleted file mode 100644 index 9dd5ab0..0000000 --- a/rsrc/gui/#winMain.glade# +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - winMain - False - 500 - 600 - - - - boxMain - True - False - vertical - - - True - False - - - False - True - 0 - - - - - True - False - - - mnuPulldown - True - False - 6 - 6 - 6 - - - - True - True - 0 - - - - - gtk-refresh - btnRefresh - True - True - True - 6 - 6 - True - True - - - - False - False - 3 - - - - - False - True - 0 - - - - - stsBar - True - False - 10 - 10 - 10 - 10 - 6 - 6 - True - 2 - - - False - True - end - 0 - - - - - True - False - - - False - True - 6 - 3 - - - - - Open in Client - btnDownload - True - True - True - - - - False - True - end - 4 - - - - - True - True - in - - - True - False - - - tvwResults - True - True - - - - - - - - - - True - True - end - 5 - - - - - boxSearch - True - False - - - txtSearch - True - True - True - True - True - 6 - 6 - True - - - - True - True - 0 - - - - - gtk-find - btnSearch - True - True - True - True - 6 - True - True - - - - False - True - 2 - - - - - False - True - 6 - - - - - - - True - False - - - - diff --git a/rsrc/gui/proxyselector.glade~ b/rsrc/gui/proxyselector.glade~ deleted file mode 100644 index 14fdcd3..0000000 --- a/rsrc/gui/proxyselector.glade~ +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - False - 440 - 250 - - - True - False - vertical - - - True - False - Select a PirateBay Proxy - - - True - False - 0 - - - - - True - False - - - True - False - - - True - True - 0 - - - - - Select - True - True - True - - - False - True - 1 - - - - - Refresh - True - True - True - - - False - True - 3 - - - - - False - True - 1 - - - - - - - - - diff --git a/rsrc/gui/winMain.glade~ b/rsrc/gui/winMain.glade~ deleted file mode 100644 index 5daefcf..0000000 --- a/rsrc/gui/winMain.glade~ +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - winMain - False - 500 - 600 - - - - boxMain - True - False - vertical - - - True - False - - - False - True - 0 - - - - - True - False - - - mnuPulldown - True - False - 6 - 6 - 6 - - - - True - True - 0 - - - - - gtk-refresh - btnRefresh - True - True - True - 6 - 6 - True - True - - - - False - False - 3 - - - - - False - True - 0 - - - - - stsBar - True - False - 10 - 10 - 10 - 10 - 6 - 6 - True - 2 - - - False - True - end - 0 - - - - - True - False - - - False - True - 6 - 3 - - - - - Open in Client - btnDownload - True - True - True - - - - False - True - end - 4 - - - - - True - True - in - - - True - False - - - tvwResults - True - True - - - - - - - - - - True - True - end - 5 - - - - - boxSearch - True - False - - - txtSearch - True - True - True - True - 6 - 6 - True - - - - True - True - 0 - - - - - gtk-find - btnSearch - True - True - True - True - 6 - True - True - - - - False - True - 2 - - - - - False - True - 6 - - - - - - - True - False - - - -