Skip to content

Instantly share code, notes, and snippets.

@kirosvi
Last active August 29, 2015 14:14
Show Gist options
  • Save kirosvi/9fbe9e3f20082ce70493 to your computer and use it in GitHub Desktop.
Save kirosvi/9fbe9e3f20082ce70493 to your computer and use it in GitHub Desktop.

Revisions

  1. kirosvi revised this gist Jan 26, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion flac2ogg_in_folder.py
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@
    ffmpeg = "/usr/local/bin/ffmpeg" # path to ffmpeg
    params = "-strict experimental -acodec vorbis -aq 100" # settings of converting which in command after source file and before output file
    spec_sym = ")(][}{" # special symbols
    """ if spaces and special symbols in name, it was renamed """
    """ if spaces and special symbols in name, it was changed to "_" """
    for file in os.listdir(sourcedir):
    os.rename(file, file.replace(" ", "_"))
    for i in range(len(file)):
  2. kirosvi revised this gist Jan 26, 2015. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions flac2ogg_in_folder.py
    Original file line number Diff line number Diff line change
    @@ -8,9 +8,10 @@
    f_extnew = ".ogg" #extension of output file
    ffmpeg = "/usr/local/bin/ffmpeg" # path to ffmpeg
    params = "-strict experimental -acodec vorbis -aq 100" # settings of converting which in command after source file and before output file
    spec_sym = " )(][}{" # special symbols
    """ if spaces or special symbols in name, it was renamed """
    spec_sym = ")(][}{" # special symbols
    """ if spaces and special symbols in name, it was renamed """
    for file in os.listdir(sourcedir):
    os.rename(file, file.replace(" ", "_"))
    for i in range(len(file)):
    if file[i] in spec_sym:
    os.rename(file, file.replace(file[i], "_"))
  3. kirosvi revised this gist Jan 26, 2015. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions flac2ogg_in_folder.py
    Original file line number Diff line number Diff line change
    @@ -8,10 +8,12 @@
    f_extnew = ".ogg" #extension of output file
    ffmpeg = "/usr/local/bin/ffmpeg" # path to ffmpeg
    params = "-strict experimental -acodec vorbis -aq 100" # settings of converting which in command after source file and before output file

    """ if spaces in name, file was renamed """
    spec_sym = " )(][}{" # special symbols
    """ if spaces or special symbols in name, it was renamed """
    for file in os.listdir(sourcedir):
    os.rename(file, file.replace(" ", "_"))
    for i in range(len(file)):
    if file[i] in spec_sym:
    os.rename(file, file.replace(file[i], "_"))


    for file in os.listdir(sourcedir):
  4. kirosvi revised this gist Jan 26, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion flac2ogg_in_folder.py
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@
    ffmpeg = "/usr/local/bin/ffmpeg" # path to ffmpeg
    params = "-strict experimental -acodec vorbis -aq 100" # settings of converting which in command after source file and before output file

    """ if spaces in name, it was renamed """
    """ if spaces in name, file was renamed """
    for file in os.listdir(sourcedir):
    os.rename(file, file.replace(" ", "_"))

  5. kirosvi revised this gist Jan 26, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion flac2ogg_in_folder.py
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/usr/bin/python
    import os, subprocess


    os.chdir(os.getcwd())
    sourcedir = "./"
    convert_list = []
    f_ext = ".flac" #extension of source file
  6. kirosvi created this gist Jan 26, 2015.
    23 changes: 23 additions & 0 deletions flac2ogg_in_folder.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/usr/bin/python
    import os, subprocess


    sourcedir = "./"
    convert_list = []
    f_ext = ".flac" #extension of source file
    f_extnew = ".ogg" #extension of output file
    ffmpeg = "/usr/local/bin/ffmpeg" # path to ffmpeg
    params = "-strict experimental -acodec vorbis -aq 100" # settings of converting which in command after source file and before output file

    """ if spaces in name, it was renamed """
    for file in os.listdir(sourcedir):
    os.rename(file, file.replace(" ", "_"))


    for file in os.listdir(sourcedir):
    if f_ext in file:
    convert_list.append(file)


    for file in convert_list:
    child = subprocess.call(" ".join((ffmpeg, "-i", file, params, file.replace(f_ext, f_extnew))), executable='/bin/bash', shell=True)