Kodi Community Forum

Full Version: Music Videos & Custom Music Files Batch / Script - Scrape File Name to .NFO
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello All,

I am looking for a solution to accomplish the following:

1) Add my collection of Music Videos to the Kodi Library and access them just like movies.
2) Add my collection of Music Files the Kodi Library and access them just like movies.

These are all custom files and there is no internet scrapper data available for either content type. I understand that the only way I can achieve this is to make my own .NFO files for each file. Too many files and this will be too difficult to do manual. I only really care about title, artist, perhaps year and duration tags in such .nfo file. I do not need images as I will use my own local art at a later date.

I would like to ask a couple of questions before jumping in in case other's experience may help.

- Is it in anyway possible to use a single .NFO file for all Music Videos for less clutter in folder. My quick searches lead me to believe that this is not possible.

- Is there a simple batch / script or reliable app that can take the filename and create an .NFO file with just the title and artist data as a minimum... My filenames are named: Artist - Song.mp4 so the data is there to be extracted.

So really all I want to do is take this filename as an input from this format:
filename:
Artist - Song.mp4
And create an .NFO output like this:

xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<musicvideo>
  <artist>ArtistName</artist>
  <title>SongTitle</title>
</musicvideo>

Obviously something similar for my custom music files.

Any solutions or suggestions would be appreciated.

Thanks,
The music library is created from the embedded tags in your music files (flac, mp3 etc). Any nfo file you create will be of no use until Kodi has scanned the embedded tags and created the library entry.

Once the files are scanned, and according to how I have interpreted your post, you won't need nfo files because the music will already be in the library.

You state that there is no online information, so you will need tagging software to embed the tags such as Mp3tag... https://www.mp3tag.de/en/ What sort of music files are they? Home mixes?

Music Videos will require nfo files though. There is a simple template on this page in case you want to use it... https://kodi.wiki/view/NFO_files/Music_videos

thread moved to music
(2020-04-13, 21:55)Karellen Wrote: [ -> ]The music library is created from the embedded tags in your music files (flac, mp3 etc). Any nfo file you create will be of no use until Kodi has scanned the embedded tags and created the library entry.

Once the files are scanned, and according to how I have interpreted your post, you won't need nfo files because the music will already be in the library.

You state that there is no online information, so you will need tagging software to embed the tags such as Mp3tag... https://www.mp3tag.de/en/ What sort of music files are they? Home mixes?

Music Videos will require nfo files though. There is a simple template on this page in case you want to use it... https://kodi.wiki/view/NFO_files/Music_videos

thread moved to music
Thanks for the quick reply and moving the post.
Regarding the music files (yes, home mixes and custom remixed, etc.), that makes sense. I do have mp3tag so that should be easy enough to deal with. The problem now will be how to automate the creation of .NFO's for upto one thousand files. I just can't do that manually.

Is there an option to pull this basic data from the tile name for Music Videos? Like a script or batchfile. I only need the ArtistName & SoneTitle. Anything I found with google search was either an old project or not suitable for Music Videos it seems. I really want to avoid manually doing so many .nfo by hand.

Thanks,
(2020-04-13, 22:15)Jayson Wonder Wrote: [ -> ]Is there an option to pull this basic data from the tile name for Music Videos? Like a script or batchfile.
Not that I am aware of, but I don't use music videos so I don't follow it closely.

The only media manager I know that deals with music videos is Music Companion... https://forum.kodi.tv/showthread.php?tid=129134
There is also a dedicated music video/concert tool by @HomerJau ... https://forum.kodi.tv/showthread.php?tid=294333

But I am not sure if either of these can create the nfo file from a filename.
(2020-04-13, 22:25)Karellen Wrote: [ -> ]
(2020-04-13, 22:15)Jayson Wonder Wrote: [ -> ]Is there an option to pull this basic data from the tile name for Music Videos? Like a script or batchfile.
Not that I am aware of, but I don't use music videos so I don't follow it closely.

The only media manager I know that deals with music videos is Music Companion... https://forum.kodi.tv/showthread.php?tid=129134
There is also a dedicated music video/concert tool by @HomerJau ... https://forum.kodi.tv/showthread.php?tid=294333

But I am not sure if either of these can create the nfo file from a filename. 
Thank you, I will take a closer look at both of those links and see how I make out.
I'm not a coder and hence my solutions are always over the top complicated Smile. If you use anything from below and the world explodes in a billions rainbows, it's not by fault.

1) Batch file (with Bulk Rename Utility from https://www.bulkrenameutility.co.uk/Download.php, the command line version) that will create the nfo's with the same name as the music video files AND put the name of the music files inside each nfo file, respectively. Here's an example (replace given paths with yours; try on a few items only first, not on 3000 music vids):

xml:
dir /B "D:\!Video\MV\*.mkv" > "D:\!Video\MV\01_control_nfo.txt"
set /a N=0
for /f "tokens=*" %%a in (D:\!Video\MV\01_control_nfo.txt) do (
set /a N+=1
set v[!N!]=%%a
echo.>D:\!Video\MV\%%a.nfo
echo %%a >D:\!Video\MV\%%a.nfo
)
brc64 /DIRBig Grin:\!Video\MV\ /IGNOREFILEX /replaceci:..mkv.nfo:.nfo /execute
brc64 /DIRBig Grin:\!Video\MV\ /IGNOREFILEX /replaceci:.mkv.nfo:.nfo /execute
Del "D:\!Video\MV\02_control_nfo.txt"

2) Notepad++, open all nfo files and do a regex bulk rename. (this is regex kindergarten level, there is no advanced check if elements exist or not)

Find: (.*) - (.*) - (.*).mkv <- this is specific for when you have the year too, in the filename.
Replace (in all opened documents) with: <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>\r\n<musicvideo>\r\n<title>\3</title>\r\n<year>\2</year>\r\n<artist>\1</artist>\r\n<genre>MV</genre>\r\n<tag>MV</tag>\r\n</musicvideo>

So the contents inside the nfo change from, say,

xml:
Dua Lipa - 2020 - Physical.mkv
to

xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<musicvideo>
<title>Physical</title>
<year>2020</year>
<artist>Dua Lipa</artist>
<genre>MV</genre>
<tag>MV</tag>
</musicvideo>

Bulk save them in Notepad++. Done.


Also careful with Media Companion. In my experience too often the CD single cover became the cover of the music video, and when scraping the wiki, data like the music single Producer became the Director of the music video and such. Test first, see how it works for you.
(2020-04-13, 22:25)Karellen Wrote: [ -> ]There is also a dedicated music video/concert tool by @HomerJau ... 294333(thread)

But I am not sure if either of these can create the nfo file from a filename.

My Music Media Helper will auto create an nfo for every music video file (there’s a tool to do a single folder of videos and a separate batch tool that recursively does same for all music videos in sub-folders.

This was created for music concerts. If the concert folder is named: ARTIST - CONCERT NAME (YEAR) the code creates the nfo with Artist, Concert Name and Year read from the folder name. Each nfo gets same same name as video file and names the Track No. from the leading digits in the video file names, to create the track order.

Theres PDF docs to check out in the Music sticky section. There’s also a tool to auto rename all the video files in a folder from a copied list of titles (e.g copy and paste from a website list of track/chapters). It’s trying to semi automate as much as possible, easily.)

When those folders are under a (library scanned) Kodi Music Video source, all folders become ‘albums’ and music videos contained ‘songs/titles’. These can be navigated in Kodi menus, played in any order and you can create playlists of music videos.
Jayson,

For my Various Artists folders, example Knebworth (1990) I have individual music videos named:

01. Artist 1 - Song Title.mkv
02. Artist 2 - Song Title.mkv etc

In Kodi I can navigate to the Concert, then I see the song titles as: 01. Artist 1 - Sing Title etc.

I hope this helps.
Each and every one of these posts are very helpful. I will be testing some of these solutions today and I will update the form with my outcomes. This seems relatively straight forward and I think I can do it.

Thanks all,
(2020-04-13, 22:25)Karellen Wrote: [ -> ]
(2020-04-13, 22:15)Jayson Wonder Wrote: [ -> ]Is there an option to pull this basic data from the tile name for Music Videos? Like a script or batchfile.
Not that I am aware of, but I don't use music videos so I don't follow it closely.

The only media manager I know that deals with music videos is Music Companion... https://forum.kodi.tv/showthread.php?tid=129134
There is also a dedicated music video/concert tool by @HomerJau ... https://forum.kodi.tv/showthread.php?tid=294333

But I am not sure if either of these can create the nfo file from a filename. 
Ok well this particular software, Media Companion seem quite good. It is a bit daunting at first but I was able to loaded up my music video files and scrape and create .NFO files from file names pretty much instantly. It even found some internet meta data for rare stuff that other scrappers could not fine/ Perhaps due to the Wikipedia scrapping feature.

The only complaint at this point is that I wish I could have some control over the tags which are included in the output .NFO files. There is a lot in there that I do not need.

Serves the purpose nicely but I will still check the batch files / regex options suggested as well. I want lean .NFO files so this might be the better option for that purpose.

Thanks,