subs new naming

pull/1/head
DiMartinoXBMC 2015-01-19 00:36:29 +03:00
parent 6411568e9a
commit b129b2fc44
1 changed files with 11 additions and 14 deletions

View File

@ -247,21 +247,18 @@ class TorrentPlayer(xbmc.Player):
self.torrent.debug() self.torrent.debug()
status = self.torrent.torrentHandle.status() status = self.torrent.torrentHandle.status()
iterator = int(status.progress * 100) iterator = int(status.progress * 100)
xbmc.sleep(2000) #xbmc.sleep(2000)
for ind, title in subs: for ind, title in subs:
newFileName=os.path.join(self.userStorageDirectory,os.path.dirname(path),os.path.basename(title)) folder=title.split(os.sep)[0]
if xbmcvfs.exists(newFileName): temp=os.path.basename(title)
newFileName=None addition=os.path.dirname(title).lstrip(folder+os.sep).replace(os.sep,'.').replace(' ','_').strip()
for i in range(1,9): ext=temp.split('.')[-1]
temp=os.path.basename(title) temp = temp[:len(temp) - len(ext) - 1]+'.'+addition+'.'+ext
ext=temp.split('.')[-1] newFileName=os.path.join(os.path.dirname(path),temp)
temp = temp[:len(temp) - len(temp.split('.')[-1]) - 1]+'.'+str(i)+'.'+ext #print str((os.path.join(os.path.dirname(os.path.dirname(path)),title),newFileName))
if not xbmcvfs.exists(os.path.join(self.userStorageDirectory,os.path.dirname(path),temp)): if not xbmcvfs.exists(newFileName):
newFileName=os.path.join(self.userStorageDirectory,os.path.dirname(path),temp) xbmcvfs.copy(os.path.join(os.path.dirname(os.path.dirname(path)),title),newFileName)
break
if newFileName:
#print str((os.path.join(self.userStorageDirectory,title),newFileName))
xbmcvfs.copy(os.path.join(self.userStorageDirectory,title),newFileName)
def setup_play(self): def setup_play(self):
self.next_dling = False self.next_dling = False