XBMC Community Forum
NFO creator for Music Videos - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: Supplementary Tools for XBMC (/forumdisplay.php?fid=116)
+--- Thread: NFO creator for Music Videos (/showthread.php?tid=93241)



NFO creator for Music Videos - Auri - 2011-02-05 15:55

Anyone know a NFO creator that will make an NFO file based on a 'lets say) MP4 music video details such as duration, artist, director, genre, ...

I could make them manually but I have so many music video's it's not gonna be a fun task todo Sad Also imho the MTV and Yahoo music video scrapers are not usefull at all. Like less then 5% of my entire music video collection is being added to the library and all my music vids are named artist-songname.mp4

Would be nice if someone knows how to automate nfo creation so that XBMC can read the NFO files instead of relying on the scrapers.

Thanks in advance

Regards
Auri


- castortray - 2011-02-10 01:41

also looking for such a script, today I found this thread.
http://forum.xbmc.org/showthread.php?tid=78734&highlight=mtv+scraper
I think script from post 5 should help you, I'm not good in vbs so I can't help you in modifications Sad


- castortray - 2011-02-10 01:57

found it !!

http://forums.xbox-scene.com/index.php?showtopic=634549

Code:
'*  This script creates an XBMC Music Video Nfo file based on the artist & trackname. *
'*  The videos must be in the format artist - trackname for this to work.            *
'*  Mpg, Avi, Wmv, Swf, M2v & Flv files will be picked up.  If there is a format     *
'*  I've missed, line 34 can be edited to add the additional extension. Just add     *
'*  or lcase(exten) = ".xxx" before the word then.                          *
'*  The script is currently unble to handle any 4 letter extensions such as .mpeg    *
'*                                               *
'*  (C)Craigey2007 - 19-12-2007.  Use at your own risk.   V1.6                       *


i = 0
f = 0
g = 0
log_name = "music_video_nfo_creator.log"

Set sa = CreateObject("Shell.Application")
set oF = sa.BrowseForFolder(0, "Source Folder:", ssfWINDOWS)
if (not oF is nothing) then
set fi = oF.Items.Item
else
wscript.quit
end if

Set filesys = CreateObject("Scripting.fileSystemObject")
Set sourceFolder = filesys.GetFolder(fi.Path)     ' The folder containing your Music Videos

set mvidslist = sourceFolder.files
startTime = Timer

For Each mvids in mvidslist
    trackName = mvids.name
exten = right(mvids,4)
if lcase(exten) = ".avi" or lcase(exten) = ".wmv" or lcase(exten) = ".mpg" or lcase(exten) = ".swf" or lcase(exten) = ".m2v" or lcase(exten) = "flv" then
i=i+1
  str1=trackname

fullfilename = WScript.ScriptFullName
currentFolder = Left(filename, InstrRev(filename, "\"))

Set FSOd = CreateObject("Scripting.FileSystemObject")
Set logFile = FSOd.OpenTextFile(currentfolder+log_name, 8, True)

on error resume next
    seperator = InstrRev(str1,"-") 'count left to the first occurance of "-"
    if (seperator >= 1) then                'if the seperator exists split into artist and song
        artist = Left(str1,seperator-2)             'seperate artist
        songLength= (Len(str1)- seperator)          'work out chr length of song
        song = right(str1,songLength)              'seperate song
        strArtist = artist
        strSong = song
        strSong = Replace(strSong,exten,"")
        strArtist = trim(strArtist)
        strSong = trim(strSong)
        noArtist = Len(strArtist)    'if it can't find an artist name, replace with 'Unknown'
                
    if noArtist = "0" then
        strArtist = "Unknown"
    end if
     noSong = Len(strSong)            'if it can't find a song name, replace with 'Unknown'
        if noSong = "0" then                            
            strSong = "Unknown"
        end if
    else                    'leave alone
    strArtist = "Unknown"
    end if    

str1 = replace(str1,exten,"")
destfil = sourceFolder+"\"+str1+".nfo"



if filesys.FileExists(destFil) then
g=g+1
logFile.Writeline "INFO:**********************Duplicate Below*************************"
else
f=f+1
Set fsonfo = CreateObject("Scripting.FileSystemObject")
Set nfoFile = FSOnfo.OpenTextFile(destfil, 8, True)
nfoFile.Writeline "<musicvideo>"
nfoFile.Writeline "<title>"&strSong&"</title>"
nfoFile.Writeline "<artist>"&strArtist&"</artist>"
nfoFile.Writeline "<album></album>"
nfoFile.Writeline "<genre></genre>"
nfoFile.Writeline "<runtime></runtime>"
nfoFile.Writeline "<plot></plot>"
nfoFile.Writeline "<year></year>"
nfoFile.Writeline "<director></director>"
nfoFile.Writeline "<studio></studio>"
nfoFile.Writeline "</musicvideo>"
nfoFile.Close
set fsonfo = nothing
set nfofile = nothing
end if

timesecs = Timer - startTime
logFile.Writeline trackname & "        " & str1 & "        " & destfil & "        " & g & "        " & f & "        " & i & "        " &timesecs
logFile.Close

end if
next



elapsedTimesecs = Timer - startTime
elapsedtimesecs = CInt(elapsedtimesecs)


if i = "0" then
ermsg="No Music Videos were Found."
erTitle="Files not Found"
MsgBox erMsg, vbOkOnly + vbExclamation, erTitle
wscript.quit
end if

days=0
hours=0
mins=0

do while elapsedtimesecs > 59
mins=mins+1
elapsedtimesecs = elapsedtimesecs - 60
loop

do while mins > 59
hours=hours+1
mins = mins - 60
loop

do while hours > 24
days=days+1
hours = hours - 24
loop

timetaken = f & " Music Videos Nfo files created in "
if days > 1 then
timetaken = timetaken & days & " Days & "
end if
if days = 1 then
timetaken = timetaken & days & " Day & "
end if
if hours > 1 then
timetaken = timetaken & hours & " Hours & "
end if
if days <> 1 and hours = 1 then
timetaken = timetaken & hours & " Hour & "
end if
if mins > 1 then
timetaken = timetaken & mins & " Minutes & "
end if
if hours <> 1 and mins = 1 then
timetaken = timetaken & mins & " Minute & "
end if
if elapsedtimesecs <> 1 then
timetaken = timetaken & elapsedTimesecs & " Seconds"
end if
if elapsedtimesecs = 1 then
timetaken = timetaken & elapsedTimesecs & " Second"
end if

if g = 1 then
timetaken = timetaken & vbcrlf & g & " NFO File already existed & was ignored"
elseif g > 1 then
timetaken = timetaken & vbcrlf & g & " NFO Files already existed & were ignored"
end if

set FSOd = Nothing
set logFile = Nothing

msgbox(timetaken)

cheers !!!

I hope it help