def load_file_in_same_dir(ref_file, filename):
 from couchpotato.core.helpers.encoding import toUnicode
 path = (split_path(toUnicode(ref_file))[:(-1)] + [filename])
 for (i, p) in enumerate(path):
  if p.endswith(u'.zip'):
   zfilename = os.path.join(*path[:(i + 1)])
   zfile = zipfile.ZipFile(zfilename)
   return zfile.read(u'/'.join(path[(i + 1):]))
 return u(io.open(os.path.join(*path), encoding=u'utf-8').read())

def load_file_in_same_dir ( ref_file , filename ) : from couchpotato . core . helpers . encoding import toUnicode path = ( split_path ( toUnicode ( ref_file ) ) [ : ( - 1 ) ] + [ filename ] ) for ( i , p ) in enumerate ( path ) : if p . endswith ( u'.zip' ) : zfilename = os . path . join ( * path [ : ( i + 1 ) ] ) zfile = zipfile . ZipFile ( zfilename ) return zfile . read ( u'/' . join ( path [ ( i + 1 ) : ] ) ) return u ( io . open ( os . path . join ( * path ) , encoding = u'utf-8' ) . read ( ) )
load a given file .