Foo Tunes
is a tool that provides a collection of functionality for use
between Foobar2000 and iTunes.
Functionality listed below:
- Converting playlist(.m3u/.m3u8) contents to be readable by iTunes.
- Convert a directory of FLACs to ALACs.
- Tweak metadata Genre to a common set of Genres.
- Watch a specific directory for changes and automatically ^run above.
Install watchdog for directory watching.
pip install watchdog
ffmpeg
or xld
(OSX Only) is needed to convert FLACs to ALACs.
brew install xld # OSX
brew install ffmpeg # OSX
pkg install ffmpeg # FreeBSD
ffmpeg
(for ALACs and MP3s) or mp4tags
(for ALACs)
brew install ffmpeg # OSX
pkg install ffmpeg # FreeBSD
brew install mp4v2 # OSX
pkg install mp4v2 # FreeBSD
metaflac
is needed for FLACs.
brew install flac # OSX
pkg install flac # FreeBSD
--m3u_flac_ext_to_alac # Default = False
X:\music\Pop\Taylor Swift\Lover\08 Paper Rings.flac
to:
X:\music\Pop\Taylor Swift\Lover\08 Paper Rings.m4a
--m3u_windows_to_posix # Default = False
X:\music\K-Pop\BTS\Butter\01 Butter.m4a
to:
X:/music/K-Pop/BTS/Butter/01 Butter.m4a
This is useful for changing drive paths or changing root directories from Windows to OSX, etc.
--m3u_from_str
--m3u_to_str
--m3u_from_str=X:/music
--m3u_to_str=/Users/james/Music
X:/music/K-Pop/IU/Love poem/03 Blueming.m4a
to:
/Users/james/Music/K-Pop/IU/Love poem/03 Blueming.m4a
--m3u_watch
python foo_tunes.py \
-m3u_i=/Volumes/bebe/playlists/windows \
-m3u_o=/Volumes/bebe/playlists/osx \
--m3u_flac_to_alac \
--m3u_windows_to_posix \
--m3u_from_str='X:/music' \
--m3u_to_str='/Users/james/Music' \
--m3u_watch \
--verbose
X:\music\J-Pop\Utada Hikaru\Distance\01 Wait & See.mp3
to:
/Users/james/Music/J-Pop/Utada Hikaru/Distance/01 Wait & See.mp3
./foo_tunes.py --flac_dir=~/some-dir-with-flac-files --verbose
--flac_dir # Default = None
--flac_overwrite_output # Default = False
--flac_delete_original # Default = False
--flac_convert_threads # Default = 4
--flac_watch
--change_genres
--flac_watch
python foo_tunes.py -i=/Volumes/drive/playlists/windows --verbose -o=temp --flac_ext_to_alac
./foo_tunes.py -i=/Volumes/bebe/playlists/windows --verbose -o=temp2 --flac_ext_to_alac
./foo_tunes.py -i=/Volumes/bebe/playlists/windows --verbose --flac_ext_to_alac
./foo_tunes.py -i=/Volumes/bebe/playlists/windows/ --from_str='X:\music' --to_str='Y:\music'
python -m foo_tunes_test
To automate this and let it run in the background:
Create script like below:
#!/usr/local/bin/bash
PATH=/usr/local/bin
if ! tmux has-session -t footunes 2>/dev/null; then
# https://stackoverflow.com/questions/25207909/tmux-open-terminal-failed-not-a-terminal
tmux new-session -d -s footunes python /bebe/script/foo_tunes/foo_tunes.py \
--flac_dir=/Volumes/bebe/sync/flacdir \
--flac_watch \
--flac_overwrite_output \
--flac_delete_original=False \
-m3u_i=/Volumes/bebe/playlists/windows \
-m3u_o=/Volumes/bebe/playlists/osx \
--m3u_flac_to_alac \
--m3u_windows_to_posix \
--m3u_from_str='X:/music' \
--m3u_to_str='/Users/james/Music' \
--m3u_watch \
--watch_sleep_time=30 \
--watch_playlist_delay=30 \
--watch_convert_delay=300 \
--verbose
fi
In this example, this script is located at:
/root/dir/sample_tmux.sh
Set up crontab to automatically start up the script.
$ sudo crontab -e
@reboot su james -c /root/dir/sample_tmux.s >/tmp/footunes.log 2>&1
*/5 * * * * su james -c /root/dir/sample_tmux.s >/tmp/footunes.log 2>&1
$ tmux attach # To attach and view script output.
#!/usr/local/bin/bash
PATH=/usr/local/bin
if ! tmux has-session -t footunes 2>/dev/null; then
# https://stackoverflow.com/questions/25207909/tmux-open-terminal-failed-not-a-terminal
tmux new-session -d -s footunes python /bebe/script/foo_tunes/foo_tunes.py \
--jojo \
--watch_sleep_time=30 \
--watch_playlist_delay=30 \
--watch_convert_delay=300 # Five minutes.
fi
Script is located at:
/bebe/script/foo_tunes/foo_tunes_tmux.sh
Set up crontab to automatically start up the script.
# Crontab:
@reboot su james -c /bebe/script/foo_tunes/foo_tunes_tmux.sh >/bebe/script/foo_tunes/startup.log 2>&1
*/5 * * * * su james -c /bebe/script/foo_tunes/foo_tunes_tmux.sh >/bebe/script/foo_tunes/run.log 2>&1
https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Query_syntax
https://hydrogenaud.io/index.php?topic=92694.0 https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#.25directoryname.25
Library -> Album List -> (right click an album) -> Create Autoplaylist
%path% HAS "_TO_PROCESS"
https://hydrogenaud.io/index.php?topic=93910.0 To prevent the playlists from being “erased”:
Go to Preferences -> Shell integration and tick "set enqueue as default action"
This adds the songs to the playlist rather than replacing the playlist. You can then drag and drop individual tunes into any playlist.
For example, say the original media library was on J:/ and the new media library is on X:/
Go to File -> Preferences -> Music Library -> Music Folders -> Add -> Add new Path.
Let Foobar2000 populate all the music files from the new path. There will be duplicates until this whole process is finished. Once Foobar’s music folder status is ‘Monitoring’, Use Playlist Revive.
Go to each playlist -> Edit -> Revive Dead Items.
This should point all the paths to the new path at the new music directory location.
%album artist% - %album%[ '('%date%')'] '['$if($strstr(%codec%,FLAC),FLAC,$if($strstr(%__codec_profile%,CBR),%__bitrate%,V0))']'/%tracknumber%. [%artist% - ]%title%
%genre%/%album artist%/%album%/%tracknumber% %title%
%genre%_%album_artist%_%album%_%tracknumber%_%title%
Uncheck Copy entire source folder content
Write statistics to file tags. Import statistics from file tags.
This is for play count, rating, etc.
View -> Playlist Manager -> Right Click -> Save all Playlists -> m3u8
There are a few entries for Playlist Manager, choose the last one.
Save to: e.g. X:\playlists\windows
- Make all music directories follow: Directory Style.
- Write all playback statistics to file tags.
- Export all playlists and convert them to use .m4a extension endings.
- Convert files in Foobar from FLAC to ALAC.
Right click -> Convert -> FLAC to ALAC (or use this script...)
- Import playlists with the m4a endings, delete original playlists.
File -> Load Playlist -> Select all Playlists