6 Commits
2 changed files with 17 additions and 38 deletions
+8 -8
View File
@@ -1,20 +1,20 @@
# flac2pod
Seamlessly converts your existing FLAC library to be played on an iPod Classic.
This script makes use of ffmpeg to convert your existing FLAC music library to either MP3-320 or ALAC for easy iPod Classic use. It also takes advantage of "rg2sc" (https://github.com/rwinkhart/rg2sc) to convert any existing ReplayGain tags to Apple Sound Check tags that are compatible with Apple products.
This script makes use of ffmpeg to convert your existing FLAC music library to MP3-320 for easy iPod Classic use. It also takes advantage of "rg2sc" (https://github.com/rwinkhart/rg2sc) to convert any existing ReplayGain tags to Apple Sound Check tags that are compatible with Apple products.
# Usage
Simply run:
```
flac2pod -f --mp3 # will convert library to MP3-320 and forcefully update Sound Check tags (even if they already exist)
flac2pod --alac # will convert library to ALAC in a .m4a container - only updates missing Sound Check tags
flac2pod # will convert library to MP3-320 - only updates missing Sound Check tags
flac2pod
```
...and you will be prompted for your source and destination directories.
In order for flac2pod to function, your library must be structured as follows:
Library dir -> Artist dir -> Album dir -> FLAC files
library parent dir -> artist dir -> album dir -> FLAC files
When prompted for the source directory, you want to input your library parent directory.
+9 -30
View File
@@ -4,7 +4,6 @@
from os import path, system, walk
from pathlib import Path
from sys import argv
# utility functions
@@ -35,39 +34,23 @@ def create_destination():
.mkdir(0o700, parents=True, exist_ok=True)
def scan_destination_convert_alac():
for _file in source_directories[1]:
if not Path(f"{_file.replace(path.expanduser(source), path.expanduser(destination))}.m4a").is_file():
system(f"ffmpeg -i '{_file}.flac' -c:v copy -c:a alac -map_metadata 0 -id3v2_version 3 "
f"'{_file.replace(path.expanduser(source), path.expanduser(destination))}.m4a'")
def scan_destination_convert_mp3():
for _file in source_directories[1]:
print(_file)
if not Path(f"{_file.replace(path.expanduser(source), path.expanduser(destination))}.mp3").is_file():
system(f"ffmpeg -i '{_file}.flac' -c:v copy -ab 320k -map_metadata 0 -id3v2_version 3 "
f"'{_file.replace(path.expanduser(source), path.expanduser(destination))}.mp3'")
_file_s = _file.replace(' ', '\\ ').replace("'", "\\'") + '.flac'
_file_d = _file.replace(path.expanduser(source),
path.expanduser(destination)).replace(' ', '\\ ').replace("'", "\\'") + '.mp3'
print(f"\n\u001b[38;5;0;48;5;15mConverting {_file_s} to {_file_d}...\u001b[0m\n")
system(f"ffmpeg -i {_file_s} -c:v copy -ab 320k -map_metadata 0 -id3v2_version 3 {_file_d}")
rg2sc(_file_d)
def rg2sc():
if argument.__contains__('-f'):
system(f"{rg2sc} -f {destination}")
else:
system(f"{rg2sc} {destination}")
def rg2sc(_file):
system(f"rg2sc -f {_file}")
# program start sequence
# retrieve typed argument
argument_list = argv
i, argument = 0, ''
for _ in argument_list:
while i < len(argument_list) - 1:
i += 1
argument += argument_list[i] + ' '
argument = argument[:-1]
source = input('Source parent directory: ')
if source.endswith('/'):
source = source[:-1]
@@ -77,8 +60,4 @@ if destination.endswith('/'):
source_directories = scan_source()
create_destination()
if argument.__contains__('--alac'):
scan_destination_convert_alac()
else:
scan_destination_convert_mp3()
rg2sc()
scan_destination_convert_mp3()