Skip to content

Commit

Permalink
Fix for URL redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
xodidox committed Jan 22, 2017
1 parent 99304a3 commit 920a669
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion service.subtitles.zimuzu/addon.xml
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.subtitles.zimuzu"
name="ZiMuZu"
version="1.0.1"
version="1.0.2"
provider-name="xodidox">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.requests" version="1.1.0"/>
<import addon="script.module.beautifulsoup4" version="4.3.2"/>
</requires>
<extension point="xbmc.subtitle.module"
Expand Down
5 changes: 4 additions & 1 deletion service.subtitles.zimuzu/changelog.txt
@@ -1,4 +1,7 @@
1.0.1
1.0.2
- Fix for URL redirection

1.0.1
- Minor tweak

1.0.0
Expand Down
11 changes: 8 additions & 3 deletions service.subtitles.zimuzu/service.py
Expand Up @@ -7,6 +7,7 @@
import urllib
import urllib2
import xbmcvfs
import requests
import xbmcaddon
import xbmcgui,xbmcplugin
from bs4 import BeautifulSoup
Expand All @@ -25,8 +26,12 @@

sys.path.append (__resource__)

ZIMUZU_API = 'http://www.zimuzu.tv/search?keyword=%s&type=subtitle'
ZIMUZU_BASE = 'http://www.zimuzu.tv'
try:
ZIMUZU_BASE = requests.get('http://www.zimuzu.tv', allow_redirects=False).headers['Location'].rstrip('/')
except:
ZIMUZU_BASE = 'http://www.zimuzu.tv'

ZIMUZU_API = ZIMUZU_BASE + '/search?keyword=%s&type=subtitle'
UserAgent = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)'

def log(module, msg):
Expand Down Expand Up @@ -102,7 +107,7 @@ def rmtree(path):
rmtree(os.path.join(path, dir))
for file in files:
xbmcvfs.delete(os.path.join(path, file))
xbmcvfs.rmdir(path)
xbmcvfs.rmdir(path)

def Download(url):
try: rmtree(__temp__)
Expand Down

0 comments on commit 920a669

Please sign in to comment.