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):
newFileName=None
for i in range(1,9):
temp=os.path.basename(title) temp=os.path.basename(title)
addition=os.path.dirname(title).lstrip(folder+os.sep).replace(os.sep,'.').replace(' ','_').strip()
ext=temp.split('.')[-1] ext=temp.split('.')[-1]
temp = temp[:len(temp) - len(temp.split('.')[-1]) - 1]+'.'+str(i)+'.'+ext temp = temp[:len(temp) - len(ext) - 1]+'.'+addition+'.'+ext
if not xbmcvfs.exists(os.path.join(self.userStorageDirectory,os.path.dirname(path),temp)): newFileName=os.path.join(os.path.dirname(path),temp)
newFileName=os.path.join(self.userStorageDirectory,os.path.dirname(path),temp) #print str((os.path.join(os.path.dirname(os.path.dirname(path)),title),newFileName))
break if not xbmcvfs.exists(newFileName):
if newFileName: xbmcvfs.copy(os.path.join(os.path.dirname(os.path.dirname(path)),title),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