INTERACT FORUM

Please login or register.

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

Author Topic: MC11 problem with Customise View  (Read 6398 times)

risingdamp

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 419
MC11 problem with Customise View
« on: March 12, 2005, 03:39:31 am »

I'm using build 205.  For some unknown reason my view customisations i.e. the columns I wish to display in various view schemes have been changed and when I use customise to view and then load to apply the saved scheme MC freezes up for a minute or so and then the view is unchanged.  I reinstalled MC and the problem is still there.
Logged
JLee

risingdamp

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 419
Re: MC11 problem with Customise View
« Reply #1 on: March 12, 2005, 03:51:41 am »

Problem solved.  The library was being shared by 2 machines simultaeneously.  The second machine was not happy at all but when I closed it, then closed the first machine (thereby overwriting the library from the first machine) all was OK again.
Logged
JLee

risingdamp

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 419
Re: MC11 problem with Customise View
« Reply #2 on: March 14, 2005, 04:36:23 am »

Yes it is scary.  My library is very important to me but I have risked using the same one from 2 PC's because:
- So far I've had no issues and I try and back it up regularly
- I would never knowingly share it at the same time (this time was a mistake)

I share the library because I use my dev pc for tagging and my HTPC for playback so having the libraries separate would be a pain and difficult to keep in sync.  I can't get the HTPC to access the library via library server because of course that's where I add all my ratings.  So in summary I can't think of an easy alternative.

I wonder if there's some way to alert me if the library is already in use by another instance of MC and stop me sharing it?  Maybe a girder command that will establish if the library (media files.jmd) is in use and if it is pop up a message but if it isn't fire up media centre.exe.  Anyone know if this is possible?
Logged
JLee

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MC11 problem with Customise View
« Reply #3 on: March 17, 2005, 01:04:00 pm »

I've run my library in this configuration for at least a year and never had a corruption issue, but I recently changed to a different solution due to problems with MC accessing the database on a remote Windows fileshare. (Have you noticed the UI freeze in MC when it is "Saving Database" on the machine where the library doesn't live?)

The way I do it now is much better, and much safer too, because I get automatic backups of the library once per day!

Basically, I wrote a few scripts that copy the database to and from a centralized location on an automatic basis, and then scheduled the scripts to run regularly on the systems.  This doesn't keep them in PERFECT sync (because if I tag some files or import them on one of the machines it doesn't show up on the other until the next run of the "import" script).  However, it is safe and allows you to do what you want.

Basically the way I have it set up is:

2 machines.

1 is my Primary Computer.  This is where I typically do all my importing and tagging of files.

2 is my HTPC.  Because it is inconvenient, I typically don't do any major tagging on this machine.  When I do tag some files, I run a separate script when I am done to "publish" these changes back to the master copy.

I have three library locations, though 1 of them is never directly used by the running MC copies.  Each machine has it's own "local" library located at c:\library_data\ and there is a separate library at m:\library_data\ (drive M is my media "drive" which is actually a SAMBA share running on my Linux server, but could just as easily be a Windows file share mapped as a network drive).  The M drive library is never directly accessed by either copy of MC, but is kind of the "shared" library.

Then I have a few scripts that copy stuff around:

1.  Copy the library from the Primary machine's C:\library_data\ location over to the M:\library_data\ location on a regular basis.  It also makes a zip archive of the old library once per day (it skips the thumbnail folder which is huge) which is nice in case something stupid happens.

2.  Import the library from the M drive to the C:\library_data\ on the HTPC computer.  This runs daily, which is enough for me, though you could easily modify the script to do the import (which since it doesn't touch the thumbnail folder doesn't take long) and then launch MC and just point your MC shortcuts to it instead of the actual MC program on the HTPC.

3.  Archive old MC library backups.  I have a script that runs once a month and clears up all my old ZIP backups.  It also creates a backup in a different location and keeps those for the long term (so if I ever have a big screwup I can at least go back to the last month's library).

4.  "Publish HTPC Library Script"  This one is still a work in progress, but the idea is that it will be an icon in the start menu (or wherever) that I can hit and have it Close MC on the HTPC, then copy the HTPC's current local library over to the M shared library and to the Primary PC's library.  This is so that you can manually "save" any changes you might make on the HTPC side (if you do decide to do a little tagging on that machine for some reason).  The reason it is still a work in progress is that I'm deciding what to do about copying it back to the Primary machine ...  I think I have two choices.  1) Automate SSH-ing into the Primary Machine and running the mjextman.exe /CLOSE command to close any running copy of MC before the script copies the HTPC's library directly to the Primary machine's store.  -or- 2) Have the "Publish" script create a "flag" file that the Copy script (number 1 above) checks for when doing it's copy and if it exists it does the copy in the opposite direction.

The benefit to method 1 is that it takes effect immediately.  The downside is that it would be a pain to script and I would have to install and maintain an SSH server on the Primary machine (plus it would suddenly close MC if someone were using it on the other computer).  The benefit to method 2 is that it is MUCH easier to implement, and seems a little safer (because it never actually touches the Primary machine's database).

I'm still deciding...  Either way, if you'd like a copy of my scripts, just let me know.  They're tiny so I'd be happy to email them to you (though I'd need a few days to finish the last one).  All in all, this is a much better, and safer, solution!
Logged
"Some cultures are defined by their relationship to cheese."

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

johnp

  • World Citizen
  • ***
  • Posts: 145
  • let your 'Yes' be 'Yes,' and your 'No,' 'No'
Re: MC11 problem with Customise View
« Reply #4 on: November 19, 2005, 01:12:07 am »

I would definitely like to take a peek at your scripts. And share with you anything I can come up with.

However, I think I would use a slightly different methodology if I could figure out how to make it work.

I like using the library backup / restore mecahnaism becasue it allows you to make changes on the fly without closing down any instances of Media Center that may be running at the HTPC, Rip stations or various clients.

A couple of things are holding me up.  I cannot figure out how to script the process.  I can use Girder to get the Library backup or restore windows to open with send message # 33768, wParam 20011 (for backup), but I can't figure out how to automatically enter a file name into the resultant window. or how to trigger this event on a change in the library.

The second part is not as big a deal because I can just have it demand driven, but the first part nees to be automated.  If I walk up to my desktop PC and want to manage my library, I want to be able to run a script that runs:
1. Pull a fresh copy of the media server database to a shared folder with Library backup.
2. Open Media Center if not already running
3. Restore the library from step 1 to the local PC.

After I am done fiddling, I want to run a script such as:
1.  Backup running library to a shared folder.
2.  Close JRiver
3.  Restore  Library from step 1 to MEdia Server.

This of course does not account for multiple users doing this simultaneously, but I think checking for lock files or something like that could do the trick.

What do you think?

Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MC11 problem with Customise View
« Reply #5 on: November 21, 2005, 09:45:27 am »

I'll post my Scripts tonight when I get home from work (or tomorrow worst case).  I initially thought about trying to do it the way you were hoping to, but I decided that a) this is easier and b) it works fine for my purposes.  Just to update the message I posted a while back...

I did decide to go the "file flag" route for the Publish script.  It actually works quite well.  The main "Export to Shared" and "Import from Shared" scripts are simply set to check for the existance of a file (I forget what I called it).  If they find the "Published" file exists, they delete it and then run the appropriate script (halting their own execution).  This made the scripting simple.  The "Publish" script simply creates the file and then copy's it's library over to the "Shared Folder" (which is essentially the same "code" as the "Export to Shared" script).  The logic goes:

Code: [Select]
Publish to Shared script
----------------------------

Create PUBLISHED_FILE
Archive and Copy TO SHARED_FOLDER

"Export to Shared" Script
------------------------------

If PUBLISHED_FILE exists, then
     Delete PUBLISHED_FILE
     Run Import from Shared
     END
ELSE
     Archive and Copy TO SHARED_FOLDER

"Import from Shared" Script
----------------------------------

Archive and Copy FROM SHARED_FOLDER
IF If PUBLISHED_FILE exists, then Delete PUBLISHED_FILE (useful for if I would manually run the Import script on the HTPC instead of running the "Export" script after an update).

I now have it set up to run these scripts periodically throughout the day (once every 5 hours or so).  I did discover that it doesn't hurt anything if you run the "Import from Shared" script while MC is running.  The changes just don't take effect until you re-open MC and the most recent import "gets lost" if you happen to make any Library changes on the running copy of MC between the Import and the next restart.  Sometimes this is actually desirable though (see below).  I also modified the scripts to automatically create a backup of the "local library" before each runthrough.  I did this because one time I was actively working on tagging on my Desktop Machine and the script ran while I was working.  I didn't think much of it because of the functionality mentioned above, but I happened to accidentally close MC just after the script ran (darn Power button on the Remote control) and all my changes got lost.  I learned my lesson, and now before the "Import from Shared" script runs, it backs up the local library first.

If you modified these to use Girder's capabilities, I'm sure you could detect if MC is currently running, run the Import, and then do:
Code: [Select]
IF ( MC_WAS_RUNNING = true ) then RESTART_MC.
I never did this because I think it could be dangerous if the scripts run automatically, as mine do (unless you could add in some logic that checks to see if the computer has been idle for a long time and is not currently playing a file).  EG, what if you are currently tagging or playing a file when the script runs?

Something that could be useful would be to add that functionality to a script that doesn't run automatically but essentially "replaces" the MC icon on the desktop.  I never bothered to do this because my "every 5 hours" method of updating keeps them enough in sync that I rarely have to run the scripts manually except when I'm actively tagging on the Desktop Box.  Typically right after I finish updating tags on the Desktop machine, I run "Publish to Shared" on it and then VNC into my HTPC and run "Export to Shared" (which since the "Publish" flag exists actually runs the "Import from Shared" script).  Even then, I only really need to do the second step if I want to immediately see the effects on the HTPC.  If I don't mind waiting, it'll show up eventually.  The other problem with replacing the MC icon with a Import from Shared script is that if you happen to be updating tags and you crash MC, you'd HAVE TO run the Publish script before you re-open MC (or you'd have to use a non-scripted MC Icon) or else you'd lose your changes.  Of course, the backup function makes short work of recovering those changes, but still, it's an extra step for very limited gain.

The only problem with this system is that you can't have multiple users updating the tags simultaneously.  This never happens at my house.  (Sometimes my wife updates stuff, but it's rare because she's lazy about it and just leaves it up to me).  It also could turn into a nightmare if you had more than 2-3 machines (though the concept of designating 1 "master" machine does help somewhat).
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: MC11 problem with Customise View
« Reply #6 on: November 21, 2005, 10:04:39 am »

I forgot to mention.  I suppose you could use Girder and use MC's built in "Backup and Restore" capability to accomplish this, but I don't really see the point.

1) You can accomplish the same result by simply Closing/Opening MC after the "Import from Shared" script runs.  None of the other scripts require MC to be closed because the library files can be copied from/over just fine while it is running.

2) Girder could conceivably get screwy if you happen to be actually using the computer when the script runs.  In order to send the file name to the "Backup and Restore" window, I imagine you'd have to make Girder bring MC to the foreground and then "type" into the window.  Now, say you're playing FarCry when this happens.  Since full-screen 3D apps will try to keep the foreground, it will most certainly get you killed in your game, plus who knows what your script will end up doing!

3) My way you can manage your own backups in your own location (and use a good, reliable Zipping program to do it).

As far as checking for file locks, I don't know how you'd do it.  As I mentioned, MC seems to load the database files into memory while it is running and not access them except at startup and to "flush" changes (performance related I'm sure).  Unless your script happens to run EXACTLY as MC is flushing or starting, I don't think you'll get a locking error.  Now, maybe MC does lock some files as it's running, so you could check for that if you can find them, but I doubt you'll be able to distinguish between just running and sitting idle (or playing back a file) and running and actively tagging.

I should also mention that one other thing I changed from what I described above is that I now have my HTPC's library set as the "master" library (the machine that regularly runs "Export to Shared" instead of "Import from Shared").  This is because while I typically do my tagging on the Desktop machine, I often do my Importing on the HTPC.  Also, since I usually PLAY my media from the HTPC, I want to make sure that Library is always the most up-to-date.  Plus, it's easy to use the "Publish" script and VNC as I described above to force updates after I finish tagging on the Desktop box.

One other note, just for safety and simplicity's sake, when I'm doing a LOT of tagging on the Desktop box I usually disable the "Scheduled" runs of the "Import from Shared" script.  It doesn't hurt anything to not disable it, as long as MC or the machine doesn't crash.  However, for that 0.1% of the time when it does, it's easier than using my backup to not worry about it.
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: MC11 problem with Customise View
« Reply #7 on: March 16, 2006, 11:11:34 pm »

I uploaded a Zipped copy of my scripts here. (I never remembered to do this before.)  You will have to modify them to use them of course, but it should be pretty self explanitory.  It also uses ZipGenius (a great free WinZip alternative) to create the archives.
Logged
"Some cultures are defined by their relationship to cheese."

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

johnp

  • World Citizen
  • ***
  • Posts: 145
  • let your 'Yes' be 'Yes,' and your 'No,' 'No'
Re: MC11 problem with Customise View
« Reply #8 on: March 17, 2006, 05:31:09 am »

Thanks,

I'll check it out.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: MC11 problem with Customise View
« Reply #9 on: June 28, 2006, 09:42:00 pm »

I thought I'd mention in this thread that I have since changed the "exclude.txt" file (which the scripts look at to exclude files from the copy routines) to the following (just these two lines in a blank text file)...

Code: [Select]
\Thumbnails\
\Cache\

That makes it exclude the huge cache folder, which isn't needed, and makes the scripts run WAY faster.
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: MC11 problem with Customise View
« Reply #10 on: September 26, 2006, 02:52:57 pm »

I've updated these scripts and they now can be found on this thread over in the 3rd Party Plugins forum:

http://yabb.jriver.com/interact/index.php?topic=35978.0
Logged
"Some cultures are defined by their relationship to cheese."

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