[PATCH] AutoExport and Smart Clean Patch
#1
Hi All

I just did my first patch :-) and hopefully its OK?

Ticket http://trac.xbmc.org/ticket/8292

This is a patch upon updating the video lib, automatically cleans the video database and removes any file if the directory where the file is accessible but the file is not (so the file has been re-names or deleted). It then also exports the database.
These are controlled via the advancedsettings.xml file:

<advancedsettings>
<videolibrary>
<smartclean>true</smartclean>
<autoexport>true</autoexport>
</videolibrary>
</advancedsettings>

I also fixed a bug: the seasons were not being saved to the correct places
Reply
#2
Why do you need to smartclean ? Doesn't clean library do this already ?
The normal XBMC log IS NOT a debug log, to enable debug logging you must toggle it on under XBMC Settings - System or in advancedsettings.xml. Use XBMC Debug Log Addon to retrieve it.
Reply
#3
This is what I wanted!
Hope this will be integrated in future releases of the official XBMC.
Thank you for doing this.

CrashX Wrote:Why do you need to smartclean ? Doesn't clean library do this already ?
Sure, but so you have to do this only once, instead of updating library (waiting 5 min in my case) and then again cleaning the database (again 5 min) and saving 5 min is a thing I really want Smile
Reply
#4
the <cleanonupdate> advancedsettings has been there since the very beginning - it used to default to true but had to be defaulted to false due to sleeping nas'es. the only thing the diff adds in those regards is a smarter routine that won't remove shit if the server they are on isn't responding. still waiting for the author to respond to my concerns in the ticket.
Reply
#5
empty Wrote:This is what I wanted!
Hope this will be integrated in future releases of the official XBMC.
Thank you for doing this.


Sure, but so you have to do this only once, instead of updating library (waiting 5 min in my case) and then again cleaning the database (again 5 min) and saving 5 min is a thing I really want Smile

I like the auto export functionality but it shouldn't be combined with other features. If you can improve cleanonupdate, then please do.
The normal XBMC log IS NOT a debug log, to enable debug logging you must toggle it on under XBMC Settings - System or in advancedsettings.xml. Use XBMC Debug Log Addon to retrieve it.
Reply
#6
Quote:Why do you need to smartclean ? Doesn't clean library do this already ?

the only thing I think that smat clean does is to NOT remove files if the directory is not accessable.

the reason why i'd like this feature is to be able to have my nas switched off (due to crash or power outage) and not remove all my database. this has happened several times now.

I do however want to be able to do a real clean (remove everything that isn't acessable manually.

the Patch for the smart clean is probably overkill and adding a parameter to the normal clean function would be far better (however it was my first attempt to look at the code)

To do a correct export you need to have a clean database otherwise you try and export rubish. Thats the only reason why the two featrues are in one Patch.

Thinking about this more I can re-do the clean so that it uses the current function with a parameter that says "lightclean" (to just clean whats there and create a seperate Patch for the clean and export

Does this sound OK before i go and do it?
Reply
#7
Sounds like a good plan.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#8
jmarshall Wrote:Sounds like a good plan.

Isn't that a bug with clean library if it is removing the file if it can't access the network drive ? Wouldn't it be better if it was fixed so that it would check if network share was accessible before removing it.
The normal XBMC log IS NOT a debug log, to enable debug logging you must toggle it on under XBMC Settings - System or in advancedsettings.xml. Use XBMC Debug Log Addon to retrieve it.
Reply
#9
that's exactly what the smart clean we are discussing does....
Reply
#10
...and how to add this to my xbmc?

Sorry for the newbie question...

Thanks
Reply
#11
Would be very usefull to integrate in XBMC an auto-export function when scraping single movie informations/media! Its awefull to "export" the whole library for maybe 10 new Movies/Series.
Reply
#12
the auto export only exports files that are not there and it does lock the PC up as its in the background (unlike the manual one)
Reply
#13
Has this patch been commited to the latest stable XBMC release?


Sadly my library still isn't cleaned up on startup & library update.

Code:
Contents of special://profile/advancedsettings.xml are...
                                            <advancedsettings>
                                              <loglevel>0</loglevel>
                                              <videolibrary>
                                                <smartclean>true</smartclean>
                                              </videolibrary>
                                              <tvshowmatching append="no">
                                                <regexp>\[[Ss]([0-9]+)\]_\[[Ee]([0-9]+)\]?([^\\/]*)(?:(?:[\\/]video_ts)[\\/]video_ts.ifo)?</regexp>
                                                <regexp>[\._ \[\-\\/]([0-9]+)x([0-9]+)([^\\/]*)(?:(?:[\\/]video_ts)[\\/]video_ts.ifo)?</regexp>
                                                <regexp>[Ss]([0-9]+)[\.\-]?[Ee]([0-9]+)([^\\/]*)(?:(?:[\\/]video_ts)[\\/]video_ts.ifo)?</regexp>
                                                <regexp>[\._ \-\\/]([0-9]+)([0-9][0-9])([\._ \-][^\\/]*)(?:(?:[\\/]video_ts)[\\/]video_ts.ifo)?</regexp>
                                              </tvshowmatching>
                                            </advancedsettings>

I've removed a video and changed the debug level to 2 and it says:

Code:
19:54:16 T:7092 M:1472778240   ERROR: XFILE::CDirectory::GetDirectory - Error getting C:\Usenet\movies\testmovie\
19:54:16 T:7092 M:1472778240   DEBUG: VIDEO::CVideoInfoScanner::DoScan Rescanning dir 'C:\Usenet\movies\testmovie\' due to change
19:54:16 T:7092 M:1472778240   DEBUG: Hash[movies,C:\Usenet\movies\testmovie\]:DB=[605C5037A0759C6BBCEB727E1E06A2DA],Computed=[]
19:54:16 T:7092 M:1472778240   DEBUG: Not adding item to library as no info was found :(
19:54:16 T:7092 M:1472778240   DEBUG: VIDEO::CVideoInfoScanner::DoScan - Finished dir: C:\Usenet\movies\testmovie\

So the removal has been detected but it ends up having no effect on the library contents.

Thanks!
Reply

Logout Mark Read Team Forum Stats Members Help
[PATCH] AutoExport and Smart Clean Patch1