mirror of
https://github.com/gryf/flac2ogg.git
synced 2026-10-06 05:20:38 +02:00
Use fstring intsead of string interpolation.
Also, removed python2 mentioning in readme.
This commit is contained in:
1 parent
8fe2c53ce9
commit
38dc4234e0
2 files changed
+9
-10
No files matched your search
+1
-1
@@ -15,7 +15,7 @@ conversion between different type of audio formats.
|
|||||||
Requirements
|
Requirements
|
||||||
============
|
============
|
||||||
|
|
||||||
- python in version 2.7 or 3
|
- python 3
|
||||||
- `mutagen`_ python library for tag read/write
|
- `mutagen`_ python library for tag read/write
|
||||||
- `vorbis tools`_ for ``ogg`` files encode/decode
|
- `vorbis tools`_ for ``ogg`` files encode/decode
|
||||||
- `lame`_ for ``mp3`` files encode/decode
|
- `lame`_ for ``mp3`` files encode/decode
|
||||||
|
|||||||
+8
-9
@@ -129,8 +129,8 @@ class OggEncoder(Encoder):
|
|||||||
self.quality = 8
|
self.quality = 8
|
||||||
|
|
||||||
def encode(self, input_fname, output_fname):
|
def encode(self, input_fname, output_fname):
|
||||||
sp.check_call(["oggenc", "-q%s" % self.quality, input_fname,
|
sp.check_call(["oggenc", f"-q{self.quality}", input_fname, '-o',
|
||||||
'-o', output_fname])
|
output_fname])
|
||||||
|
|
||||||
|
|
||||||
class Mp3Encoder(Encoder):
|
class Mp3Encoder(Encoder):
|
||||||
@@ -144,8 +144,7 @@ class Mp3Encoder(Encoder):
|
|||||||
self.quality = 6
|
self.quality = 6
|
||||||
|
|
||||||
def encode(self, input_fname, output_fname):
|
def encode(self, input_fname, output_fname):
|
||||||
sp.check_call(["lame", "-V%s" % self.quality, input_fname,
|
sp.check_call(["lame", f"-V{self.quality}", input_fname, output_fname])
|
||||||
output_fname])
|
|
||||||
|
|
||||||
|
|
||||||
class FileType:
|
class FileType:
|
||||||
@@ -288,7 +287,7 @@ class M4aType(FileType):
|
|||||||
if "," in wav:
|
if "," in wav:
|
||||||
wav = wav.replace(",", "\\,")
|
wav = wav.replace(",", "\\,")
|
||||||
sp.check_call(["mplayer", "-vo", "none", self.filename, "-ao",
|
sp.check_call(["mplayer", "-vo", "none", self.filename, "-ao",
|
||||||
"pcm:file=%s" % wav])
|
f"pcm:file={wav}"])
|
||||||
|
|
||||||
|
|
||||||
class WavType(FileType):
|
class WavType(FileType):
|
||||||
@@ -330,7 +329,7 @@ class OggType(FileType):
|
|||||||
"""Ogg Vorbis filetype"""
|
"""Ogg Vorbis filetype"""
|
||||||
|
|
||||||
def extract_wav(self):
|
def extract_wav(self):
|
||||||
"""Extract mp3 file to wav"""
|
"""Extract ogg vorbis file to wav"""
|
||||||
sp.check_call(["oggdec", self.filename])
|
sp.check_call(["oggdec", self.filename])
|
||||||
|
|
||||||
|
|
||||||
@@ -381,11 +380,11 @@ class Converter:
|
|||||||
base + ".wv.cue", base + ".ape.cue"):
|
base + ".wv.cue", base + ".ape.cue"):
|
||||||
if os.path.exists(tmp):
|
if os.path.exists(tmp):
|
||||||
cuefile = tmp
|
cuefile = tmp
|
||||||
print("*** cuefile: %s" % cuefile)
|
print(f"*** cuefile: {cuefile}")
|
||||||
break
|
break
|
||||||
|
|
||||||
if cuefile is None:
|
if cuefile is None:
|
||||||
print("*** No cuefile found for `%s'" % filename)
|
print(f"*** No cuefile found for `{filename}'")
|
||||||
return
|
return
|
||||||
|
|
||||||
cue = CueObjectParser(cuefile)
|
cue = CueObjectParser(cuefile)
|
||||||
@@ -394,7 +393,7 @@ class Converter:
|
|||||||
# list of wavs to encode
|
# list of wavs to encode
|
||||||
klass = Converter.extract_map.get(ext.lower())
|
klass = Converter.extract_map.get(ext.lower())
|
||||||
if not klass:
|
if not klass:
|
||||||
print("*** Cannot find right converter for `%s'" % ext)
|
print(f"*** Cannot find right converter for `{ext}'")
|
||||||
return
|
return
|
||||||
|
|
||||||
fobj = klass(filename, encoder)
|
fobj = klass(filename, encoder)
|
||||||
|
|||||||
Reference in new issue
Block a user