INTERACT FORUM

Please login or register.

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

Author Topic: Automatically delete viewed videos?  (Read 2394 times)

c1c9k72

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 332
  • So many worlds, so much to do, so little done...
Automatically delete viewed videos?
« on: June 20, 2013, 04:02:13 pm »

I'm toying with the idea of using the scheduler to automate the deletion process of certain TV shows that I want to watch and then get rid of.  It seems fairly straightforward to set up a smartlist that will show only certain series, and only the episodes that have already been viewed.  And I'd like to use the command line functionality to have it delete those files on a weekly basis.

Is it possible to use either MCC_DELETE or MCC_DELETE_ALL from the core commands to delete the files within a smartlist, or are they just going to delete the smartlist itself?

Any pointers would be greatly appreciated.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Automatically delete viewed videos?
« Reply #1 on: June 20, 2013, 04:28:16 pm »

I have a little console application that does exactly this.  Takes a Playlist "path" from Media Center, and then deletes any files it finds in the list.

However, because I use it to clean up files in MC's database that are otherwise auto-deleted elsewhere from disk (I can't use the Fix Broken Links feature of MC for reasons that are too long and boring to go into here), it won't actually do quite what you want right now.  The "quick and dirty" version I'm using now refuses to delete anything that actually exists on disk, and only removes links from MC's database if they're already missing from disk (kind-of the reverse of what you're looking for).

Still, it would be a reasonably simple task to modify my app to work for you.  I've been long term "planning" to eventually expand it to handle similar needs, so that I could have Smartlists that include TV Shows that I don't want to keep long-term.

If you're interested, yell, and maybe it'll spur me on to fix it up this weekend or sometime soon.
Logged
"Some cultures are defined by their relationship to cheese."

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

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Automatically delete viewed videos?
« Reply #2 on: June 20, 2013, 04:29:39 pm »

I believe these will operate on the selection, and probably aren't what you want.  The MCC interface seems to have been designed to work from within the UI (its used for most menu commands and keyboard accelerators).  But many MCC commands are UI agnostic so work just fine, this probably isn't one of those cases.

I'm wondering if you can use a script to query MC through the web interface, using the same search criteria you were going to use internally.
Logged
The opinions I express represent my own folly.

c1c9k72

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 332
  • So many worlds, so much to do, so little done...
Re: Automatically delete viewed videos?
« Reply #3 on: June 20, 2013, 05:23:24 pm »

I'm wondering if you can use a script to query MC through the web interface, using the same search criteria you were going to use internally.

How would I go about doing that?

My revised plan is to have the scheduler automatically export a smartlist with the names of the files I want to delete, and let a small external program deal with the deletion process.  I think I need "MC18.exe" for the Program and "/MCC 20003,250423350" for the Arguments.  But I can't see where the file is being exported to, or if it's even working at all.
Logged

c1c9k72

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 332
  • So many worlds, so much to do, so little done...
Re: Automatically delete viewed videos?
« Reply #4 on: June 20, 2013, 05:39:14 pm »

However, because I use it to clean up files in MC's database that are otherwise auto-deleted elsewhere from disk (I can't use the Fix Broken Links feature of MC for reasons that are too long and boring to go into here), it won't actually do quite what you want right now.  The "quick and dirty" version I'm using now refuses to delete anything that actually exists on disk, and only removes links from MC's database if they're already missing from disk (kind-of the reverse of what you're looking for).

I was somewhat hesitant to give MC18 the power to silently start deleting things, so it sounds like you've got your app set up right.  I'm going to try to outsource the deletion process now, away from MC18, to something I can completely control.  And test with baby steps.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Automatically delete viewed videos?
« Reply #5 on: June 20, 2013, 06:19:14 pm »

How would I go about doing that?

Enable Media Network and browse, for example, here:

    http://localhost:52199/MCWS/v1/
    http://localhost:52199/MCWS/v1/Playlists/List

You can query for the playlists, get the ID, and output the list of files.  This way, you don't have to export to a file.
Logged
The opinions I express represent my own folly.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Automatically delete viewed videos?
« Reply #6 on: June 21, 2013, 12:33:13 am »

I was somewhat hesitant to give MC18 the power to silently start deleting things, so it sounds like you've got your app set up right.  I'm going to try to outsource the deletion process now, away from MC18, to something I can completely control.  And test with baby steps.

Patience, grasshopper.

I got this.  There'll be something for this thread tomorrow.  A taste...

Code: [Select]
6/21/2013 1:30:58 AM - ----------------------------------------
6/21/2013 1:30:58 AM - MCFileRemover (by glynor) v0.0.0
6/21/2013 1:30:58 AM - ----------------------------------------
6/21/2013 1:30:58 AM - Selected Options:
6/21/2013 1:30:58 AM -   Playlist Path: Utility\MCFileRemover Tester
6/21/2013 1:30:58 AM -   Remove Files that Exist: True
6/21/2013 1:30:58 AM -   Delete Files from Disk: True
6/21/2013 1:30:58 AM -   Processing Limits: 20
6/21/2013 1:30:58 AM - Connecting to running MC instance...
6/21/2013 1:30:58 AM - Success.
6/21/2013 1:30:58 AM - Removing Files in Playlist: MCFileRemover Tester
6/21/2013 1:30:58 AM - Number of Files to Process: 17

6/21/2013 1:30:59 AM - Removing file: M:\Temp\script test\File Remover Test\Video\Homeland\02\s02e01 - The Smile.mkv
6/21/2013 1:30:59 AM -   File exists on disk.  Remove Existing flag is: True
6/21/2013 1:31:01 AM -   File removed.
6/21/2013 1:31:01 AM -   Deleting file from disk (flag is: True)
6/21/2013 1:31:01 AM -   File Deleted.
6/21/2013 1:31:01 AM - Removing file: M:\Temp\script test\File Remover Test\Video\Homeland\02\s02e02 - Beirut is Back.mkv
6/21/2013 1:31:01 AM -   File exists on disk.  Remove Existing flag is: True
6/21/2013 1:31:03 AM -   File removed.
6/21/2013 1:31:03 AM -   Deleting file from disk (flag is: True)
6/21/2013 1:31:03 AM -   File Deleted.
6/21/2013 1:31:03 AM - Removing file: M:\Temp\script test\File Remover Test\Video\Homeland\02\s02e03 - State of Independence.mkv
6/21/2013 1:31:03 AM -   File exists on disk.  Remove Existing flag is: True
6/21/2013 1:31:04 AM -   File removed.
6/21/2013 1:31:04 AM -   Deleting file from disk (flag is: True)
6/21/2013 1:31:04 AM -   File Deleted.
6/21/2013 1:31:04 AM - Removing file: M:\Temp\script test\File Remover Test\Video\Homeland\02\s02e04 - New Car Smell.mkv
6/21/2013 1:31:04 AM -   File exists on disk.  Remove Existing flag is: True
6/21/2013 1:31:05 AM -   File removed.
6/21/2013 1:31:05 AM -   Deleting file from disk (flag is: True)
6/21/2013 1:31:05 AM -   File Deleted.
...
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: Automatically delete viewed videos?
« Reply #7 on: June 21, 2013, 11:58:02 pm »

Here you go:
http://yabb.jriver.com/interact/index.php?topic=81514.0

Should handle anything you need.
Logged
"Some cultures are defined by their relationship to cheese."

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

c1c9k72

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 332
  • So many worlds, so much to do, so little done...
Re: Automatically delete viewed videos?
« Reply #8 on: July 02, 2013, 07:02:35 am »

Sorry for the massive delay.  But this looks like it's exactly what I needed.  Downloading now.

Thanks, Glynor!
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Automatically delete viewed videos?
« Reply #9 on: July 04, 2013, 07:52:51 am »

Glad I could help.

Like I said, I already had it a third of the way there (and I'd already planned to fix it up like that).  You basically just inspired me, and it only took me one evening.

If the 20-file limit doesn't work for you, let me know.

I'm going to release a new version sometime soon that tweaks/fixes the logging system to save to the AppData directory instead (which fixes the need to write to the install location, and the scheduler working directory thing).  I could change the --overridelimits flag to take a number specifying a limit manually...
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: Automatically delete viewed videos?
« Reply #10 on: July 05, 2013, 09:40:46 am »

I posted a new build.

The installer from before was probably broken.  The ZIP version worked fine, but the installer version was hosed.  I also added the logging change.
Logged
"Some cultures are defined by their relationship to cheese."

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

c1c9k72

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 332
  • So many worlds, so much to do, so little done...
Re: Automatically delete viewed videos?
« Reply #11 on: July 09, 2013, 11:29:53 am »


If the 20-file limit doesn't work for you, let me know.


I actually don't mind the limit.  It keeps things from potentially getting too far out of hand.  I never have 20 files that need deleting at a time, so it doesn't cause any trouble for me.
Logged
Pages: [1]   Go Up