This project has moved and is read-only. For the latest updates, please go here.

Worked Once but not again

Feb 28, 2012 at 11:59 PM

I like this script and ran it once on my Win7 x64 Ultimate (fully updated) and it worked for shows that I had recorded on a network PC. I tried to run the script again today and it just spins it's wheels and doesn't rename anything. I've run it in verbose mode and it doesn't show anything to clue me in to what's wrong.

The only thing I have changed in the XML configuration file is this:

   <recordings>\\FRONTMEDIAPC\Recorded TV2</recordings>
   <episode_name_format>{0} – S{1}.E{2} – {3}</episode_name_format>

 When it's done running it creates a log file with the following contents:

WTV-MetaRenamer v0.13
... found 'Date Created' at index 4
... found 'Title' at index 21
... found 'Subtitle' at index 196
... found 'Broadcast date' at index 258
... found 'Program Description' at index 259
... found 'Recording time' at index 260

There are 2 recordings which should be able to rename like it did before but no luck. I have tried opening PowerShell both as an Administrator and just opening it but that doesn't seem to make a difference.

I could copy this over to the networked PC but this did work once so I'm wondering why it doesn't now. Here's the contents of the UndoRenames script that was created on the first successful run the other day:

Rename-Item "\\FRONTMEDIAPC\Recorded TV2\Arthur - S13E05 - The Great MacGrady.wtv" "Arthur_KVIEDT_2012_02_06_06_58_00.wtv"
Rename-Item "\\FRONTMEDIAPC\Recorded TV2\Arthur - S13E02 - The Silent Treatment - Kung Fool.wtv" "Arthur_KVIEDT_2012_02_07_06_58_00.wtv"
Rename-Item "\\FRONTMEDIAPC\Recorded TV2\Arthur - S08E09 - Flea to Be You and Me - Kiss and Tell.wtv" "Arthur_KVIEDT_2012_02_14_06_58_00.wtv"
Rename-Item "\\FRONTMEDIAPC\Recorded TV2\Arthur - S04E05 - The Blizzard - The Rat Who Came to Dinner.wtv" "Arthur_KVIEDT_2012_02_17_07_01_41.wtv"
Rename-Item "\\FRONTMEDIAPC\Recorded TV2\Arthur - S02E10 - D.W. Goes to Washington - Arthur's Mystery Envelope.wtv" "Arthur_KVIEDT_2012_02_20_06_58_00.wtv"
Rename-Item "\\FRONTMEDIAPC\Recorded TV2\Arthur - S02E05 - Arthur's Underwear - Francine Frensky, Olympic Rider.wtv" "Arthur_KVIEDT_2012_02_23_06_58_00.wtv"
Rename-Item "\\FRONTMEDIAPC\Recorded TV2\Arthur - S02E06 - Buster Baxter, Cat Saver - Play it Again, D.W..wtv" "Arthur_KVIEDT_2012_02_24_06_58_00.wtv"
Rename-Item "\\FRONTMEDIAPC\Recorded TV2\WordWorld - S02E02 - My Fuzzy Valentine.wtv" "WordWorld S02.E01 - My Fuzzy Valentine_Love, Bug.wtv"
Rename-Item "\\FRONTMEDIAPC\Recorded TV2\WordWorld - S02E23 - Bear's Bed Sled.wtv" "WordWorld_KVIEDT_2012_02_23_11_28_00.wtv"

Anyone got any great ideas??


Feb 29, 2012 at 8:26 AM

Does the log file say anything after the "... found" bits?

To be honest, I would not really expect the script to work with the recordings stored remotely. It was always my expectation that the script would be run on the system storing the recordings, although the recordings could be moved to a remote location.

The main reason for saying that is because the attributes that the script looks for in order to decide episode information are stored as part of the filing system metadata and not stored within the actual file data. I'm not entirely sure if the attributes are readable across a network - I've never tried it. It looks like it did work for you but, I'll be honest, it comes as a bit of a surprise that it worked.

My suggestion would be to run the script locally on the PC that is doing the recordings. I can look at the log file you are getting at the moment to see if I can spot anything else if you want to upload the complete file.



Feb 29, 2012 at 4:34 PM

Hi Philip:

Thanks for the reply. I’m attaching a log file from running the script again this morning as well as a screen copy of the –verbose output. I’ve zipped everything up so you can take a look at it.

Right now I right click on PowerShell and run as Administrator because I think initially I had problems getting it to work if I didn’t do that but now it does seem to run and get the same results if I just open a PowerShell window or open it as Administrator.

I did try to copy the directory over to the PC that has the recordings but when I tried to run it I got an error about something needed to be signed so I’ll need to look into that. When I copied the script over the networked PC with the recordings I still was using my PC and just changing directories over to the networked PC so that probably through another curve ball at this!



Feb 29, 2012 at 5:04 PM

OK, I think I found the problem and it had to do with the episode naming string. I ran this in verbose mode and had a bunch of errors but missed that the first error listed was pointing to lin 11. Not sure why it had a problem as you can see what I was running from my first post. I changed it once and still had a problem so as a test I just removed all the spaces and dashes and it appears to be running now (across the network because when I went to the network PC and ran the script it gave me the same problem).

When you run this with -whatif the output log files get overwritten. I think your script wants to write a log file for each occurance but it doesn't change the log file name so it lists the same log file 4 times.

I'll try and do some more testing later today and report what I find but right now it's running and it seems like it may take awhile. I've noticed that when guides pull down children's which have 2 shows per episode the the episode title is the concatentation of the 2 show names seperated by a ; but in database they use a / as the seperator so it makes the fuzzy logic work harder I think. It would be nice to add a flag in the series.xml document to let your script know that this series needs to replace the ; with a / when searching

Mar 1, 2012 at 6:07 PM

Glad to see you are making progress.

Broadcasters do use some weird episode name titles but I'll try to incorporate this into the logic.




Mar 1, 2012 at 8:26 PM

Sorry about the false alram, it seems that there must have been something odd in the XML config file because when I deleted a space and put it back in it worked just as before. I guess a good thing to know is that this does work across a network using UNC naming.

Any chance you could get this to work with TS recordings as well? I'm currently working with WHS and I've got MediaPortal running on it and recording directly on the server (why MS didn't do this from the beginning is beyond me!). My daughter needs to have the subtitles/CC on and I've found that I can only get this to work with WTV files. I'm not a programmer by day but I might be able to help you add in some capabilities if you're interested in putting any more time in your program.



Mar 3, 2012 at 10:26 AM

I'm glad you got it working. Sorry to hear that the XML file seems to upset the script so easily. It is on my wishlist to do something about that ;-). As you say, good to know that the script does work across a network.

With regard to your TS question, if you right-click on a file and choose Properties, what does Explorer show ... particularly compared to what you see when you right-click on a WTV file? The script can only work if there are the metadata properties to pull out but these aren't stored in the file itself.




Mar 3, 2012 at 5:54 PM

I wanted to attach a picture of the properties of the TS file but it doesn't appear that we can attach things to this thread. The properties-details tab of a TS file look identicle to a WTV file. One potential nice thing about MediaPortal is that it creates an XML file with the same name as the recording file so all the show details are there without having to hit thetvdb again. An example XML file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
      <value>The parents and their children promise not to watch TV for an entire week; Arthur learns that Binky can't sleep without a night light.</value>
      <value>Arthur's TV-Free Week; Night Fright</value>
      <value>2012-02-27 06:57</value>
      <value>2012-02-27 07:30</value>