If all dirs are enabled on the user in Emby the EnabledFolders returns a empty list []. Because Emby expect you to get all LibraryFolders This is done with api call to http://192.168.1.6:8096/emby/Library/MediaFolders The data returned on this is:
{'Items': [{'Name': 'custom added folder',
'ServerId': '98ffcead6abf4e1785aebfc328eb64d0',
'Id': '4e57254b22890e8821d40369b5fbc5f6',
'Etag': 'cf80ced1811a32f28483093ad517d5f3',
'DateCreated': '2018-12-02T18:37:20.0000000+00:00',
'CanDelete': False,
'CanDownload': False,
'SortName': 'custom added folder',
'ExternalUrls': [],
'Path': '/var/db/emby-server/root/default/custom added folder',
'EnableMediaSourceDisplay': True,
'Taglines': [],
'Genres': [],
'RemoteTrailers': [],
'ProviderIds': {},
'IsFolder': True,
'ParentId': '2',
'Type': 'CollectionFolder',
'Studios': [],
'GenreItems': [],
'DisplayPreferencesId': '4e57254b22890e8821d40369b5fbc5f6',
'Tags': [],
'PrimaryImageAspectRatio': 1.77777777777778,
'CollectionType': 'tvshows',
'ImageTags': {'Primary': '5b9e0aa45f78ee3b2472f8f8c7e65ff5'},
'BackdropImageTags': [],
'LockedFields': [],
'LockData': False}],
'TotalRecordCount': 1}
From this I can make a list of all the LibraryFolders like this
for data in data_media_folders['Items']:
folder_id.append(data['Id'])
This is the same as if the user only had access to a few of the folders like the list in EnabledFolders That is why it is nessasery to actually check if the Policy.EnableAllFolders are False or True in order to know if you are going to run all folders or only those the user has access to.
So my final hotfix was as follows: sickbeard/webserve.py :5529
if user.get('Policy', {}).get('EnableAllFolders'):
all_folders_url = 'http://%s/emby/Library/MediaFolders' % cur_host
media_folders = sickbeard.helpers.getURL(all_folders_url, headers=headers, params=dict(format='json'), timeout=10, json=True)
folders = []
for data in media_folders['Items']:
folders.append(data['Id'])
else:
folders = user.get('Policy', {}).get('EnabledFolders')
for folder_id in folders or []:
Now all my shows gets a marked watched state even if i have access to all of the Libraries from Emby. I have opened a issue on Emby asking if this is a normal and expected behavior from Emby MediaBrowser/Emby#3485
As it is pretty clear there is a bug in the SickGear repo, the owner has no intention on fixing this. https://github.com/SickGear/SickGear/issues/1144