Renaming tracks according to current meta and then web scraping the KEY and BPM from tubebat.com .๐ฅ
- Web scraping Key and BPM from tunebat.com
- Adding batch tags according to the filename (ID3v1, ID3v2.3, ID3v2.4)
- renaming the file according to the batch tag
I created this toolbox to help me sort my music library and add valuable information for DJing. I can imagine, most people are not interested in knowing the BPM and key of the track they are listening to, but for making smooth music mixes this is essential. Some music vendors such as beatport.com offer this metadata and some DJ software have algorithms to detect the key and BPM of a track. However in my case I didnโt want to rely on these services as I wanted to build my own DJ setup in M4L for Ableton (which I will upload soon...).
Web scraping is the process of collecting data from websites automatically using software tools. It's commonly used for market research, content aggregation, lead generation, and data analysis. However, it can be a sensitive activity legally and ethically, so it's important to be careful when scraping websites. In this application web scraping is used to gather metadata such as Key and BPM from the database used for the website tunebat.com.
- Google Chrome
- The addon I_dont_care_about_cookies (included in the repo)
- Packages: Selenium, requests, music_tag
-
Run the metaMusicToolboxGUI.py.
-
Select the folder with your tracks by clicking the "Select Directory" Button.
-
If your files are in the format artist - track.mp3 click on the Hyphen Separation checkbox.
-
Now you can click:
- Scrape Tunebat, which will rename your tracks to the format: artist - trackname_BPM_Key.mp3
- Meta to trackname, which will read the current meta files of your tracks, and renaim the files to artist - track.mp3
- Trackname to meta , which write the current artist- and trackname to the meta file.
Both the Meta to trackname and Trackname to Meta functions are implemented to prepare your library for the Scrape Tunebat process. For example if you have a CD the usual filename is: tracknumber - trackname.mp3, but has the right meta. By applying Meta to trackname you end up with a file named artist - trackname.mp3 which then can be used by the Scrape Tunebat function.
When you check the recheck Meta checkbox, tracks that already have a key and BPM in their trackname will not be skipped, but overwritten by the tunebat database.
If you check the Hypen separation checkbox, it is assumed your filename has the format artist - trackname.mp3. If not, the whole current filename will used for the search on tunebat.com.
Using the sliders you can decide how close the match of your filename and the database of tunebat.com needs to be in order to be used. When Checking the hypen separation button, it is assumed your filename is in the format artist - trackname.mp3 and therefore you can set thresholds for the artist match and trackname match individually. For my library an artist name thresh = 0.4 and track name thresh = 0.52 worked very well.
If you donโt have your filenames in the format artist - trackname.mp3 you can simply uncheck the Hypen separation checkbox and select a search accuracy of the whole filename compared to the artist+trackname of the tunebat.com database
- Please feel free to let me know if you have trouble getting the results you are looking for.
- Also what features could be added?