Skip to content

Commit

Permalink
Option to disable porn. PirateBay hierarchy reshuffle.
Browse files Browse the repository at this point in the history
  • Loading branch information
steeve committed Jan 15, 2014
1 parent 6ad76c9 commit 9298dc3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 36 deletions.
4 changes: 4 additions & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@
<setting id="encryption" label="Encryption" type="enum" values="Forced|Enabled|Disabled" default="1" />
</category>
<category label="Advanced">

<setting label="Custom domains" type="lsep"/>
<setting id="base_eztv" type="text" label="EZTV" default="http://eztv.it" />
<setting id="base_yify" type="text" label="YIFY Torrents" default="http://yify-torrents.com" />
<setting id="base_kickass" type="text" label="Kickass Torrents" default="http://kickass.to" />
<setting id="base_tpb" type="text" label="The Pirate Bay" default="http://thepiratebay.org" />

<setting label="Pornographic Content" type="lsep"/>
<setting id="porn" type="bool" label="Enable" default="true" />

<setting label="Google Analytics" type="lsep"/>
<setting id="ga_disable" type="bool" label="Disable (except for index)" default="false" />

Expand Down
62 changes: 26 additions & 36 deletions resources/site-packages/xbmctorrent/scrapers/tpb.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,32 @@
HEADERS = {
"Referer": BASE_URL,
}


CATEGORIES = [
("Audio", 100, [
("Music", 101),
("Audio Books", 102),
("Sound clips", 103),
("FLAC", 104),
("Other", 199),
]),
("Video", 200, [
("Movies", 201),
("Movies DVDR", 202),
("Music videos", 203),
("Movie clips", 204),
("TV shows", 205),
("Handheld", 206),
("HD - Movies", 207),
("HD - TV shows", 208),
("3D", 209),
("Other", 299),
]),
("Porn", 500, [
("Movies", 501),
("Movies DVDR", 502),
("HD - Movies", 503),
("Movie clips", 504),
("Other", 599),
]),
("Movies", 201),
("Movies DVDR", 202),
("Music videos", 203),
("Movie clips", 204),
("TV shows", 205),
("Handheld", 206),
("HD - Movies", 207),
("HD - TV shows", 208),
("3D", 209),
("Other", 299),
]

if plugin.get_setting("porn", bool):
CATEGORIES += [
("Porn", 500, [
("Movies", 501),
("Movies DVDR", 502),
("HD - Movies", 503),
("Movie clips", 504),
("Other", 599),
]),
]

# Cache TTLs
DEFAULT_TTL = 24 * 3600 # 24 hours

Expand All @@ -48,24 +46,16 @@
@ensure_fanart
@tracked
def piratebay_index():
return [
{"label": "Search", "path": plugin.url_for("piratebay_search"), "is_playable": False},
{"label": "Browse Torrents", "path": plugin.url_for("piratebay_browse_categories"), "is_playable": False},
]

yield {"label": "Search", "path": plugin.url_for("piratebay_search")}

@plugin.route("/tpb/browse")
@ensure_fanart
@tracked
def piratebay_browse_categories():
def make_cats(root, prefix=""):
for cat in root:
yield {
"label": "%s%s" % (prefix, cat[0]),
"path": plugin.url_for("piratebay_page", root="/browse/%d" % cat[1], page=0),
}
if len(cat) > 2:
for entry in make_cats(cat[2], prefix="%s " % prefix):
for entry in make_cats(cat[2], prefix="%s " % prefix):
yield entry

for cat in make_cats(CATEGORIES):
Expand Down

0 comments on commit 9298dc3

Please sign in to comment.