Пример #1
0
def checkDir(dir1, dir2, exts=None, quick=False, recurse=False, supress=False, indent=0):
#-------------------------------------------------------------------------------
    d1 = set(oss.basename(oss.ls(dir1)))
    d2 = set(oss.basename(oss.ls(dir2)))

    same = True

    p = util.PrintOnce(supress, indent)
    for f in sorted(d1.difference(d2)):
        if oss.IsDir(dir1 + '/' + f):
            same = False
            p.printOnce("Objects in '%s' not in '%s':" % (dir1, dir2))
            p.print('    /{0}'.format(f))
        elif checkFile(f, exts):
            same = False
            p.printOnce("Objects in '%s' not in '%s':" % (dir1, dir2))
            p.print('    {0}'.format(f))
    p.didPrint()

    p.reset()
    for f in sorted(d2.difference(d1)):
        if oss.IsDir(dir2 + '/' + f):
            same = False
            p.printOnce("Objects in '%s' not in '%s':" % (dir2, dir1))
            p.print('    /{0}'.format(f))
        elif checkFile(f, exts):
            same = False
            p.printOnce("Objects in '%s' not in '%s':" % (dir2, dir1))
            p.print('    {0}'.format(f))
    p.didPrint()

    dirs = []
    p.reset()
    for f in sorted(d1.intersection(d2)):
        if oss.IsDir(dir1 + '/' + f):
            if recurse:
                dirs.append(f)
        elif checkFile(f, exts):
            if not compare(dir1 + '/' + f, dir2 + '/' + f, quick):
                same = False
                p.printOnce("Files with Differences{0}:".format(' (quick)' if quick else ''))
                #p.print('   ', dir1 + '/' + f + " != " + dir2 + '/' + f)
                p.print('   ', f)
    p.didPrint()

    if recurse:
        p.reset()
        for f in dirs:
            p.printOnce("Directories in {0} and {1}:".format(dir1, dir2))
            p.print('    /{0}'.format(f))
            same = checkDir(dir1 + '/' + f, dir2 + '/' + f, exts, quick, recurse, supress, indent+1) and same
        p.didPrint()

    return same
Пример #2
0
Файл: cff.py Проект: chyser/bin
def main(argv):
    #-------------------------------------------------------------------------------
    """
    usage: cff
        -i | --ignore      : ignore this file (or filespec)
        -l | --ignorelist  : dump list of ignored files
        -a | --add         : add the files to CVS

    list the files that have NOT been checked into the CVS archive

    """
    args, opts = oss.gopt(argv[1:], [('l', 'ignorelist'), ('a', 'add')], [],
                          [], [('i', 'ignore')], main.__doc__)

    if oss.exists('CVS'):
        if opts.ignore:
            with open(".cffignore", "a") as igf:
                for i in opts.ignore:
                    print(i, file=igf)
                oss.exit(0)

        if opts.add is not None:
            lst = doDir()
            for l in lst:
                print('cvs add ' + oss.basename(l))
                oss.r('cvs add ' + oss.basename(l))
            oss.exit(0)

        if opts.ignorelist is not None:
            lst = list(mkcvs.IGNORE_PATTERNS)
            with open(".cffignore") as igf:
                for line in igf:
                    line = line[:-1]
                    lst.append(line)
            print(lst)

        lst = doDir()
        for l in lst:
            print(l)

    else:
        print('montone')
        pth = oss.findFilePathUp('_MTN')

        if pth:
            lst = oss.r('mtn ls unknown', '|').split('\n')
            pwd = oss.normpath(oss.pwd())

            for i in lst:
                if (pth + i).startswith(pwd):
                    print(i)

    oss.exit(0)
Пример #3
0
Файл: cff.py Проект: chyser/bin
def main(argv):
#-------------------------------------------------------------------------------
    """
    usage: cff
        -i | --ignore      : ignore this file (or filespec)
        -l | --ignorelist  : dump list of ignored files
        -a | --add         : add the files to CVS

    list the files that have NOT been checked into the CVS archive

    """
    args, opts = oss.gopt(argv[1:], [('l', 'ignorelist'), ('a', 'add')], [], [], [('i', 'ignore')], main.__doc__)

    if oss.exists('CVS'):
        if opts.ignore:
            with open(".cffignore", "a") as igf:
                for i in opts.ignore:
                    print(i, file=igf)
                oss.exit(0)

        if opts.add is not None:
            lst = doDir()
            for l in lst:
                print('cvs add ' + oss.basename(l))
                oss.r('cvs add ' + oss.basename(l))
            oss.exit(0)

        if opts.ignorelist is not None:
            lst = list(mkcvs.IGNORE_PATTERNS)
            with open(".cffignore") as igf:
                for line in igf:
                    line = line[:-1]
                    lst.append(line)
            print(lst)

        lst = doDir()
        for l in lst:
            print(l)

    else:
        print('montone')
        pth = oss.findFilePathUp('_MTN')

        if pth:
            lst = oss.r('mtn ls unknown', '|').split('\n')
            pwd = oss.normpath(oss.pwd())

            for i in lst:
                if (pth + i).startswith(pwd):
                    print(i)

    oss.exit(0)
Пример #4
0
def get(pth):
#-------------------------------------------------------------------------------
    t = []
    for f in sorted(oss.ls(pth), key=lastMod):
        f = f.replace('\\', '/')
        t.append('    <li><a href="%s">%s</a></li>\n' % (f, oss.basename(f)))
    return t
Пример #5
0
    def co(self, args=None, opts=None):
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        if not self.cvsup:
            print('CVS Archive "%s" is down' % self.root, file=oss.stderr)
            return

        if args:
            name = args[0]
            oss.r(self.exe + ' co ' + name)
        else:
            name = oss.basename(oss.pushcd('..'))

            if opts.inPlace:
                print('inplace checkout')
                oss.r("cp -r %s /tmp/%s%s.bak" % (name, oss.DateFileName(), name))
                tn = '/tmp/cvs_inplace_' + name
                oss.mkdir(tn)
                oss.pushcd(tn)
                oss.r(self.exe + ' co ' + name)
                oss.popcd()
                oss.r("cp -r %s/%s/* %s" % (tn, name, name))
                oss.popcd()
            else:
                oss.r("mv %s /tmp/%s%s.bak" % (name, oss.DateFileName(), name))
                oss.r(self.exe + ' co ' + name)
                oss.popcd()
Пример #6
0
 def genReport(self):
     #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     lst = []
     for f, val in self.hits.items():
         f = oss.basename(f)
         lst.append(f)
         self.annotateFile(f, val)
         self.dumpDB(f, val)
     return lst
Пример #7
0
def backup():
#-------------------------------------------------------------------------------
    for f in oss.find(MUSIC_PATH, '*.mp3'):
        print(f)

        ff = BU_PATH + '\\' + oss.basename(f)
        if not oss.exists(ff):
            print('   ', "copied")
            cp(f, ff)
Пример #8
0
def backup():
    #-------------------------------------------------------------------------------
    for f in oss.find(MUSIC_PATH, '*.mp3'):
        print(f)

        ff = BU_PATH + '\\' + oss.basename(f)
        if not oss.exists(ff):
            print('   ', "copied")
            cp(f, ff)
Пример #9
0
def LoadPlugins(path, suffix=None, prefix=None):
#-------------------------------------------------------------------------------
    plugins = []
    if not isinstance(path, list):
        path = [path]

    for pth in path:
        for f in oss.ls(pth + '/*.py', pth + '/*.pyd'):
            plugins.extend(LoadPlugin(oss.splitnm(oss.basename(f)), path, suffix, prefix))
    return plugins
Пример #10
0
def LoadLibraries(path, func, cxt=None):
#-------------------------------------------------------------------------------
    if isinstance(path, (str, unicode)):
        path = [path]

    plugins = []
    for pth in path:
        for f in oss.ls(pth + '/*.py', pth + '/*.pyd'):
            plugins.extend(func(oss.splitnm(oss.basename(f)), path, cxt))
    return plugins
Пример #11
0
def LoadLibraries(path, func, cxt=None):
    #-------------------------------------------------------------------------------
    if isinstance(path, (str, unicode)):
        path = [path]

    plugins = []
    for pth in path:
        for f in oss.ls(pth + '/*.py', pth + '/*.pyd'):
            plugins.extend(func(oss.splitnm(oss.basename(f)), path, cxt))
    return plugins
Пример #12
0
    def Open(self, FileName, path=None):
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        if oss.basename(FileName) == FileName:
            if path is None:
                path = DEFAULT_CONFIG_DIR
            fname = path + '/' + FileName
        else:
            fname = FileName

        self.FileName = oss.expanduser(fname)
        return True
Пример #13
0
def LoadPlugins(path, suffix=None, prefix=None):
    #-------------------------------------------------------------------------------
    plugins = []
    if not isinstance(path, list):
        path = [path]

    for pth in path:
        for f in oss.ls(pth + '/*.py', pth + '/*.pyd'):
            plugins.extend(
                LoadPlugin(oss.splitnm(oss.basename(f)), path, suffix, prefix))
    return plugins
Пример #14
0
    def Open(self, FileName, path=None):
        #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        if oss.basename(FileName) == FileName:
            if path is None:
                path = DEFAULT_CONFIG_DIR
            fname = path + '/' + FileName
        else:
            fname = FileName

        self.FileName = oss.expanduser(fname)
        return True
Пример #15
0
def main(argv):
    #-------------------------------------------------------------------------------
    """ usage: listMusicPlayer.py [options]

    options:
        -s | --sync : sync computer with player
        -l | --list : list the songs
        -v | --verbose : extra info dump
    """
    args, opts = oss.gopt(argv[1:], [('l', 'list'), ('s', 'sync'),
                                     ('v', 'verbose')], [],
                          main.__doc__ + __doc__)

    ## get computer songs
    m0, d0 = getSongs(BU_PATH, 1)
    print('Found computer songs from "%s num: %d"' % (BU_PATH, len(m0)))

    if opts.list:
        for i in sorted(m0):
            print(i)
        oss.exit(0)

    ## get music box songs
    print('Searching musicplayer songs from "%s"' % MUSIC_PATH)
    m1, d1 = getSongs(MUSIC_PATH, 1)
    print('Found musicplayer songs from "%s" num: %d' % (MUSIC_PATH, len(m1)))

    ## what needs transfered
    m = m0 - m1

    l = len(m)
    print('Need to copy :', l)

    ## doit
    for i in sorted(m):
        f = d0[i]
        if opts.sync:
            try:
                print(f)
                cp(f, IMPORT_PATH + '\\' + oss.basename(f))
                time.sleep(13)
            except oss.OSScriptsError as ex:
                print('EXCEPTION:\n' + str(ex))
        else:
            print(i)
            if opts.verbose:
                print('   ', d0[i])

    print(l)
    oss.exit(0)
Пример #16
0
def DoPython(InputFileName, Force=None):
    #-------------------------------------------------------------------------------
    if gDEBUG:
        PythonTokenizer(InputFileName)
        return

    BUFileName = oss.basename(InputFileName) + ".beautify"
    OutputFileName = InputFileName

    if not Force and oss.exists(BUFileName):
        print >> sys.stderr, "Cannot make backup file '%s'" % BUFileName
        sys.exit(3)

    oss.mv(InputFileName, BUFileName)
    PythonTokenizer(BUFileName, OutputFileName)
Пример #17
0
def DoPython(InputFileName, Force=None):
#-------------------------------------------------------------------------------
    if gDEBUG:
        PythonTokenizer(InputFileName)
        return

    BUFileName = oss.basename(InputFileName) + ".beautify"
    OutputFileName = InputFileName

    if not Force and oss.exists(BUFileName):
        print >> sys.stderr, "Cannot make backup file '%s'" % BUFileName
        sys.exit(3)

    oss.mv(InputFileName, BUFileName)
    PythonTokenizer(BUFileName, OutputFileName)
Пример #18
0
def main(argv):
#-------------------------------------------------------------------------------
    """ usage: listMusicPlayer.py [options]

    options:
        -s | --sync : sync computer with player
        -l | --list : list the songs
        -v | --verbose : extra info dump
    """
    args, opts = oss.gopt(argv[1:], [('l', 'list'), ('s', 'sync'), ('v', 'verbose')], [], main.__doc__ + __doc__)

    ## get computer songs
    m0, d0 = getSongs(BU_PATH, 1)
    print('Found computer songs from "%s num: %d"' % (BU_PATH, len(m0)))

    if opts.list:
        for i in sorted(m0):
            print(i)
        oss.exit(0)

    ## get music box songs
    print('Searching musicplayer songs from "%s"' % MUSIC_PATH)
    m1, d1 = getSongs(MUSIC_PATH, 1)
    print('Found musicplayer songs from "%s" num: %d' % (MUSIC_PATH, len(m1)))

    ## what needs transfered
    m = m0 - m1

    l = len(m)
    print('Need to copy :', l)

    ## doit
    for i in sorted(m):
        f = d0[i]
        if opts.sync:
            try:
                print(f)
                cp(f, IMPORT_PATH + '\\' + oss.basename(f))
                time.sleep(13)
            except oss.OSScriptsError as ex:
                print('EXCEPTION:\n' + str(ex))
        else:
            print(i)
            if opts.verbose:
                print('   ', d0[i])

    print(l)
    oss.exit(0)
Пример #19
0
    def decvs(self, args, opts):
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        for f in oss.ls():
            bf = oss.basename(f)

            if bf.lower() == 'cvs':
                print('removing:', f)
                oss.r('rm -rf cvs')
                continue

            if self.ignoreFile(bf):
                continue

            if oss.IsDir(bf):
                oss.pushcd(bf)
                self.decvs(args, opts)
                oss.popcd()
Пример #20
0
def main(argv):
#-------------------------------------------------------------------------------
    """ usage: mkcvs [OPTIONS] <dir>
        Makes a cvs archive from the specified directory

        Options:
            -i | --ignore    :  specify extensions or files or directories to ignore
                                example: -i .bmp -i .jpg  or  -i badfile

"""
    args, opts = oss.gopt(argv[1:], [], [], [], [('i', 'ignore')], main.__doc__)

    if not oss.exists(oss.env['CVSROOT']):
        print "CVSROOT is down"
        oss.exit(1)

    if args:
       oss.cd(args[0])

    name = oss.basename(oss.pwd())

    if oss.exists(oss.env['CVSROOT'] + '/' + name):
        print >> oss.stderr, "Already exists:", oss.env['CVSROOT'] + '/' + name
        oss.exit(1)

    if opts.ignore is not None:
        if isinstance(opts.ignore, list):
            IGNORE_PATTERNS.extend(opts.ignore)
        else:
            IGNORE_PATTERNS.append(opts.ignore)

    il = bldIgnoreList()
    print "Ignoring Files: '%s'" % il

    oss.r(r'C:\bin\cvs.exe import %s %s %s %s1' % (il, name, name, name))
    oss.cd('..')
    oss.r("mv %s /tmp/%s.bak" % (name, name))

    oss.r(r'C:\bin\cvs.exe co %s' % name)

    oss.cd(name)
    for f in oss.ls():
        print f

    oss.r("C:\bin\cf.py")
    oss.exit(0)
Пример #21
0
    def checkfor(self, dir = '.'):
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        lst = []

        if not oss.exists('CVS/Entries'):
            return

        ## get list of files
        inf = file('CVS/Entries')
        have = set()
        for line in inf:
            try:
                have.add(line.split('/')[1])
            except:
                pass

        inf.close()

        try:
            igf = file(".cffignore")
            for line in igf:
                line = line[:-1]
                have.add(line)
        except IOError:
            pass

        inf.close()

        for f in oss.ls():
            f = oss.basename(f)
            if self.ignoreFile(f):
                continue

            if oss.IsDir(f):
                if not oss.exists(f + '/CVS'):
                    if f not in have:
                        lst.append("%s/%s/" % (dir, f))
                else:
                    oss.pushcd(f)
                    lst.extend(self.checkfor(dir + '/' + f))
                    oss.popcd()
            elif f not in have:
                lst.append("%s/%s" % (dir, f))

        return lst
Пример #22
0
    def trace(self, frame, event, arg):
        #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        #print(event, '\t', frame.f_code.co_filename, frame.f_lineno)

        if event in set([
                'call', 'return', 'exception', 'c_call', 'c_return',
                'c_exception'
        ]):
            bn = oss.basename(frame.f_code.co_filename)
            self.module = bn if bn in self.mods else None

        if self.module is not None and event == 'line':
            try:
                self.hits[self.module].add(frame.f_lineno)
            except KeyError:
                self.hits[self.module] = set([frame.f_lineno])

        return self.trace
Пример #23
0
Файл: cff.py Проект: chyser/bin
def doDir(dir='.'):
    #-------------------------------------------------------------------------------
    try:
        inf = open("CVS/Entries")
    except IOError:
        oss.usage(3, "Not a CVS archive")

    have = set()
    for line in inf:
        try:
            have.add(line.split('/')[1].upper())
        except:
            pass
    inf.close()

    ignr = set()
    try:
        with open(".cffignore") as igf:
            for line in igf:
                ignr.add(line.strip())
    except IOError:
        pass

    lst = []
    for f in oss.ls():
        f = oss.basename(f)
        if ignoreFile(f, ignr):
            continue

        if oss.IsDir(f):
            if not oss.exists(f + '/CVS'):
                if f.upper() not in have:
                    lst.append("%s/%s/" % (dir, f))
            else:
                opwd = oss.pwd()
                oss.cd(f)
                lst.extend(doDir(dir + '/' + f))
                oss.cd(opwd)
        elif f.upper() not in have:
            lst.append("%s/%s" % (dir, f))

    return lst
Пример #24
0
Файл: cff.py Проект: chyser/bin
def doDir(dir = '.'):
#-------------------------------------------------------------------------------
    try:
        inf = open("CVS/Entries")
    except IOError:
        oss.usage(3, "Not a CVS archive")

    have = set()
    for line in inf:
        try:
            have.add(line.split('/')[1].upper())
        except:
            pass
    inf.close()

    ignr = set()
    try:
        with open(".cffignore") as igf:
            for line in igf:
                ignr.add(line.strip())
    except IOError:
        pass

    lst = []
    for f in oss.ls():
        f = oss.basename(f)
        if ignoreFile(f, ignr):
            continue

        if oss.IsDir(f):
            if not oss.exists(f + '/CVS'):
                if f.upper() not in have:
                    lst.append("%s/%s/" % (dir, f))
            else:
                opwd = oss.pwd()
                oss.cd(f)
                lst.extend(doDir(dir + '/' + f))
                oss.cd(opwd)
        elif f.upper() not in have:
            lst.append("%s/%s" % (dir, f))

    return lst
Пример #25
0
    def add(self, args, opts):
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        """ adds the specified files or directories to CVS archive (possible
            offline)

            @type  args: sequence
            @param args: sequence of files or directories to add
        """

        for fn in args:
            if opts.noIgnore is None:
                if self.ignoreFile(oss.basename(fn)):
                    continue

            ext = oss.splitext(fn).lower()
            if opts.binary:
                cvsopts = ' -kb '
            else:
                cvsopts = ' -kb ' if ext in self.BinExts else ''
            self._issueCmd(' add ' + cvsopts + fn)
Пример #26
0
def main(argv):
#-------------------------------------------------------------------------------
    args, opts = oss.gopt(argv[1:], [('d', 'delete')], [], usage)

    la = len(args)

    if la < 1:
        usage('insufficient arguments')

    tgt = args[0]

    if la == 1:
        if opts.delete:
            rc = oss.r('linkd.exe "%s" /D' % tgt)
        else:
            rc = oss.r('linkd.exe "%s" "%s"' % (oss.basename(tgt), tgt))
    else:
        rc = oss.r('linkd.exe "%s" "%s"' % (args[1], tgt))

    oss.exit(rc)
Пример #27
0
    def create(self, args, opts):
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        if not self.cvsup:
            print('CVS Archive "%s" is down' % self.root, file=oss.stderr)
            return

        name = args[0] if args else oss.basename(oss.pwd())

        if not self.root.startswith(':pserver:'):
            if oss.exists(self.root + '/' + name):
                if opts.force:
                    pass
                else:
                    print('CVS Archive "%s" exists' % name, file=oss.stderr)
                    return

        msg = opts.msg if opts is not None else 'Initial Checkin: ' + name

        questionable = set([ '*' + ext for ext in self.QuestionableExtensions])
        binaries = set([ '*' + ext for ext in self.BinExts])
        il = "-I! " + ' '.join([ '-I "%s"' % pat for pat in (self.IgnorePatterns | questionable | binaries)])
        oss.r(self.exe + ' import -m"%s" %s %s %s %s1' % (msg, il, name, name, name))

        self.co(None, opts)
Пример #28
0
 def getFileTab(self, c):
     #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     """ returns the UI displayed name associated with this window
     """
     return oss.basename(self.getFO(cwin=c).fpath)
Пример #29
0
 def setChildTitle(self, c, FileName):
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     bfn = oss.basename(FileName)
     c.SetTitle(bfn)
Пример #30
0
def main(argv):
    #-------------------------------------------------------------------------------
    args, opts = oss.gopt(argv[1:], [('d', 'dup'), ('s', 'show')], [], __doc__)

    ign = getIgnoreSet()

    print("Cur Dir:", oss.pwd())
    for i in oss.find('.', '*.mp3'):
        ii = id3.ID3(i)
        err = True

        try:
            artist = translate(ii['ARTIST'])

            if artist in ['*', '<<unknown artist>>']:
                print(i, "artist name error: *")
                raise MyException('artist name error')

            if artist in ign:
                continue

            title = translate(ii['TITLE'])

            dir = BU_PATH + '/' + artist
            try:
                if not oss.exists(dir):
                    oss.mkdir(dir)
            except IOError as ex:
                print(i, "IOError: %s" % str(ex))
                raise MyException('artist name error')
            except TypeError as ex:
                print(i, "IOError: %s" % str(ex))
                raise MyException('artist name error')

            fn = dir + '/' + title + '.mp3'
            if not oss.exists(fn):
                print('%s --> %s' % (i, fn))
                if not opts.show:
                    cp(i, fn)
            elif opts.dup and not oss.cmp(i, fn):
                raise MyException('duplicate song')

            err = False

        except KeyError as ex:
            print('%s -- KeyError: %s' % (i, str(ex)))
        except UnicodeDecodeError as ex:
            print('%s -- UnicodeDecodeError: %s' % (i, str(ex)))
        except IOError as ex:
            print('%s -- IOError: %s' % (i, str(ex)))
        except TypeError as ex:
            print('%s -- TypeError: %s' % (i, str(ex)))
        except MyException as ex:
            print('%s -- MyExceptionError: %s' % (i, str(ex)))

        if 0 and err:
            dir = BU_PATH + '/id3_errors'
            f = dir + '/' + oss.basename(i)
            if not oss.exists(f):
                print('error:', i)
                cp(i, f)

    oss.exit(0)
Пример #31
0
 def makeBU(self, fn, force=False):
     #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     bfn = oss.basename(fn) + ".beautify"
     if not oss.exists(bfn) or force:
         oss.mv(fn, bfn)
     return bfn
Пример #32
0
def main(argv):
#-------------------------------------------------------------------------------
    args, opts = oss.gopt(argv[1:], [('d', 'dup'), ('s', 'show')], [], __doc__)

    ign = getIgnoreSet()

    print("Cur Dir:", oss.pwd())
    for i in oss.find('.', '*.mp3'):
        ii = id3.ID3(i)
        err = True

        try:
            artist = translate(ii['ARTIST'])

            if artist in ['*', '<<unknown artist>>']:
                print(i, "artist name error: *")
                raise MyException('artist name error')

            if artist in ign:
                continue

            title = translate(ii['TITLE'])

            dir = BU_PATH + '/' + artist
            try:
                if not oss.exists(dir):
                    oss.mkdir(dir)
            except IOError as ex:
                print(i, "IOError: %s" % str(ex))
                raise MyException('artist name error')
            except TypeError as ex:
                print(i, "IOError: %s" % str(ex))
                raise MyException('artist name error')

            fn = dir + '/' + title + '.mp3'
            if not oss.exists(fn):
                print('%s --> %s' % (i, fn))
                if not opts.show:
                    cp(i, fn)
            elif opts.dup and not oss.cmp(i, fn):
                raise MyException('duplicate song')

            err = False

        except KeyError as ex:
            print('%s -- KeyError: %s' % (i, str(ex)))
        except UnicodeDecodeError as ex:
            print('%s -- UnicodeDecodeError: %s' % (i, str(ex)))
        except IOError as ex:
            print('%s -- IOError: %s' % (i, str(ex)))
        except TypeError as ex:
            print('%s -- TypeError: %s' % (i, str(ex)))
        except MyException as ex:
            print('%s -- MyExceptionError: %s' % (i, str(ex)))

        if 0 and err:
            dir = BU_PATH + '/id3_errors'
            f = dir + '/' + oss.basename(i)
            if not oss.exists(f):
                print('error:', i)
                cp(i, f)

    oss.exit(0)
Пример #33
0
 def makeBU(self, fn, force=False):
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     bfn = oss.basename(fn) + ".beautify"
     if not oss.exists(bfn) or force:
         oss.mv(fn, bfn)
     return bfn
Пример #34
0
 def setChildTitle(self, c, FileName):
     #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     bfn = oss.basename(FileName)
     c.SetTitle(bfn)
Пример #35
0
 def getFileTab(self, c):
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     """ returns the UI displayed name associated with this window
     """
     return oss.basename(self.getFO(cwin = c).fpath)