def main(argv): #------------------------------------------------------------------------------- """ usage: """ print(argv) args, opts = oss.gopt(argv[1:], [], [], main.__doc__ + __doc__) la = len(args) print(la) print(args) if not (0 < la < 3): oss.usage( 1, "usage: cvt_flv_mp3.py <file_name.flv> [<output_file_name.mp3>]") elif la == 2: pth, fn, ext = oss.splitFilename(args[0]) if not pth: pth = '.' infn = fn + '.flv' print(infn) pth, fn, ext = oss.splitFilename(args[1]) if not pth: pth = '.' outfn = pth + '\\' + fn + '.mp3' else: pth, fn, ext = oss.splitFilename(args[0]) if not pth: pth = '.' infn = fn + '.flv' outfn = pth + '\\' + fn + '.mp3' print("Pulling '%s' from '%s'" % (outfn, infn)) oss.r(FFMPEG % (infn, outfn)) oss.exit(0)
def main(argv): #------------------------------------------------------------------------------- """ usage: """ print(argv) args, opts = oss.gopt(argv[1:], [], [], main.__doc__ + __doc__) la = len(args) print(la) print(args) if not (0 < la < 3): oss.usage(1, "usage: cvt_flv_mp3.py <file_name.flv> [<output_file_name.mp3>]") elif la == 2: pth, fn, ext = oss.splitFilename(args[0]) if not pth: pth = '.' infn = fn + '.flv' print(infn) pth, fn, ext = oss.splitFilename(args[1]) if not pth: pth = '.' outfn = pth + '\\' + fn + '.mp3' else: pth, fn, ext = oss.splitFilename(args[0]) if not pth: pth = '.' infn = fn + '.flv' outfn = pth + '\\' + fn + '.mp3' print("Pulling '%s' from '%s'" % (outfn, infn)) oss.r(FFMPEG % (infn, outfn)) oss.exit(0)
def SyncDirs(self, dst=None, pretend=False): #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - src = self.GetFileInfo(self.srcPath) if not dst: dst = self.GetFileInfo(self.destPath) d, a = util.DiffLists(src.keys(), dst.keys()) #print src.keys() #print dst.keys() self.log("\nremoving: " + str(d), nl='\n') for f in d: if not pretend: oss.rm('-rf', self.destPath + '/' + f) self.log("\nadding: " + str(a)) for f in a: df = oss.normpath(self.destPath + '/' + f) sf = oss.normpath(self.srcPath + '/' + f) if oss.IsDir(sf): if not pretend: util.CallNoException(oss.mkdirs, (df)) else: pth, nm, ext = oss.splitFilename(df) if not pretend: oss.mkdirs(pth) oss.cp(sf, df) chgd = [] dm, chk = util.DiffLists(src.keys(), a) for f in chk: if src[f] != dst[f]: df = oss.normpath(self.destPath + '/' + f) sf = oss.normpath(self.srcPath + '/' + f) chgd.append(f) pth, nm, ext = oss.splitFilename(df) if not pretend: oss.mkdirs(pth) util.CallNoException(oss.cp, (sf, df)) self.log("\nchanged: " + str(chgd), bl='@') return self.GetFileInfo(self.destPath)
def SyncDirs(self, dst=None, pretend=False): #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - src = self.GetFileInfo(self.srcPath) if not dst: dst = self.GetFileInfo(self.destPath) d, a = util.DiffLists(src.keys(), dst.keys()) #print src.keys() #print dst.keys() self.log("\nremoving: " + str(d), nl='\n') for f in d: if not pretend: oss.rm('-rf', self.destPath + '/' + f) self.log("\nadding: " + str(a)) for f in a: df = oss.normpath(self.destPath + '/' + f) sf = oss.normpath(self.srcPath + '/' + f) if oss.IsDir(sf): if not pretend: util.CallNoException(oss.mkdirs, (df)) else: pth, nm, ext = oss.splitFilename(df) if not pretend: oss.mkdirs(pth) oss.cp(sf, df) chgd = [] dm, chk = util.DiffLists(src.keys(), a) for f in chk: if src[f] != dst[f]: df = oss.normpath(self.destPath + '/' + f) sf = oss.normpath(self.srcPath + '/' + f) chgd.append(f) pth, nm, ext = oss.splitFilename(df) if not pretend: oss.mkdirs(pth) util.CallNoException(oss.cp, (sf, df)) self.log("\nchanged: " + str(chgd), bl='@') return self.GetFileInfo(self.destPath)
def Create(self, files, doAppend=None): #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - p, fname, ext = oss.splitFilename(self.name) otf = bz2.BZ2File(self.name, 'w') inf = file(fname, "rb") shutil.copyfileobj(inf, otf) otf.close(); inf.close()
def UpdateDest(self, dst=None, pretend=False): #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - src = self.GetFileInfo(self.srcPath) if not dst: dst = self.GetFileInfo(self.destPath) d, a = util.DiffLists(src.keys(), dst.keys()) chgd = [] dm, chk = util.DiffLists(src.keys(), a) for f in chk: if src[f] != dst[f]: df = oss.normpath(self.destPath + '/' + f) sf = oss.normpath(self.srcPath + '/' + f) chgd.append(f) pth, nm, ext = oss.splitFilename(df) if not pretend: oss.mkdirs(pth) util.CallNoException(oss.cp, (sf, df)) self.log("\nchanged: " + str(chgd), bl='@') return self.GetFileInfo(self.destPath)
def UpdateDest(self, dst=None, pretend=False): #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - src = self.GetFileInfo(self.srcPath) if not dst: dst = self.GetFileInfo(self.destPath) d, a = util.DiffLists(src.keys(), dst.keys()) chgd = [] dm, chk = util.DiffLists(src.keys(), a) for f in chk: if src[f] != dst[f]: df = oss.normpath(self.destPath + '/' + f) sf = oss.normpath(self.srcPath + '/' + f) chgd.append(f) pth, nm, ext = oss.splitFilename(df) if not pretend: oss.mkdirs(pth) util.CallNoException(oss.cp, (sf, df)) self.log("\nchanged: " + str(chgd), bl='@') return self.GetFileInfo(self.destPath)
def Create(self, files, doAppend=None): #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - p, fname, ext = oss.splitFilename(self.name) otf = gzip.GzipFile(self.name, 'wb') with open(fname, "rb") as inf: shutil.copyfileobj(inf, otf) otf.close()
def Extract(self): #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - self.cd() p, fname, ext = oss.splitFilename(self.name) inf = bz2.BZ2File(self.name, 'rb') otf = file(fname, 'wb') shutil.copyfileobj(inf, otf) otf.close(); inf.close() return fname
def Extract(self): #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - self.cd() p, fname, ext = oss.splitFilename(self.name) inf = gzip.GzipFile(self.name, 'rb') with open(fname, 'wb') as otf: shutil.copyfileobj(inf, otf) inf.close() return fname
def List(self): #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - p, fname, ext = oss.splitFilename(self.name) print(fname)