def save(self, dirTarget,withThumb=False,streamMode=StreamMode.Exodus): """ save the movie in .strm format for GOmovies addon """ name = '{0} ({1})'.format( self.nameEn.lower()[:40] , self.year ) base = File.cleanName(name) dirTarget = os.path.join( dirTarget , base ) info = os.path.join( dirTarget, '{0}.{1}'.format( base , 'nfo' ) ) File.ensureFolder(dirTarget) links = [] if streamMode == StreamMode.Exodus: links.append([name,self.asExodus()]) if streamMode == StreamMode.Pulsar: links.append([name,self.asPulsar()]) if streamMode == StreamMode.Salts: links.append([name,self.asSalts()]) if streamMode == StreamMode.Quasar: links.append([name,self.asQuasar()]) strm = os.path.join( dirTarget, '{0}.{1}'.format( base , 'strm' ) ) with codecs.open(strm,'w') as ff: ff.write("#EXTM3U\n") for xx in links: ff.write(u'#EXTINF:{0},{1}\n'.format(0,xx[0] )) ff.write(u'{0}\n'.format(xx[1])) if withThumb: thumb = os.path.join( dirTarget, 'folder.jpg'.format( base , 'jpg' )) if os.path.exists(thumb) == False: FileLoader.load(self.imdbInfo.get('Poster'), '@' + thumb ) if os.path.exists(info): return False with codecs.open(info,'w') as ff: ff.write('http://www.imdb.com/title/{0}'.format(self.idImdb)) return True
def initPaths(self): self.dirRoot = self.path self.dirSource = os.path.join( self.dirRoot, 'Feeder' ) self.cache = os.path.join( self.data , "Cache" ) self.dirLogs = os.path.join( self.data , "Logs" ) File.ensureFolder(self.cache ) File.ensureFolder(self.dirLogs) Log.log = self.log FileLoader.dirCache = os.path.join( self.data, "Cache" )
def initPaths(self): self.dirRoot = self.path self.cache = os.path.join( self.data , "Cache" ) self.dirLogs = os.path.join( self.data , "Logs" ) File.ensureFolder(self.cache ) File.ensureFolder(self.dirLogs) FileLoader.dirCache = os.path.join( self.data, "Cache" ) SeriesInfo.tvdbMoldDir = os.path.join( self.dirRoot , "html" ) Log.log = self.log
def library(self): library = self.config.getStr('library') if library == '': library = os.path.join( self.data , "Library" ) SeriesInfo.tvdbDataDir = os.path.join( library , ".tvdb" ) SeriesInfo.tvdbHtmlDir = os.path.join( library , ".html" ) File.ensureFolder(library) File.ensureFolder(SeriesInfo.tvdbDataDir) File.ensureFolder(SeriesInfo.tvdbHtmlDir) return library
def saveTvshow(self, dirTarget, langid=7): File.ensureFolder(dirTarget) with file(os.path.join(dirTarget, "tvshow.nfo"), "w") as ff: ff.write( "http://thetvdb.com/?{0}={1}&{2}={3}&{4}={5}".format("tab", "series", "id", self.tvdbId, "lid", langid) )
def library(self): library = self.config.getStr('library') if library == '': library = os.path.join( self.data , "Library" ) File.ensureFolder(library) return library