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

Renaming and Moving of Commercial Skipping Files

Topics: question
Nov 7, 2013 at 12:19 AM
I'm not having any luck with my Comskip generated xml and vprj files being renamed and moved together with the matching wtv file. The only file that's being processed is the wtv file according to the log. I've tried it with and without an entry for commercial_metadata_path in the config file. I'm using WTV-MetaRenamer v0.18 since it indicated the addition of vprj files to the existing xml file rename and move.

Assuming I can get this working, I'm hoping edl files can be invited to the party! XBMC uses edl files for its built-in commercial skipping which is a pretty sweet option on the iPad for those of us that don't want the commercials removed completely...

Anyone have any ideas how to get the currently supported file extensions working on v0.18?
Nov 18, 2013 at 8:43 AM
The way the script has been written at the moment, nothing special needs to be configured for .xml and .vprj files to be moved at the same time as a recording. The script just tries to move them at the same time.

However, it is possible that I've got some bugs in that bit of the code :-).

Can you please copy/paste a verbose log from when you run the script so that I can try and spot what might be happening? If that doesn't help, I'll look at putting some more debugging into the script and post an updated version.

With regard to your question about edl files, it looks like I need to consider making the file handling a bit more flexible so I'll look at how I can incorporate that.


Nov 18, 2013 at 11:08 PM
Edited Nov 19, 2013 at 12:17 AM
Philip -

I believe I can point you to the problem areas:

On line 1765 of v0.18, it reads:

Write-VerboseAndLog "... skipping move of $directory\$leafname because it doesn't exist"

$directory and $leafname are undefined in that subroutine. Corrected it should read:

Write-VerboseAndLog "... skipping move of $fromDir\$fromName because it doesn't exist"

Once that line is fixed then the commercial skipping file moves are actually attempted. However, they still never happen because the variable "$file.Name", which is supposed to be the filename without the extension actually contains the complete filename. The parsing function you're using either doesn't work or depends on a library that isn't available. So I defined the following variable:

$FileNoExt = [io.path]::GetFileNameWithoutExtension($filename)

I then substituted $FileNoExt for every occurrence of $

However, I started thinking (along the lines of your response), that a universal routine for handling all files with the same base name and whatever extension would be nice. Perhaps with the desired matching file extensions defined in WTV-MetaRenamer.xml? And that's as far as I got...

I wasn't sure if you were still active with the project, so that's why I dove in and started debugging. Hopefully the above will save you a bit of hunting. With the changes, I've been able to successfully rename and move recordings with the key matching commercial skipping files. However, I've strictly been working in test mode and haven't let the script loose on my Recorded TV folder yet!


May 4, 2016 at 6:43 AM
Hi all
This conversation went quiet just when it was getting to the good part!

I too am having an issue where the script is looking for "xyz.wtv.xml" instead of "xyz.xml". The above user seemed to have suggested a fix for this. Having just had a look at the script, its well beyond me to implement the suggested fix myself.

Is this something that can be looked at? Or could the amended script discussed above be shared?

Great project - that continues to be used around the globe - many thanks!
May 4, 2016 at 3:14 PM
I modified WTV-MetaRenamer v0.18 to fix the problem with commercial skip data files not actually being renamed and moved when running the script. Looks like I'll need your e-mail address to send it to you directly. PM me and I'll get it to you.
May 5, 2016 at 12:37 AM
Thanks very much - greatly appreciate the reply.

I set myself up a test folder yesterday with a couple of WTVs, commercial data files and a backup version of the WTV renamed script. I tried a few different places to insert your suggested $FileNoExt = [io.path]::GetFileNameWithoutExtension($filename).

I found that I could get it to work (I think) if I inserted it here (around line 1848 in v0.23):
function ProcessFile($filename)
    Write-HostAndLog "Processing $filename"

    $process_file = $true

    $file = $folder.ParseName($filename)
    # V0.16: build an XML filename for possible ShowAnalyzer processing
    # V0.18: deprecated to make the code more flexible for other file extensions
    # $XMLFile = $($FileNoExt) + ".xml"
$FileNoExt = [io.path]::GetFileNameWithoutExtension($filename)

    $combined_title_and_episode = $false
I then did a find all replace $ to $FileNoExt.

So far I don't think I've broken anything. But I'm going to send you my e-mail address so I can compare to what you did. But thought I'd share these steps in the open forum for anyone else. But please bear in mind that I have no idea what I'm doing, this might have broken something I haven't realised yet. (I'm assuming that using find all/replace all doesn't come from the coders best practice handbook!)
May 5, 2016 at 4:12 AM
I assumed there was a PM system on Codeplex, but it doesn't look like there is. Nor does there appear to be a way to attach a file. So, my modified version of v0.18 is on Mega (temporarily) at:

v0.18 Modified

Hope that helps.
May 8, 2016 at 1:30 AM
That's great thanks very much. Seems I landed on about the right place to put it. You've also added edl moves - so I'll look to merge that into the 0.23 script.

Thanks again!