Sunday, August 17, 2014

Media Playback Setups

I mentioned that I got my Ubuntu computer going again, but it still isn't connected to the network.  I need to procure an 8-port switch, some bulk network cable, a crimping kit, and a cable tester in order to get it connected.

Also, that setup will be localized to my bedroom, on my LCD monitor.  My parents have a rather nice 50 inch plasma monitor that they watch TV on, through a computer with an external CableCard tuner and Windows Media Center.  What about playing my shit on that screen?

Well, I've already got a setup.  While I have no intention of actually hiding it from my parents, particularly my dad, it is a fairly stealthy setup that he shouldn't discover.  Even if he does discover it, I've left notes for him that explain exactly what it is, why I chose the setup I chose, and basically trying to reason with the angry beast he'll become once he discovers that I've put any kind of software on that computer at all.

What is the setup, and why did I do it that way, you ask?  Well, I'll tell you.

I'm using the Windows version of mplayer, and PowerShell.  Big surprise there with PowerShell, I know, since it's been my toy language of choice for over a year now.  But mplayer, on Windows, when I very vocally advocate installing the Combined Community Codec Pack and using Media Player Classic HomeCinema?  Srsly?

This brings me to why I chose this setup.  As you may or may not know, mplayer does its own shit.  On Windows it basically uses whatever codecs you have installed, but in any *nix-based OS, it brings its own library of codecs with it.  The fact that it doesn't install any codecs, and in fact makes zero system modifications at all, is precisely what I wanted.

If I knew for goddamn sure that installing CCCP wouldn't break Windows Media Center, I might have gone that route instead, if not for my dad having the chance of discovering that I've installed something (oh teh noes) and getting his panties in a bunch about it.  I specifically wanted to avoid any possibility of breaking Windows Media Center, so my setup was carefully crafted to not fuck with anything.

Like I said earlier, I'm only using PowerShell because it's my toy language of choice in recent times.  What can I say, it makes doing various things ridiculously easy.  I have a profile set up to create a few functions and some important global variables in the PowerShell environment:
  • clean - A function that takes a filename that's been tab-completed by PowerShell and removes the PowerShell-style escape characters that mplayer can't handle.  Its intended usage is mplayer (clean <tab-completed file name>)
  • build-pl - A function that builds a temporary playlist from all files in the current directory, that I can then play with mplayer's -playlist option.
  • netdrive - A function that adds a network drive, starting at Z: and working backwards through the alphabet to E:.  This is far more drive letters than it will ever need, because I only have six network shares where there's even the possibility of video files existing.  Also has a -remove switch which, after asking for confirmation, gets rid of all the network drives it's created.
  • $pl - read-only variable, set to contain the full path of a file within my little spot inside Program Files that I've reserved for myself.  This file is what build-pl overwrites.
  • $mplayerconf - read-only variable, set to contain the full path of the global mplayer config file, so I can edit it easily.
  • $netdrives - an array that holds the drive letters that netdrive has already used.
The first thing I did as soon as I started PowerShell when setting this up was set the local machine execution policy for script execution in PowerShell to RemoteSigned, just because Restricted is the stupidest default ever.  This way I can dot-source the profile after making changes, and run any other scripts I drop onto the machine, all without having to put set-executionpolicy remotesigned in the profile.

To eliminate annoyance, I disabled the Windows 7 balloon tip that comes up when mplayer starts, because it has to turn off Aero.  Srsly I don't care about your stupid balloon tip Microsoft, die in a fire.

The last little bit of the puzzle is file permissions.  By default, in Windows 7, you have to elevate to Administrator in order to create, modify, or remove files inside Program Files.  Except here, I wanted to be able to do it without having to elevate, so I granted full control to the Users group for my entire directory structure and all the files therein.  Windows 7 is painfully not a *nix-based OS, there is no analog of sudo, so this is the best way to handle it.

The setup still isn't perfect, particularly the netdrive function, but it's in a state where it functions well enough for day-to-day use.

No comments:

Post a Comment

I moderate comments because when Blogger originally implemented a spam filter it wouldn't work without comment moderation enabled. So if your comment doesn't show up right away, that would be why.