I'm loving this addon. The only problem I've got is I'm running on multiple clients with MySQL back end and a NAS for storage. In order to get it working with network paths (In my case: <setting id="tv_folder" value="smb://freenas/media/youtube/episodes" />) I had to make a few changes. I'm not sure if my fix below is correct (I'm a DB programmer and only vaguely familiar with Python) but hopefully it'll point in the generally correct direction...
Before any code changes, I was getting the following error:
Code:
ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.IOError'>
Error Contents: (2, 'No such file or directory', 'smb://freenas/media/youtube/episodes/GreatScott_/tvshow.nfo')
Traceback (most recent call last):
File "/storage/.kodi/addons/plugin.video.youtubelibrary/addon.py", line 130, in <module>
routes.update_playlist(type=type)
File "/storage/.kodi/addons/plugin.video.youtubelibrary/resources/lib/routes.py", line 58, in update_playlist
service.update_playlist(id, type=type)
File "/storage/.kodi/addons/plugin.video.youtubelibrary/resources/lib/service.py", line 86, in update_playlist
generators.write_tvshow_nfo(folder, settings)
File "/storage/.kodi/addons/plugin.video.youtubelibrary/resources/lib/generators.py", line 976, in write_tvshow_nfo
with codecs.open(stream,'w',encoding='utf8') as f:
File "/home/stephan/projects/openelec-6.0/build.OpenELEC-Generic.x86_64-6.0.0/Python-2.7.3/.install_pkg/usr/lib/python2.7/codecs.py", line 881, in open
IOError: (2, 'No such file or directory', 'smb://freenas/media/youtube/episodes/GreatScott_/tvshow.nfo')
-->End of Python script error report<--
A little research showed that python's native open doesn't know how to deal with network files, but Kodi provides the xbmcvfs library that does. Looking in resources/lib/generators.py showed that the code was there but had been commented out...
Code:
with codecs.open(stream,'w',encoding='utf8') as f:
f.write(content)
f.close()
#file = xbmcvfs.File(stream, 'w') #Open / create this file for writing
#file.write(str(content)) #Write the content in the file
#file.close() #Close the file
commenting out the first three lines and uncommenting the other three then gave this error:
Code:
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'\xb4' in position 291: ordinal not in range(128)
Traceback (most recent call last):
File "/storage/.kodi/addons/plugin.video.youtubelibrary/addon.py", line 130, in <module>
routes.update_playlist(type=type)
File "/storage/.kodi/addons/plugin.video.youtubelibrary/resources/lib/routes.py", line 58, in update_playlist
service.update_playlist(id, type=type)
File "/storage/.kodi/addons/plugin.video.youtubelibrary/resources/lib/service.py", line 86, in update_playlist
generators.write_tvshow_nfo(folder, settings)
File "/storage/.kodi/addons/plugin.video.youtubelibrary/resources/lib/generators.py", line 980, in write_tvshow_nfo
file.write(str(content)) #Write the content in the file
UnicodeEncodeError: 'ascii' codec can't encode character u'\xb4' in position 291: ordinal not in range(128)
-->End of Python script error report<--
The fix for that turned out to be adding the following line to convert from utf-8 to ascii
Code:
content_ascii = content.encode("utf-8")
and changing file.write to use content_ascii.
I still had one error after that:
Code:
ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.IOError'>
Error Contents: (2, 'No such file or directory', 'smb://freenas/media/youtube/episodes/GreatScott_/folder.jpg')
Traceback (most recent call last):
File "/storage/.kodi/addons/plugin.video.youtubelibrary/addon.py", line 130, in <module>
routes.update_playlist(type=type)
File "/storage/.kodi/addons/plugin.video.youtubelibrary/resources/lib/routes.py", line 58, in update_playlist
service.update_playlist(id, type=type)
File "/storage/.kodi/addons/plugin.video.youtubelibrary/resources/lib/service.py", line 86, in update_playlist
generators.write_tvshow_nfo(folder, settings)
File "/storage/.kodi/addons/plugin.video.youtubelibrary/resources/lib/generators.py", line 988, in write_tvshow_nfo
urllib.urlretrieve(settings.find('thumb').text, folder+"/folder.jpg")
File "/home/stephan/projects/openelec-6.0/build.OpenELEC-Generic.x86_64-6.0.0/Python-2.7.3/.install_pkg/usr/lib/python2.7/urllib.py", line 93, in urlretrieve
File "/home/stephan/projects/openelec-6.0/build.OpenELEC-Generic.x86_64-6.0.0/Python-2.7.3/.install_pkg/usr/lib/python2.7/urllib.py", line 243, in retrieve
IOError: (2, 'No such file or directory', 'smb://freenas/media/youtube/episodes/GreatScott_/folder.jpg')
So, urlretrieve has the same problem as the first error I received. For the moment I commented out the last 3 lines of generators.py that are calling urlretrieve as it's just grabbing artwork that I can live without for the moment. I haven't found a good solution to fix this yet, but I'm thinking using a local (temp) location followed by xbmcvfs.copy might do the trick.