mirror of
https://github.com/rwinkhart/flac2pod.git
synced 2026-09-02 07:07:20 -04:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c321e4d856 | ||
|
|
17df92256f | ||
|
|
76e7beb27d | ||
|
|
b41698ab65 | ||
|
|
94fa7570ec | ||
|
|
9f9d69b1a3 |
@@ -1,20 +1,20 @@
|
|||||||
# flac2pod
|
# flac2pod
|
||||||
Seamlessly converts your existing FLAC library to be played on an iPod Classic.
|
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
|
# Usage
|
||||||
|
Simply run:
|
||||||
```
|
```
|
||||||
flac2pod -f --mp3 # will convert library to MP3-320 and forcefully update Sound Check tags (even if they already exist)
|
flac2pod
|
||||||
|
|
||||||
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
|
|
||||||
```
|
```
|
||||||
|
...and you will be prompted for your source and destination directories.
|
||||||
|
|
||||||
|
|
||||||
In order for flac2pod to function, your library must be structured as follows:
|
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.
|
When prompted for the source directory, you want to input your library parent directory.
|
||||||
|
|
||||||
|
|||||||
+9
-30
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
from os import path, system, walk
|
from os import path, system, walk
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from sys import argv
|
|
||||||
|
|
||||||
|
|
||||||
# utility functions
|
# utility functions
|
||||||
@@ -35,39 +34,23 @@ def create_destination():
|
|||||||
.mkdir(0o700, parents=True, exist_ok=True)
|
.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():
|
def scan_destination_convert_mp3():
|
||||||
for _file in source_directories[1]:
|
for _file in source_directories[1]:
|
||||||
print(_file)
|
|
||||||
if not Path(f"{_file.replace(path.expanduser(source), path.expanduser(destination))}.mp3").is_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 "
|
_file_s = _file.replace(' ', '\\ ').replace("'", "\\'") + '.flac'
|
||||||
f"'{_file.replace(path.expanduser(source), path.expanduser(destination))}.mp3'")
|
_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():
|
def rg2sc(_file):
|
||||||
if argument.__contains__('-f'):
|
system(f"rg2sc -f {_file}")
|
||||||
system(f"{rg2sc} -f {destination}")
|
|
||||||
else:
|
|
||||||
system(f"{rg2sc} {destination}")
|
|
||||||
|
|
||||||
|
|
||||||
# program start sequence
|
# 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: ')
|
source = input('Source parent directory: ')
|
||||||
if source.endswith('/'):
|
if source.endswith('/'):
|
||||||
source = source[:-1]
|
source = source[:-1]
|
||||||
@@ -77,8 +60,4 @@ if destination.endswith('/'):
|
|||||||
|
|
||||||
source_directories = scan_source()
|
source_directories = scan_source()
|
||||||
create_destination()
|
create_destination()
|
||||||
if argument.__contains__('--alac'):
|
scan_destination_convert_mp3()
|
||||||
scan_destination_convert_alac()
|
|
||||||
else:
|
|
||||||
scan_destination_convert_mp3()
|
|
||||||
rg2sc()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user