plugin.video.torrenter/cal.py

28 lines
1.1 KiB
Python
Raw Normal View History

2015-01-09 14:11:21 +03:00
# -*- coding: utf-8 -*-
import sys
2015-01-15 22:53:23 +03:00
import os, json
2015-01-09 14:11:21 +03:00
ROOT = os.path.dirname(sys.modules["__main__"].sys.argv[0])
searcherObject = {}
searcher = 'IMDB'
if ROOT + os.sep + 'resources' + os.sep + 'contenters' not in sys.path:
sys.path.insert(0, ROOT + os.sep + 'resources' + os.sep + 'contenters')
searcherObject[searcher] = getattr(__import__(searcher), searcher)()
2015-01-15 22:53:23 +03:00
#print str(searcherObject[searcher].get_contentList(category='search', subcategory='Hobbit'))
2015-01-19 17:32:24 +03:00
title='No Game No Life\\Subs.[GMC]\\No Game No Life - 06.ass'
path='D:\\torrents\\Torrenter\\No Game No Life\\No Game No Life - 06.mkv'
#path='/sdasda/asdasd/asdasd/No Game No Life - 06.mkv'
2015-01-15 22:53:23 +03:00
2015-01-19 17:32:24 +03:00
folder=title.split('\\')[0]
print folder
temp=os.path.basename(title)
print temp
addition=os.path.dirname(title).lstrip(folder+'\\').replace('\\','.').replace(' ','_').strip()
print addition
ext=temp.split('.')[-1]
temp = temp[:len(temp) - len(ext) - 1]+'.'+addition+'.'+ext
print temp
newFileName=os.path.join(os.path.dirname(path),temp.replace('\\',os.sep))
print str((os.path.join(os.path.dirname(os.path.dirname(path)),title.replace('\\',os.sep)),newFileName))