Here is a screenshot from Time Machine. If you know exactly when you made your mistake you can select the date and time in the right-hand column, then select the folder that you want to restore in the main window, and click restore at the bottom of the screen.

If you're not sure exactly when things went wrong you drill down inside the media folder and look for a backup that includes an item you want to recover. When I clicked restore in the image above I got this prompt.

Which suggests that perhaps TM restores the object in the right most column rather than what is highlighted. Once you have the correct date and time you may need to browse back up to the Music folder and select iTunes so that is the iTunes folder that will be restored. Looking closely I see you can also right/option-click on the folder you want to restore to make sure you get exactly the right thing.
This should restore the entire selected folder to state it was at the time of the backup. If you restore the iTunes folder you should get the deleted files and the database that still had entires for them. You will likely lose any content recently added to the library, both database entries and the files themselves. The files should be recoverable from your more recent TM entries, but it that case you only restore specific files and folders and then add them to the library. You could also choose to be more selective from the outset. Which approach is more efficient will depend on exactly what has happened to the library.
tt2