Merge pull request #6 from DiMartinoXBMC/master

merge from origin
pull/7/head
inpos 2016-03-19 21:15:02 +04:00
commit 65c9e8ef9e
3 changed files with 21 additions and 24 deletions

View File

@ -18,8 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import tempfile
import Downloader
import xbmc
import xbmcaddon
@ -1484,7 +1482,7 @@ class Core:
if append_filesize:
fileTitle += ' [%d MB]' % (size / 1024 / 1024)
hasSize = True
contentList.append((unescape(fileTitle), str(filedict.get('ind')), size))
contentList.append([unescape(fileTitle), str(filedict.get('ind')), size])
#contentList = sorted(contentList, key=lambda x: x[0])
dirList, contentListNew = cutFolder(contentList, tdir)

View File

@ -21,10 +21,6 @@
import hashlib
import sys
import Libtorrent
import AceStream
import Anteoloader
import Inposloader
from functions import log
class Torrent():
@ -33,15 +29,19 @@ class Torrent():
def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'):
self.get_torrent_client()
if self.player == 'libtorrent':
import Libtorrent
self.player = Libtorrent.Libtorrent(storageDirectory, torrentFile, torrentFilesDirectory)
elif self.player == 'acestream':
import AceStream
self.player = AceStream.AceStream(storageDirectory, torrentFile, torrentFilesDirectory)
elif self.player == 'anteo':
import Anteoloader
self.player = Anteoloader.AnteoLoader(storageDirectory, torrentFile, torrentFilesDirectory)
elif self.player == 'inpos':
import Inposloader
self.player = Inposloader.InposLoader(storageDirectory, torrentFile, torrentFilesDirectory)
def __exit__(self):

View File

@ -422,45 +422,44 @@ def cutFolder(contentList, tdir=None):
if len(contentList) > 1:
common_folder = contentList[0][0]
if '\\' in common_folder:
common_folder = common_folder.split('\\')[0]
elif '/' in common_folder:
common_folder = common_folder.split('/')[0]
debug('[cutFolder]: common_folder '+common_folder)
if u'\\' in common_folder:
common_folder = common_folder.split(u'\\')[0]
elif u'/' in common_folder:
common_folder = common_folder.split(u'/')[0]
common = True
for item in contentList:
fileTitle = item[0]
if common_folder not in fileTitle:
if common_folder not in item[0]:
common = False
break
# print common_folder
for item in contentList:
fileTitle = item[0]
contentId = item[1]
dir = None
if common:
fileTitle = fileTitle[len(common_folder) + 1:]
item[0] = item[0][len(common_folder) + 1:]
# print fileTitle
#debug('[cutFolder]: item[0] '+item[0])
if '\\' in fileTitle:
dir = fileTitle.split('\\')[0]
elif '/' in fileTitle:
dir = fileTitle.split('/')[0]
if u'\\' in item[0]:
dir = item[0].split(u'\\')[0]
elif u'/' in item[0]:
dir = item[0].split(u'/')[0]
elif not tdir:
contentListNew.append(item)
if tdir and dir == tdir:
tupleContent = list(item)
tupleContent[0] = fileTitle[len(dir) + 1:]
contentListNew.append(tuple(tupleContent))
tupleContent[0] = item[0][len(dir) + 1:]
contentListNew.append(list(tupleContent))
if not tdir and dir and dir not in dirList:
dirList.append(dir)
debug('[cutFolder]: dirList, contentListNew '+str(dirList)+str(contentListNew))
return dirList, contentListNew
else:
debug('[cutFolder]: dirList, contentList '+str(dirList)+str(contentList))
return dirList, contentList