Ticket #13614: silence_py_patch_01.patch

File silence_py_patch_01.patch, 1.7 KB (added by rcrdnalor, 12 months ago)

Patch for a python3 version of silence.py on the wiki

  • .py

    old new  
    1 #!/usr/bin/env python
     1#!/usr/bin/python3
    22# Build a skiplist from silence in the audio track.
    33# v1.0 Roger Siddons
    44# v2.0 Fix progid for job/player messages
     
    8989              self.argdict.update(v for v in validargs if v[1] is not None)
    9090              break
    9191        else:
    92           self.logger.log('No preset found for "' + title.encode('utf-8') + '" or "' + callsign.encode('utf-8') + '"')
     92          self.logger.log('No preset found for "' + title + '" or "' + callsign + '"')
    9393    except IOError:
    9494      self.logger.log('Presets file "' + filename + '" not found', MYLOG.ERR)
    9595    return self.argdict
     
    155155    rec = MythTV.Recorded((chanid, starttime), db)
    156156    channel = MythTV.Channel(chanid, db)
    157157
    158     logger.log('Processing: ' + channel.callsign.encode('utf-8') + ', ' + str(rec.starttime)
    159       + ', "' + rec.title.encode('utf-8') + ' - ' + rec.subtitle.encode('utf-8')+ '"')
     158    logger.log('Processing: ' + channel.callsign + ', ' + str(rec.starttime)
     159      + ', "' + rec.title + ' - ' + rec.subtitle + '"')
    160160
    161161    sg = MythTV.findfile(rec.basename, rec.storagegroup, db)
    162162    if sg is None:
     
    182182                stdin=p1.stdout, stdout=subprocess.PIPE)
    183183    # Pipe audio stream to C++ silence which will spit out formatted log lines
    184184    p3 = subprocess.Popen([kExe_Silence, "%d" % p1.pid] + param.getValues(), stdin=p2.stdout,
    185                 stdout=subprocess.PIPE)
     185                stdout=subprocess.PIPE, text=True)
    186186
    187187    # Purge any existing skip list and flag as in-progress
    188188    rec.commflagged = 2