Skip to content

Commit

Permalink
p2g_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
paveljurca committed Sep 7, 2017
1 parent d5d378a commit f729977
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Disable Live Content for P2G packages

**Issue:**

IIS 7.0 on Windows Server 2012 does not support WMV streaming (Microsoft Media Server); cannot setup following Mediasite content server.

**Why is it an issue?**

You can't proceed at importing such presentations (usually those from previous Mediasite Server versions).

**So?**

Update Mediasite Presentation XML file with `IsLive` set to **false** and `LiveStatus` **0**.

## SYNOPSIS

`p2g_fix.exe --live *P2G *P2G *P2G [...]`

## NOTES

* Does not support zipped packages (unzip them first).
* [Perl2Exe](http://www.indigostar.com/perl2exe.php)
* _IDE_ Notepad

## DISCLAIMER

Don't blame me.
50 changes: 50 additions & 0 deletions p2g_fix.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
use strict;
use warnings 'all';

use File::Glob 'bsd_glob';

# ===== MAIN =====
# --- OPTIONS ---
err(qq(bad option, use '--live'))
unless shift eq '--live';
# --- RUN ---
p2g_fix(@ARGV);
# ================

sub p2g_fix {

# PERLDOC
# Win32 users should use the real slash.
# If you really want to use backslashes,
# consider using Sarathy's File::DosGlob

while (defined(my $p2g = shift)) {
err(qq("$p2g" not a directory)) unless -d $p2g;

my ($xml) = grep(
/MediasitePresentation_\d{2}\.xml$/i,
bsd_glob(qq($p2g/*), File::Glob::GLOB_ERR | File::Glob::GLOB_NOSORT)
);
err(qq(Error reading "$p2g")) if File::Glob::GLOB_ERROR;

local @ARGV = $xml || err(qq("$p2g" please specify P2G directory));

# live_content_fix
my $fix = 0;
msg($p2g, 'found backup file, not proceeding'),next
if -e $xml.'.bak';

# in-place edit with a backup file
local $^I = '.bak';
while (<>) {
s/$1/false/,$fix++ if /<IsLive>(true)</i;
s/$1/0/,$fix++ if /<LiveStatus>(1)</i;
print;
}

msg($p2g, $fix == 2 ? "Live Content fixed" : "OK");
}
}

sub msg {print shift, ' >> ', shift, "\n"}
sub err {die '(ERR) ' . shift . "\n"}

0 comments on commit f729977

Please sign in to comment.