免費CDDB FreeDB 已關閉,因此我將使用 MusicRepair 和 Spotify API 自動獲取標籤。

4 min

language: ja bn en es hi pt ru zh-cn zh-tw

music.png

您好,我是無能。

以前我經常使用的 FreeDB 已經關閉了。

因此,我找到了 MusicRepair,它可以使用 Spotify API 自動獲取標籤,所以我就來使用它。


Github

https://github.com/kalbhor/MusicRepair

可以使用 pip 安裝。

pip3 install musicrepair

輸入 musicrepair 後,首次啟動時會提示您提供 API 金鑰!


Warning, you are missing the Spotify client ID. Add it using --config


Warning, you are missing the Spotify client secret. Add it using --config


Warning, you are missing the Genius key. Add it using --config


usage: musicrepair [-h] [-c] [-d REPAIR_DIRECTORY] [-R] [-r REVERT_DIRECTORY] [-n] [--format RENAME_FORMAT]

  __  __           _      _____                  _      
 |  \/  |         (_)    |  __ \                (_)     
 | \  / |_   _ ___ _  ___| |__) |___ _ __   __ _ _ _ __ 
 | |\/| | | | / __| |/ __|  _  // _ \ '_ \ / _` | | '__|
 | |  | | |_| \__ \ | (__| | \ \  __/ |_) | (_| | | |   
 |_|  |_|\__,_|___/_|\___|_|  \_\___| .__/ \__,_|_|_|   
                                    | |                 
                                    |_|                 

______________________________________________________________
|                                                            |
| Tries to find the metadata of songs based on the file name |
|                                                            |
| Update : pip install musicrepair -U                        |
|                                                            |            
| https://github.com/lakshaykalbhor/MusicRepair              |
|____________________________________________________________|

options:
  -h, --help            show this help message and exit
  -c, --config          Add API keys to config
                        
  -d REPAIR_DIRECTORY, --dir REPAIR_DIRECTORY
                        Specifies the directory where the music files are located
                        
  -R, --recursive       Specifies whether or not to run recursively 
                                                in the given music directory
                        
  -r REVERT_DIRECTORY, --revert REVERT_DIRECTORY
                        Specifies the directory where music files 
                                                that need to be reverted are located
                        
  -n, --norename        Does not rename files to song title
                        
  --format RENAME_FORMAT
                        Specify the title format used in renaming, 
                                                these keywords will be replaced respectively: 
                                                {title}{artist}{album}
                        

因此,我將去獲取 Spotify API。
一直以來,我與 Spotify 的相容性都不太好,光是打開別人的播放列表就會陷入重定向循環,這次也像這樣網站很慢無法訪問,所以我想我以後大概也不會再使用了。也許他們把所有資源都投入到手機版 API 了吧。

Redirect URI 說實話填什麼都可以,但因為是必填項目,所以我輸入了我另一個網域的網站。如果只是使用 API,我想填虛構的也可以。
然後,勾選 WebAPI 後會發行,請直接貼到 MusicRepair 中。

musicrepair --config

Enter Spotify client ID :在此處輸入獲取的客戶端金鑰
Enter Spotify client secret :~密鑰

接著,這次會要求提供 Genius API 金鑰來獲取歌詞,所以我就去獲取。

碰巧我一年前為了 AI 歌詞翻譯獲取了 API 金鑰,所以就直接使用它。

我給 API 取的名字太隨便了,連我自己都笑了。

Enter Genius key :輸入 Genius 的 CLIENT ID

這樣準備就完成了。

因為我希望它能遞歸地搜尋目錄,所以加上 -R 選項。

musicrepair -d 音樂資料夾 -R

這樣它就會自動獲取了。

因為我希望即使 SSH 會話斷開也能在後台運行,
而且如果嘗試額外重命名,似乎會因為包含特殊字元而發生錯誤?所以添加了不重命名的選項。

nohup musicrepair -d 音樂資料夾 -R -n &

就這樣設定。


那麼。

再次感謝您的關照。

Related Posts