• 1
  • 13
  • 14
  • 15(current)
  • 16
  • 17
  • 22
[RELEASE] Missing Movie Plugin - Find Movies and TV Shows that are not in the library
Just a guess: The case problem might not be restricted to the hostname but also to the actual SMB share name:
Code:
smb://opteron185/films/
vs
Code:
smb://OPTERON185/Films/

Some thoughts (I might try a fix myself when I get spare time):
-Maybe convert the source strings completely to lower case (not only for SMB and not only hostname). The problem might also occur for other source types.

-In function
Code:
def strip_username_password(s):
    if s.find('@') != -1:
        s = s[0:6] + s[s.find('@') + 1:]
    return s
I guess you assume that when you see a '@' that the string starts with 6 characters like "smb://". That might be wrong for other protocols encoded as URIs such as "file://bla". I dont know if that might actually happen in this case.

-Maybe its a good idea to execute the string santization functions only once right after you obtained the string so in the code executed later you can be sure your strings are fine. Would mean you dont have later to call functions like "strip_username_password" at multiple places in your code.

btw @Raytestrak:
I guess you are on Windows so your OS does not care about lower/upper case. As a workaround I suspect you could re-add your sources in XBMC like they appear in the log. Like this:
Code:
smb://OPTERON185/Films
Reply
(2012-03-13, 00:36)devkid Wrote: Just a guess: The case problem might not be restricted to the hostname but also to the actual SMB share name:
Code:
smb://opteron185/films/
vs
Code:
smb://OPTERON185/Films/

Some thoughts (I might try a fix myself when I get spare time):
-Maybe convert the source strings completely to lower case (not only for SMB and not only hostname). The problem might also occur for other source types.
Wouldn't that break compatibility with case-sensitive operating systems? Or do you mean, do this only for windows? (Don't know if there is an easy way to do that in Python)

(2012-03-13, 00:36)devkid Wrote: -In function
Code:
def strip_username_password(s):
    if s.find('@') != -1:
        s = s[0:6] + s[s.find('@') + 1:]
    return s
I guess you assume that when you see a '@' that the string starts with 6 characters like "smb://". That might be wrong for other protocols encoded as URIs such as "file://bla". I dont know if that might actually happen in this case.
Oops, that wasn't supposed to be there. I thought I changed that to s.find("://") + 3.

(2012-03-13, 00:36)devkid Wrote: -Maybe its a good idea to execute the string santization functions only once right after you obtained the string so in the code executed later you can be sure your strings are fine. Would mean you dont have later to call functions like "strip_username_password" at multiple places in your code.
Yeah I didn't put much research into where the strip_username_password should really be. But I think the other string sanitation functions are only called at the earliest possible time, I could be wrong about that though.

(2012-03-13, 00:36)devkid Wrote: btw @Raytestrak:
I guess you are on Windows so your OS does not care about lower/upper case. As a workaround I suspect you could re-add your sources in XBMC like they appear in the log. Like this:
Code:
smb://OPTERON185/Films

Yeah that would probably work. I'll have a look at it again tonight, maybe also have the add-on show the progress on screen, because when I'm on SMB it just seems to freeze up. (Not the case though it just takes a very long time). It also seems XBMC is opening a lot of files during the scan, maybe I'll also have a look at why it does that.
Reply
(2012-03-13, 00:36)devkid Wrote: btw @Raytestrak:
I guess you are on Windows so your OS does not care about lower/upper case. As a workaround I suspect you could re-add your sources in XBMC like they appear in the log. Like this:
Code:
smb://OPTERON185/Films

Windows it is. Using Daniela's / DDDamiens fantastic HD audio build.
I really don't want to rebuild my libraries. I've done so in the past, losing half my artwork/series/movies. Total pain in the ass. I guess I can export to an xml file and edit that 50MB textfile, but I'm affraid something will go wrong. Maybe a stupid question, I don't know jack about python, but in most scripting languages there's a convert option. Doesn't python have a ucase(string) function built-in?
CoreElec on a tn95 (s905x). Onkyo NR-656. Canton Movie CD-1000. LG 55B6V.

If it ain't broke: break it, fix it, repeat
Reply
I know you said this does not support samba shares but does it work with FTP locations?
Reply
(2012-03-13, 18:28)Raytestrak Wrote: I don't know jack about python, but in most scripting languages there's a convert option. Doesn't python have a ucase(string) function built-in?

Yeah it does and I'm using that now, but it seems I might have missed some places, a new log would really help me (please turn off the XBMC-wide debug option though and turn on the debug setting in the add-on settings of this add-on, makes it a bit easier for me to read and reduces the size of the log too.
(2012-03-13, 21:05)errornumber419 Wrote: I know you said this does not support samba shares but does it work with FTP locations?

It currently does support samba shares, should also work with FTP locations. Although there is probably a bug in the current version if the FTP location is password protected.


P.S. Ooh, nice this new forum software concatenates your new post if there was already one before it.
Reply
(2012-03-13, 17:57)Sentir101 Wrote:
(2012-03-13, 00:36)devkid Wrote: -Maybe convert the source strings completely to lower case (not only for SMB and not only hostname). The problem might also occur for other source types.
Wouldn't that break compatibility with case-sensitive operating systems? Or do you mean, do this only for windows? (Don't know if there is an easy way to do that in Python)
Hm, I dont think it will break but in the list of found missing-movies also the lower-case string would appear which would indeed be kinda dirty (might also fail when the user tries to directly play it on Linux due to the incorrect cases). Maybe better to use a custom string compare function named like "string_compare_case_insensitive" which does just:
Code:
return strA.lower() == stringB.lower()
And then use that function in all places where a string from GetSources and from GetDirectories is compared (so it needs to be case insensitive)?

EDIT:
Oops, my bad, would ofc have to be something like "startswith_case_insensitive" but I am sure you got the idea...

Better avoid platform specific code if possible.

(2012-03-13, 18:28)Raytestrak Wrote: Windows it is. Using Daniela's / DDDamiens fantastic HD audio build.
I really don't want to rebuild my libraries. I've done so in the past, losing half my artwork/series/movies. Total pain in the ass. I guess I can export to an xml file and edit that 50MB textfile, but I'm affraid something will go wrong.
Ok ok, dont do it then. Angel Was just a crazy thought about a workaround. Its quite easy fixable inside the plugin I guess so better wait for a working version.
Reply
Well it had something like this in mind which fixes the source detection:
http://pastebin.com/q8iMY5Bu

But the file comparison to find the missing ones is still borked, which I forgot about Sad Problem is the function "difference" of "set". I guess it just calls the equality operator of the string class which is obviously case sensitive.
Reply
Okay, hopefully I fixed it now. I now swap the case of the hostname when a source can't be opened, this fixed the problem for me.

Changelog for 2.1.3:
  • Fixed: Swap case of hostname to verify if it really doesn't exist
  • Fixed: Some unicode errors
  • Fixed: Strip username and password the right way
Download
Reply
I just installed 2.1.3. I'm now getting a "script failed" error. I'm on Win 7 x64. Latest EDEN.

Here is the log.

http://pastebin.com/1mzGvWi8

Reply
(2012-03-15, 00:17)mrfatboy Wrote: I just installed 2.1.3. I'm now getting a "script failed" error. I'm on Win 7 x64. Latest EDEN.
Okay this should fix that, there are potential errors with trailers, but I won't know until someone with trailers tries it.

Changelog for 2.1.3a:
  • Fixed: Unicode error
Download

Reply
2.1.3a worked the first time. It found a non added movie. it was "sample.m4v". I deleted it. Re ran MMV 2.1.3a and get a script failed error again.

http://pastebin.com/qF6L1igX
Reply
(2012-03-15, 02:00)mrfatboy Wrote: 2.1.3a worked the first time. It found a non added movie. it was "sample.m4v". I deleted it. Re ran MMV 2.1.3a and get a script failed error again.
This should fix it.

Changelog for 2.1.3b:
  • Fixed: Output the right missing list to the log (fixes crash when there is nothing missing)
Download

Reply
Great! it seems to be working now! Nice Job!
Reply
Well, I tried to reproduce that "case"-problem on my Windows notebook and it is easy reproducable. Sorry, I have to say that your current version does not work for me when using different cases.
As said some days ago, the problem is not limited to the hostname. The whole source path is affected. So trial-and-error the hostname does not cut it I think.

Also, is it needed to try both case versions here? It probably does not matter on Windows and on Linux the case of the input 'path' parameter should be the correct one anyway:
Code:
json = '{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params":{"directory": "' + path + u'"},  "id": 1}'
        result = eval(xbmc.executeJSONRPC(json.encode('utf-8')))
        if 'result' not in result:
            json = '{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params":{"directory": "' + swapcase_hostname(path) + u'"},  "id": 1}'
            result = eval(xbmc.executeJSONRPC(json.encode('utf-8')))

I just realized that I did not post the source code of version I made that used an case-insensitive version of 'startswidth'. I think thats the only trick needed to fix the case problem. For me that approach works nicely. Also it is not a problem when finding the actual movies as I formerly thought cause the JSON RPC calls will response with a correct case'd path.

Feel free to correct me where I am wrong, thats just what I have in mind currently...

Also here is my version from some days ago. Maybe you want use parts of it in your version so we dont need to have two different branches.
Reply
(2012-03-15, 22:08)devkid Wrote: Well, I tried to reproduce that "case"-problem on my Windows notebook and it is easy reproducable. Sorry, I have to say that your current version does not work for me when using different cases.
As said some days ago, the problem is not limited to the hostname. The whole source path is affected. So trial-and-error the hostname does not cut it I think.

Also, is it needed to try both case versions here? It probably does not matter on Windows and on Linux the case of the input 'path' parameter should be the correct one anyway:
Code:
json = '{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params":{"directory": "' + path + u'"},  "id": 1}'
        result = eval(xbmc.executeJSONRPC(json.encode('utf-8')))
        if 'result' not in result:
            json = '{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params":{"directory": "' + swapcase_hostname(path) + u'"},  "id": 1}'
            result = eval(xbmc.executeJSONRPC(json.encode('utf-8')))
I think when the wrong case is requested the JSON-RPC request will fail on the XBMC side with an argument error, don't know for sure right now though and don't have the time to test it.
(2012-03-15, 22:08)devkid Wrote: I just realized that I did not post the source code of version I made that used an case-insensitive version of 'startswidth'. I think thats the only trick needed to fix the case problem. For me that approach works nicely. Also it is not a problem when finding the actual movies as I formerly thought cause the JSON RPC calls will response with a correct case'd path.

Feel free to correct me where I am wrong, thats just what I have in mind currently...

Also here is my version from some days ago. Maybe you want use parts of it in your version so we dont need to have two different branches.
I'll have a look at it when I have the time, which will probably be next tuesday or wednesday. The case-insensitive startswith looks good to me.

EDIT: One more thing, did you try this with a TV source or a movie source, because I just saw I forgot to add the code to get_tv_sources
EDIT2: Okay, just tested even though I should really be going to sleep. The case-insensitive verion of startswith doesn't work for me, the GetDirectory returns the path like it was requested, thus the library files differ in case from the get_files and you just get a list of every movie on the source.
Reply
  • 1
  • 13
  • 14
  • 15(current)
  • 16
  • 17
  • 22

Logout Mark Read Team Forum Stats Members Help
[RELEASE] Missing Movie Plugin - Find Movies and TV Shows that are not in the library2