Remote Delete Plugin

Discuss third-party additions, plugins and translations for PS3 Media Server

Remote Delete Plugin

Postby PioneerDU » Fri Mar 25, 2011 4:26 am

Hi,

I have been using PSM for years now and been frequently reading the forum since then. I have also followed the threads regarding the possibility to delete media from the server right away from the PS3. However the danger of accidently deleting files is high and thus I understand the objection against such a feature.

I am starting a new thread because this will be the thread of my plugin "RemoteDelete" currently in development that will (in antithesis to its name) never delete any file but still give you the possibility to ged rid of unwanted media. :lol:

You may expect a beta within a week. I am posting ahead already because I have some questions to the PMS crew and/or other developers regarding a few optimizations of my plugin. If you cannot help me with that you can skip the next paragraphs. At the end of the post I include my current readme-draft that outlines the features to be expected in the first beta release.

Development Questions:

All questions are regarding the current head from SVN.

Any better Method of refreshing (virtual) folders?
First I was using the DLNAResource.refreshChildren() method but that would take forever to take place. Sometimes it does not occur within 10 minutes. My current method of rebuilding folders is .getChildren().clear() which takes place within a minute, sometimes even immediately but will always be faster if you completely leave the media and reentering the folder from root. So is there any better / faster method of rereshing the media structure during runtime.

Is there a way to tell PMS to close all File Handles to specific media files or directories
RemoteDelete gets unwanted files out of the scope of PMS by moving them to a folder outside the media folders. My currently favored option is to queue and retry the operation in specific intervals since PMS seems to unlock the files after a while. I have also been thinking about restarting PMS for emptying the trash as well as utilizing tools like Unlocker.
The first isn't immediate, the second makes the PS3 disconnect from the server for a while and the third isn't platform independent. I'd like to find a better way.

Serially marking files for deletion with "gestures"
In addition to the ##-MARK FOR DELETION-## folder on each media folder I would like to implement a second method of moving files to my virtual trashcan which shoud work as follows.
Each media folder has a virtual folder that recursively collects all media from the subfolder structure.
Each file in this virtual folder begins playing in the middle of the video and is shortened to 10 seconds of playback.
If the user skips to the next video within the 10 seconds, the video shall be marked for deletion. Otherwise it will be kept if the full 10 seconds are played and the PS3 moves on to the next file.

Do you think it is possible to do this between buffers, network and unprecise timing?


So here's the Readme:

Though this plugin is called RemoteDelete it will actually NEVER DELETE any files or folders from your media server. The reasons why this would be to dangerous have been discussed on the official forum.

Instead it allows you to use your Media Renderer (i.e. PS3) to mark files and folders for "deletion". In the RemoteDelete virtual folder in your library you will be able to empty the trash which will still NOT DELETE but move the "deleted" files and folders to a folder outside the scope of PMS.

So these are the Steps to happy deletion :-)

1.) Browse your Media Files and mark things for deletion
2.) Empty The Trashcan (using your Media Renderer) which will move the files to a folder outside the PMS library (By Default it is <Root Of Drive>/PMS_Trashcan)
3.) Manually empty the Trash Folder from time to time or use a task scheduler / cronjob to have it done automatically

Configuration options explained:

rdLogEnabled (true/false, default true) & rdLogPath (default plugins/RemoteDelete.log):
rdLogEnabled enables the log output of RemoteDelete. rdLogPath is the path to the logfile. If you do not specify an absolute path the log will be written relatively to the PMS program folder.


rdAsyncMoveQueueInterval (Interval in seconds, default 60):
Normally the movement of the files should be very fast since RemoteDelete maintains (tries to maintain) a trashcan folder for each partition. But sometimes the media server itself locks files or directories while maintaining its library. As long as thos are locked the files cannot be moved. Therefore RemoteDelete maintains a queue of items to be moved to the trash folder and retries to move previously locked items at the given interval.


rdDeleteFolder (One relative path OR comma separated list of absolute paths, default PMS_Trashcan):
RemoteDelete tries to quickly move deleted items to the specified trash folder. This normally succeeds if source and destination reside on the same physical harddrive. From within Java it is not easy to determine the boundaries of physical harddrives on every OS.

On Windows you should be fine with the defaults. RemoteDelete will move the files to the Root of the Drive (i.e. C:\PMS_Trashcan, D:\PMS_Trashcan, ...)
On Linux the defaults are probably not that good because the trashcan will be /PMS_Trashcan by default. You should define rdDeleteFolder with a list of the mount points of your physical harddrives containing media (i.e. rdDeleteFolder=/var/media/PMS_Trashcan,/home/peter_paul_and_mary/PMS_Trashcan. RemoteDelete will automatically chose the best folder for each moved file or folder from the list.
Mac OS? Hell be a man and buy yourself a computer. These glossy and shiny things don't do anything well.


rdKeepAsyncMoveQueueOnDisc, rdKeepTrashcanOnDisc (true / false, default true):
If true RemoteDelete will rescue remember in the virtual trashcan folder and move queue after a crash or restart of PMS. Otherwise it will keep these lists only in RAM.


rdKeepFolderStructureInTrashcan (true/false, default true):
Specfies if RemoteDelete should move files and folders with their complete path.
Example: Sourcefile is D:\Videos\Movies\Terminator\Terminator.mkv
Destination if true: D:\PMS_Trashcan\Videos\Movies\Terminator\Terminator.mkv
Destination if false: D:\PMS_Trashcan\Terminator.mkv

Feel free to post suggestions and feature requests :)
User avatar
PioneerDU
 
Posts: 3
Joined: Fri Mar 25, 2011 3:31 am
Location: Germany

Re: Remote Delete Plugin

Postby PioneerDU » Fri Mar 25, 2011 4:53 am

Here are a few screenshots (badly taken, I know)
Image
Image
Image
Image
Image
User avatar
PioneerDU
 
Posts: 3
Joined: Fri Mar 25, 2011 3:31 am
Location: Germany

Re: Remote Delete Plugin

Postby taconaut » Fri Mar 25, 2011 8:42 am

Thanks for the efforts :) I like the way you're making it work by moving the files to a temporary folder.

Any better Method of refreshing (virtual) folders?

Not quite sure to get your question. discoverChildren() is being called the first time a folder is being entered and refreshChildren() all subsequent times. It can be tricky to NOT modify the folder content when refreshChildren() is being called and no files have changed.

Serially marking files for deletion with "gestures"

Detecting a play longer than 10s is pretty easy. Here's a plugin doing that (http://pms-mlx.svn.sourceforge.net/view ... herPlugin/). Playing one video after the other seems tougher though.

Don't know if you gave pms-mlx a try, but I'd love to see a FileEntryPlugin doing this. The tmdbRaterPlugin has most of the functionality needed, but instead of deleting a file, it's being rated on tmdb. (At some point the plugin system will be properly document but hasn't been for now).
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1104
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: Remote Delete Plugin

Postby PioneerDU » Fri Mar 25, 2011 10:50 pm

Hi :-)

Thanks for your quick answer. I am from Germany and not a native speaker as you probably have noticed, but I try to describe my intention as clear as possible. If you don't get me, just ask ;)

taconaut wrote:
Any better Method of refreshing (virtual) folders?

Not quite sure to get your question. discoverChildren() is being called the first time a folder is being entered and refreshChildren() all subsequent times. It can be tricky to NOT modify the folder content when refreshChildren() is being called and no files have changed.


That's my problem. I need frequent updates. For example if I mark a folder for deletion I remove it's files and subfolders from the tree and make them appear in the Trashcan virtual folder. I am looking for a method to make this happen as fast as possible. What does discoverChildren() do? Does it clear the folder and then rebuild it from scratch?

taconaut wrote:
Serially marking files for deletion with "gestures"

Detecting a play longer than 10s is pretty easy. Here's a plugin doing that (http://pms-mlx.svn.sourceforge.net/view ... herPlugin/). Playing one video after the other seems tougher though.


I don't want to join the files on servers side. I just want it to offer a virtual folder with a collection of preview videos virtually shortened to 10 seconds. A file will be marked for deletion if the user does not watch the full 10 seconds by either stopping [ ] or skipping >>| the playback.

As an alternative just in this moment I got the Idea to use the subtitle engine or a ffdshow filter somehow to give the user an onscreen indication when to skip or stop playback. A "Stop/Skip now to to keep file" and "Stop/Skip now to mark the file for deletion" onscreen message could for example toggle every 10 seconds giving the user the possibility to view any part of the video before deciding about it's future.

taconaut wrote:Don't know if you gave pms-mlx a try, [...]


Yeah I did a while ago. But I didn't know if it was a fork that would die some day. What are the chances that it melts back into the next final version of PMS? Would you say it's more future-proof to test my development against pms-mlx?
User avatar
PioneerDU
 
Posts: 3
Joined: Fri Mar 25, 2011 3:31 am
Location: Germany

Re: Remote Delete Plugin

Postby taconaut » Sun Mar 27, 2011 11:30 am

PioneerDU wrote:That's my problem. I need frequent updates. For example if I mark a folder for deletion I remove it's files and subfolders from the tree and make them appear in the Trashcan virtual folder. I am looking for a method to make this happen as fast as possible. What does discoverChildren() do? Does it clear the folder and then rebuild it from scratch?

To show it in the 'trash' easiest would probably be to show the folder you're moving to as a RealFile (no need to do anything virtual here), this way you don't have to bother if a file has been moved there, but each time the folder is being re-entered on the ps3, the newly 'deleted' files will show up (at the bottom of the list).
To remove the 'virtual file' used for deleting the video, I don't see any better solution then to remove it in refreshChildren() which is being called when a folder is being re-entered. AFAIK it's always the ps3 who's asking for an update, the server can't trigger any.

PioneerDU wrote:I don't want to join the files on servers side. I just want it to offer a virtual folder with a collection of preview videos virtually shortened to 10 seconds. A file will be marked for deletion if the user does not watch the full 10 seconds by either stopping [ ] or skipping >>| the playback.

As an alternative just in this moment I got the Idea to use the subtitle engine or a ffdshow filter somehow to give the user an onscreen indication when to skip or stop playback. A "Stop/Skip now to to keep file" and "Stop/Skip now to mark the file for deletion" onscreen message could for example toggle every 10 seconds giving the user the possibility to view any part of the video before deciding about it's future.

Ok, I didn't imagine it this way :) Didn't even notice you can skip to the next video on the ps3 hehe

PioneerDU wrote:Yeah I did a while ago. But I didn't know if it was a fork that would die some day. What are the chances that it melts back into the next final version of PMS? Would you say it's more future-proof to test my development against pms-mlx?

Shagrath was ok with the idea to integrate it once it's finished, it probably won't be for the next release (except there won't be any for a year or so :p).
After a second thought it's probably not the right time to integrate this function in pms-mlx , as the tagging system that will come at some point will offer a pretty easy integration of such a functionality. Anyway, you can safely test it there if you want to, I've invested quite a lot of time and don't intend to let it die ;)
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1104
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland


Return to Additions and Plugins

Who is online

Users browsing this forum: No registered users and 6 guests