INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: MyMovies 3.0  (Read 1980 times)

YannisA

  • Junior Woodchuck
  • **
  • Posts: 89
MyMovies 3.0
« on: October 21, 2009, 10:29:02 am »

MyMovies.dk are about to release version 3.0
In relation to MC14, should we go for it, or stick with the existing version? I'm running v2.56 now.
Logged

raym

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3583
Re: MyMovies 3.0
« Reply #1 on: October 21, 2009, 08:48:44 pm »

I'm thinking of upgrading too and as far as I can tell, in relation to MCs sidecar feature, there should be no probs. Guess I'll find out soon unless you beat me to it ;-)
Logged
RKM Smart Home - www.rkmsmarthome.com.au
Z-Wave Home Automation

struct

  • Galactic Citizen
  • ****
  • Posts: 380
Re: MyMovies 3.0
« Reply #2 on: October 22, 2009, 05:21:18 am »


not really answering your question...

I (due to my own stupidity) had a bit of trouble following instructions on the wiki for importing mymovies.xml files.  MM3 folder monitoring automatically created all of the mymovies.xml files, but it doesn't put them in the place that MC wants for VIDEO_TS and they aren't "Online Files" for avi's etc (MM3 just makes a mymovies.xml for each directory).  To make it work with MC is a lot of clicking if you are starting a new library.

So I thought I would write my first visual basic script to do the minor edit required in the mymovies.xml and automatically move and rename, including the cover art.  Seems to work for me.  Not good code, etc, but is a quick workaround and better than linking hundreds of mymovies.xml files to avi's manually.  I think you should be able to simply rerun as you update your MM3 database.

Hope it is useful.

Craig


Code: [Select]


'what is this for...
'Mymovies3 folder monitoring will create a mymovies.xml file for each subdirectory (but not VIDEO_TS) and doesn't care what is in it.
'this is great as it is automatic.
'Unfortunately MC14 requires that the mymovies.xml file reside in the VIDEO_TS directory and not the parent.  So first thing
'this code does is copy the mymovies.xml to the there.
'Also MC14 requires media files (eg avi, mov, etc) to have a mymovies.xml named as mymediafile.mymovies.xml To make this happen in MM3
'is tiresome (see the jriver wiki for exact details on what must happen).
'This script will modify mymovies.xml and rename correctly.


'this is not a pretty bit of code but seems to work, or should be a good starting point for more technical people
'it will go through your movies directory (one subdirectory deep only) (you define below)
'and will copy a mymovies.xml file to VIDEO_TS
'if it finds a video file (you define extensions below) it will modify the
'mymovies.xml file and rename to nameofmymovie.mymovies.xml and same with front and back cover
'as mentioned only goes down one directory so if you have rips in further sub directories you may need to modify.
'hope it is useful, or at least a good starting point.


Option Explicit
Const OverwriteExisting = TRUE

Dim FSO, Fold, FIL, TS, fld, fld2
Dim strFolder, strContent, strPath, strComputer, objwmiservice, filelist
dim nameonly, extension
dim find1, find2, find3, find4, filename, replacewith1, replacewith2, replacewith3, replacewith4
dim dfilecontents, filecontents
dim f, compiledlist, tempfilename
Const ForReading = 1, ForWriting = 2, ForAppending = 8

'Change as needed
strFolder = "\\tv\Public\Videos"
tempfilename = "c:\temp\delme.txt"

on error resume next

'Create the filesystem object
Set FSO = CreateObject("Scripting.FileSystemObject")
'Get a reference to the folder you want to search
Set fold = FSO.GetFolder(strFolder)
     
compiledlist = strFolder & "\forMC.xml"
WriteFile compiledlist, "<!>"

for each fld in fold.subfolders
' msgbox("1 " & fld.name)
for each fld2 in fld.subfolders
if fld2.name = "VIDEO_TS" then
'msgbox ("fld2path" & fld2.path)
'msgbox ("fldpath" & fld.path)
Fso.CopyFile(fld.path & "\mymovies.xml"), (fld2.path & "\mymovies.xml")
Fso.CopyFile(fld.path & "\mymovies-front.jpg"), (fld2.path & "\mymovies-front.jpg")
Fso.CopyFile(fld.path & "\mymovies-back.jpg"), (fld2.path & "\mymovies-back.jpg")

FileContents = GetFile(fld2.path & "\mymovies.xml")
appendfile compiledlist, filecontents
end if
next

'31
for each fil in fld.files
extension = right(fil.name,3)
nameonly = left(fil.name,len(fil.name)-4)

'msgbox(extension & "  " & nameonly)
if extension = "avi" or extension = "mkv" or extension = "mov" or extension = "mp4" then
Fso.CopyFile(fld.path & "\mymovies.xml"), (fld.path & "\" & nameonly & ".mymovies.xml")
Fso.CopyFile(fld.path & "\mymovies-front.jpg"), (fld.path & "\" & nameonly & ".mymovies-front.jpg")
Fso.CopyFile(fld.path & "\mymovies-back.jpg"), (fld.path & "\" & nameonly & ".mymovies-back.jpg")

FileName = fld.path & "\" & nameonly & ".mymovies.xml"
Find1 = "<Front>mymovies-front.jpg</Front>"
    find2 = "<Back>mymovies-back.jpg</Back>"
find3 = "<LocationSideA>.</LocationSideA>"
find4 = "<LocationTypeSideA>1</LocationTypeSideA>"
ReplaceWith1 = "<Front>" & nameonly & ".mymovies-front.jpg</Front>"
    ReplaceWith2 = "<Back>" & nameonly & ".mymovies-back.jpg</Back>"
ReplaceWith3 = "<LocationSideA>.\" & fil.name & "</LocationSideA>"
ReplaceWith4 = "<LocationTypeSideA>2</LocationTypeSideA>"

'Read source text file
' msgbox(find3)
FileContents = GetFile(FileName)
'replace all string In the source file
dFileContents = replace(FileContents, Find1, ReplaceWith1, 1, -1, 1)
dFileContents = replace(dFileContents, Find2, ReplaceWith2, 1, -1, 1)
dFileContents = replace(dFileContents, Find3, ReplaceWith3, 1, -1, 1)
dFileContents = replace(dFileContents, Find4, ReplaceWith4, 1, -1, 1)

'Compare source And result
if dFileContents <> FileContents Then
'write result If different
  if fso.fileexists(tempfilename) then FSO.Deletefile(tempfilename)
  WriteFile tempfilename, dFileContents
end if
FSO.Deletefile(filename)

  Fso.CopyFile(tempfilename), (Filename), (OverwriteExisting)
  Set f = fso.GetFile(filename)
  f.attributes = 2
'appendfile compiledlist, dfilecontents

end if
next
next


'Clean up
Set TS = Nothing
Set Fold = Nothing
Set FSO = Nothing



'Read text file
function GetFile(FileName)
  If FileName<>"" Then
    Dim FS, FileStream
    Set FS = CreateObject("Scripting.FileSystemObject")
      on error resume Next
      Set FileStream = FS.OpenTextFile(FileName)
      GetFile = FileStream.ReadAll
  End If
End Function

'Write string As a text file.
function WriteFile(FileName, Contents)
  Dim OutStream, FS

  on error resume Next
  Set FS = CreateObject("Scripting.FileSystemObject")
  Set OutStream = FS.OpenTextFile(FileName, 2, True)
   OutStream.Write Contents
   
End Function

'Write string As a text file.
function appendFile(FileName, Contents)
  Dim OutStream, FS

  on error resume Next
  Set FS = CreateObject("Scripting.FileSystemObject")
  Set OutStream = FS.OpenTextFile(FileName, 8, True)
   OutStream.Write Contents
   
End Function

Logged

YannisA

  • Junior Woodchuck
  • **
  • Posts: 89
Re: MyMovies 3.0
« Reply #3 on: October 22, 2009, 10:44:19 am »

Thanks for the straight reply in my question!
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72439
  • Where did I put my teeth?
Re: MyMovies 3.0
« Reply #4 on: October 22, 2009, 10:47:01 am »

Thanks, Craig.
Logged
Pages: [1]   Go Up