[WIP] Loose Files, identify non-library files
#1
This is a script I threw together for a friend of mine who suffered a catastrophic hardware failure and lost his media. While he had a 'backup', it was an old backup and so he lost all his carefully ascribed naming and folder structure. Some of his files will be picked up by XBMC, but too many wont be, and he needs a way to identify the files that havent been added to the library.

Loose Files scans your source folders and compares those files to the ones in your library, with the aim of identifying the files not picked up by XBMC. It provides you a list of those files on-screen. It can also save the list to disk or send it to you via email. The on-screen list gives you the option to play the file (to see what it is) or rename it. If you rename it the options change to allow you to rename it again, or move it to a new folder.

The script looks for 7 specific file types (avi, mkv, mpg, mpeg, mp4, wmv, mov), and you can either switch these file types off or add your own in the Settings. You can also set the script to ignore files below certain sizes.

Source: https://github.com/KODeKarnage/script.loosefiles
Download: https://github.com/KODeKarnage/script.lo...master.zip
Reply
#2
Looks like python doesnt walk along SMB paths, so the script wont currently work with SMB shares.

I will look into a workaround for that. Happy to hear suggestions though.

I am going to start by looking at smbclient.py, which may work even if it means I have to do my own 'walking'. https://bitbucket.org/nosklo/pysmbclient/wiki/Home
Reply
#3
You can walk the directories (smb, nfs, whatever) using JSON "Files.GetDirectory", have a look at the"missing" option of the script in my sig which does this.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#4
Thanks!

I did try using that method, but my query always failed to parse. I suspect a Windows backslash issue.
Reply
#5
Now here's a thought. Why dont I just use your script to identify the files? Smile
Reply
#6
Mines a pure script, that runs entirely outside of XBMC (which has some advantages/disadvantages)... isn't yours an addon of some sort that runs within XBMC? Some people prefer that.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#7
Yep, I was thinking about calling your script twice with two arguments "missing movies" and "missing tvshows". But keeping the front-end element in the Addon.

I only want the "missing" part of the script, and could just excise the code I need, I suppose. We'll just see how that goes.

Someone has pointed out the Missing Movie Scanner addon/plugin, which I didn't know about! Looks like a fertile field of development Smile
Reply
#8
Fixed the SMB walking problem so it works with shares. Using the json-rpc, and its so much faster too.

Next I am going to look at accommodating RAR and ZIP files and maybe throwing in a context menu for the actions.
Reply
#9
May also look to generate a list of duplicates, or identify which non-library files have duplicates in the library.
Reply
#10
I have added in the ability to search specific terms when looking for loose files, but also across all files if you like.

The file scan is cached so you can switch that off to save a little time.
Reply
#11
Moved the Rename and file move functions to a context menu, so main click now plays the item.

Also fixed the search to work a bit faster.
Reply
#12
Replying so as to subscribe, will post error messages later when on proper computer.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#13
Thanks nickr, testers always welcome!
Reply
#14
(2014-04-20, 04:51)Karnagious Wrote: Thanks nickr, testers always welcome!
Sorry its not a debug log, nor a full log, if you need those for this particular problem I'll gladly do one.

The addon does through the directories (you can see filenames flash past) and then an error message pops up. This is the log:

Quote:13:18:04 T:139934706943744 NOTICE: Thread LanguageInvoker start, auto delete: false
13:18:04 T:139934706943744 NOTICE: -->Python Interpreter Initialized<--
13:18:25 T:139933884851968 NOTICE: Thread RarFileExtract start, auto delete: false
13:18:52 T:139934706943744 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<-
-
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.UnicodeEncodeError'>
Error Contents: 'ascii' codec can't encode character u'\xbd' in position 34: ordinal not i
n range(128)
Traceback (most recent call last):
File "/storage/.xbmc/addons/script.loosefiles-master/default.py", line 642, in <module>
f = scan_files(lp, extensions)
File "/storage/.xbmc/addons/script.loosefiles-master/default.py", line 237, in scan_file
s
f.write(a + '\n')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xbd' in position 34: ordinal n
ot in range(128)
-->End of Python script error report<--
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#15
Ah, one of those pesky unicode errors. I hate them.

I have added a "fix" to the search branch. Let me know how it goes. Thanks.
Reply

Logout Mark Read Team Forum Stats Members Help
[WIP] Loose Files, identify non-library files0