(2013-05-27, 00:37)Nwardezir Wrote: Plugin is already using xbmcvfs, from what I found in SimpleDownloader.py
Code:
if status == 200:
if self.xbmcvfs.exists(item["path_incomplete"]):
self.common.log("Moving %s to %s" % (repr(item["path_incomplete"]), repr(item["path_complete"])))
self.xbmcvfs.rename(item["path_incomplete"], item["path_complete"])
self._showMessage(self.language(203), filename)
It's in the _processQueue method, and I guess the 200 status code is OK, thus file downloaded and need to be moved.
[...]
Any ideas ?
That is the issue right there: you can only rename a file if it is on the same drive in Windows. You cannot rename a file between drives: you must perform a copy and delete (a move, in effect).
So change the lines
Code:
if status == 200:
if self.xbmcvfs.exists(item["path_incomplete"]):
self.common.log("Moving %s to %s" % (repr(item["path_incomplete"]), repr(item["path_complete"])))
self.xbmcvfs.rename(item["path_incomplete"], item["path_complete"])
self._showMessage(self.language(203), filename)
to
Code:
if status == 200:
if self.xbmcvfs.exists(item["path_incomplete"]):
self.common.log("Copying %s to %s" % (repr(item["path_incomplete"]), repr(item["path_complete"])))
self.xbmcvfs.copy(item["path_incomplete"], item["path_complete"])
self.common.log("Deleting %s" % (repr(item["path_incomplete"])))
self.xbmcvfs.delete(item["path_incomplete"])
self._showMessage(self.language(203), filename)
and it should now work: it does for me
Of course, this is not "optimal" if the temp location ("path_incomplete") and the final location ("path_complete") are on the same drive.
A "perfect" solution would check the drive locations and perform "rename" if the same, or copy/delete if different.
Update: okay, I've just noticed it is not deleting the files from the temporary location, so a little more work needs done. But it does copy it to the correct NAS location: 50% success
Update 2: a further check shows that it only occasionally fails to delete the temp copy of the downloaded file - 1 in 10 of the Apple iTunes Trailers I tested last night, and not always the first on to be queued up either. Guessing there is a timing issue going on with the file still being open? I really don't know Python at all, so fully debugging the script is beyond me at the moment :-(