INTERACT FORUM

Please login or register.

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

Author Topic: MCUtilities - A Few Small Command Line Utilities for MC  (Read 9132 times)

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
MCUtilities - A Few Small Command Line Utilities for MC
« on: June 21, 2013, 11:09:04 pm »

This package contains various simple command line utilities I've written for MC that perform handy tasks.  I'll update this as I tweak them or add new ones.

Download and Instructions: MCUtilities Home Page

Current Release: 1.1.0.0

Currently Includes:
  • MCFileRemover.exe - Remove Files from MC Based on a Playlist.  Useful for automatically removing or deleting files from MC on a schedule.
  • MCPlayIfNotPlaying.exe - If MC is not currently playing something, play the provided playlist.  Useful for automating an always-playing playlist.
  • MC-Switch-Library.wsf - Script to switch Libraries on a remote MC Server.
  • MCcl.exe - Automatically forward arguments to the appropriate MC command launcher.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MCFileRemover - Remove Files From MC Based On a Playlist
« Reply #1 on: June 22, 2013, 03:27:48 pm »

1.0.1 (6/22/2013)

http://glynor.com/files/MCUtilities/MCUtilities-1010.exe

1. Fixed: Logger wasn't saving settings properly (which meant they were never created).
2. Fixed: Program exit code wasn't returning properly
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MCFileRemover - Remove Files From MC Based On a Playlist
« Reply #2 on: July 05, 2013, 08:48:20 am »

1.0.2 (7/5/2013)

http://glynor.com/files/MCUtilities/MCUtilities-1020.exe

1. Fixed: The installer works right.
2. Changed: Log file is now saved in the current user's AppData directory, which solves some install problems and no longer requires write access
   to the installation directory by default (it should also fix the working directory issue with the Windows Task Scheduler).
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

astromo

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2251
Re: MCFileRemover - Remove Files From MC Based On a Playlist
« Reply #3 on: July 05, 2013, 05:27:31 pm »

One other important note:
To get this to run properly from the Windows Task Scheduler, I had to manually add in a working directory (a Start In location in the Task Scheduler Action tab item) for some reason.  Otherwise it crashes as it doesn't get a valid directory to work with.  Not sure why.  I'll try to fix it later, but for now, if you just add a Start In folder pointing to the install location, it'll work fine.

EDIT:  This doesn't look fixable.  It is just the way the Windows Task Scheduler works.  By default, it sets the working directory for any applications you schedule through it to a Temp directory, which apparently my logger doesn't like (and wouldn't be good anyway because you wouldn't be able to find the log files).  You can set the Working Directory to wherever you'd like the log file to be saved, and it'll work fine and save the log file there.  That also means, if you set it to somewhere other than the application's directory, that you don't need write access to the application's folder (which is good since the Program Files (x86) directory is not writable by default).  Up to you where you put it.


I don't know whether this will help but for my simple uses I found Windows Task Scheduler to be problematic. I forget why but I think the job I was trying to achieve was to run a simple batch file to download an EPG xml file for MC.

So, when in trouble let your fingers do the work and I went out on to the interweb and found this piece of good gear:
http://www.splinterware.com/products/wincron.htm
I use the non-Pro version and it's been simple to set up and reliable for me.

I haven't researched it fully (and this might be a show stopper) but the software does appear to have some form of command line function, which is probably what you'd be looking for:
http://www.splinterware.com/forum/viewtopic.php?t=1617

If it's not a goer for your utility, it may be of use on the sideline anyway..  ;)
Logged
MC33, Win10 x64, HD-Plex H5 Gen2 Case, HD-Plex 400W Hi-Fi DC-ATX / AC-DC PSU, Gigabyte Z370 ULTRA Gaming 2.0 MoBo, Intel Core i7 8700 CPU, 4x8GB GSkill DDR4 RAM, Schiit Modi Multibit DAC, Freya Pre, Nelson Pass Aleph J DIY Clone, Ascension Timberwolf 8893BSRTL Speakers, BJC 5T00UP cables, DVB-T Tuner HDHR5-4DT

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MCUtilities - A Few Small Command Line Utilities for MC
« Reply #4 on: July 24, 2013, 01:41:46 am »

http://glynor.com/files/MCUtilities/MCUtilities-1030.exe

MCFileRemover 1.0.3 (7/24/2013)

1. NEW: Uses modular Global Options system.
2. Changed: References the MCnet.dll instead of including the code directly.
3. Fixed: User settings are now preserved when a new build is installed.

MCPlayIfNotPlaying 1.0.0 (7/24/2013)

1. Initial Release
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MCUtilities - A Few Small Command Line Utilities for MC
« Reply #5 on: July 24, 2013, 09:26:33 am »

Build pulled because it was broken -- use 1.0.5 below instead.

MCPlayIfNotPlaying 1.0.1 (7/24/2013)

1. Fixed: When using the LaunchMC flag, it now keeps MC running after the application exits.
2. NEW: Logging system defaults to Rotating Mode, and deletes log files older than 7 days.  To override, modify the app.config user settings file
   in <User>\<AppData>\glynor.com\<AppSettingsDir>.

MCFileRemover 1.0.4 (7/24/2013)

1. NEW: Logging system defaults to Rotating Mode, and deletes log files older than 7 days.  To override, modify the app.config user settings file
   in <User>\<AppData>\glynor.com\<AppSettingsDir>.

Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MCUtilities - A Few Small Command Line Utilities for MC
« Reply #6 on: July 24, 2013, 10:18:43 am »

http://glynor.com/files/MCUtilities/MCUtilities-1050.exe

MCPlayIfNotPlaying 1.0.2 (7/24/2013)

1. Fixed: When using the LaunchMC flag, it properly keeps MC running after the application exits (this time with FEELING).
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

dwvaughn

  • Recent member
  • *
  • Posts: 34
Re: MCUtilities - A Few Small Command Line Utilities for MC
« Reply #7 on: April 07, 2014, 02:41:25 pm »

Glynor,

I have a question about the MCFileRemover utility.  So deleting the video files works great.  The file is removed from MC and the file is then deleted off the disk.  The only issue I'm having is, the extraneous files are left behind (sidecar and xml files).  Is there a way to make it so the remover deletes those files also?

Thanks,

Dave
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MCUtilities - A Few Small Command Line Utilities for MC
« Reply #8 on: April 07, 2014, 11:16:20 pm »

Is there a way to make it so the remover deletes those files also?

Good idea. Shouldn't be too difficult to add.

Give me a few days and bump this thread if I forget.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MCUtilities - A Few Small Command Line Utilities for MC
« Reply #9 on: April 12, 2014, 08:47:03 pm »

http://glynor.com/files/MCUtilities/MCUtilities-1060.exe

MCFileRemover 1.0.5 (4/12/2014)

1. NEW: --DeleteSidecars command line option also deletes Sidecar files (.xml, .jpg, and .properties) when used with the --DeleteFiles
   command line option (it is otherwise ignored).

WARNING: After I reconsidered this a bit, I guess I have to make the test for sidecars more complicated, as this could be pretty disastrous if you give it a bad source filename.

So, the way this works now is:

1. It takes the original source filename (without the extension) and searches for [Filename]* in the current directory (it is not recursive).
2. Then it filters that list and finds only files that have the extensions .jpg, .properties (SageTV makes these and I have a bunch orphaned), and .xml.

That works brilliantly as long as your source filename is something like:
DoratheExplorer-S04E21-BabyJaguarsRoar-20907827-0.mp4

Or whatever.

But, if you (probably accidentally) gave it a source filename like
d.mp4

Then ALL jpgs (and xml and properties files) in the source directory that start with "d" would match, because it searches against "d*".

That's no good.  I'll have to add much more complex logic, looking for what the matching sidecar filenames should be.  The problem is that I have a bunch of different patterns, so I have to do them each individually.  I need it to find these files (using my example name above):
DoratheExplorer-S04E21-BabyJaguarsRoar-20907827-0_mp4_JRSidecar.xml
DoratheExplorer-S04E21-BabyJaguarsRoar-20907827-0_ts_JRSidecar.xml
DoratheExplorer-S04E21-BabyJaguarsRoar-20907827-0.jpg
DoratheExplorer-S04E21-BabyJaguarsRoar-20907827-0.ts.properties
DoratheExplorer-S04E21-BabyJaguarsRoar-20907827-0.mp4.properties


The .properties files use the original filename extension and then add the .properties extension to that.  The JRSidecars use underscores around the source extension.  And the jpgs use just the original source filename.  And, worse, I do want it to find the TS versions, because since I auto-convert to MP4, those "orphaned" TS versions of the sidecars get orphaned behind (and my record directory is FULL of them, hence me wanting this feature too).

So, this version is totally usable. BUT, be aware of how it works.  It could be dangerous if your source filename is non-unique or very short.

I'll think about it and there will be a new version that is safer.

EDIT: I pulled this version.  Please use 1.0.6 instead (linked in next post).
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MCUtilities - A Few Small Command Line Utilities for MC
« Reply #10 on: April 13, 2014, 11:04:25 am »

http://glynor.com/files/MCUtilities/MCUtilities-1061.exe

MCFileRemover 1.0.6 (4/13/2014)

1. Fixed: --DeleteSidecars option could delete unsafe files.

The logic for this option is explained in the MCFileRemover Instructions.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MCUtilities - A Few Small Command Line Utilities for MC
« Reply #11 on: April 29, 2014, 12:19:33 am »

http://glynor.com/files/MCUtilities/MCUtilities-1070.exe

MCFileRemover and MCPlayIfNotPlaying 1.0.7 (4/29/2014)

1. NEW: Logging system overhauled. Now provides Log Levels and improved exception reporting.
2. Fixed: Some user options weren't preserved when upgrading.
3. NEW: Colored Console. Errors are reported in red and yellow (depending on severity), and warnings are magenta.

Please Note: I've also changed the way I'm going to version the individual utilities.  Now, whenever a particular utility is changed, it will increase to the same version number as the package.  So, you will always be able to tell which was the last release that a particular utility has changed by its current version number.  This also allows me to unify the Change Log I post here when core components change that impact all or most of the utilities (as I've done above).
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MCUtilities - A Few Small Command Line Utilities for MC
« Reply #12 on: May 26, 2014, 04:47:04 pm »

http://glynor.com/files/MCUtilities/MCUtilities-1080.exe

MC-Switch_Library.wsf 1.0.0 (05/26/2014)

1. NEW: Initial Release

MCFileRemover and MCPlayIfNotPlaying 1.0.8 (05/26/2014)

1. Changed: Updates to shared components.

glynor.common 1.0.0 (05/26/2014)

1. NEW: Logging system overhauled. Now provides Log Levels and improved exception reporting.
2. Fixed: Some user options weren't preserved when upgrading.
3. NEW: Stock Options system overhauled. Report any trouble with basic options like Logging and AutoRun.
4. Changed: Shared code reorganized (reduces the number of auxiliary dlls installed).

MCnet 1.0.0 (05/26/2014)

1. Fixed: Logging improved across many components.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MCUtilities - A Few Small Command Line Utilities for MC
« Reply #13 on: August 24, 2014, 12:43:57 pm »

http://glynor.com/files/MCUtilities/MCUtilities-1100.exe

MCcl 1.0.0 (08/24/2014)

1. Initial Release
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MCUtilities - A Few Small Command Line Utilities for MC
« Reply #14 on: August 24, 2014, 01:21:43 pm »

This build includes a new command line utility, MCcl (MC command launcher).

This simple applet is just a wrapper for the Command Line launcher utilities included with each version of Media Center.  These launcher utilities are named mc19.exe for MC19, and mc20.exe for MC20 (and so on and so forth).  This makes it necessary to manually update any scripts you write with the new version each time you upgrade MC to a new major version.

MCcl.exe makes that laborious task no longer necessary!

It was inspired by this thread (and by the fact that MC20 just came out and I have to, again, update all of my scripts to use the new launcher).  Let me know if it comes in handy!
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/
Pages: [1]   Go Up