[Request] Can you tell me how you added the - Play with TMDB Helper option to ExtendedInfoMod?
unkn0wn234 opened this issue · 7 comments
As above, I want to add the same setting to Episodes/shows, since it was not done, Ive figured out the TMDB Path for episodes if that was why you couldnt implement it, or maybe it was too difficult. If its the first, I can give u the path or you can tell me how u did it and i wouldnt mind trying to do it myself
Hello
The extra TMDB helper options I added were in the context menu action in a couple of the script files which includes a context menu. So for example in:
~/.kodi/addons/script.extendedinfo/resources/lib/DialogVideoList.py
@ch.action('contextmenu', 500)
def context_menu(self):
And ive added an option like follows (hopefully in bold):
item_1 = False
if self.listitem.getProperty('TVShowTitle'):
listitems = ['Play first episode']
else:
listitems = ['Play']
**listitems += ['Play - TMDB Helper']**
item_1 = True
if self.listitem.getProperty('dbid'):
listitems += ['Remove from library']
else:
listitems += ['Add to library']
listitems += ['Trailer']
listitems += ['Search item']
Which just adds an extra item to the Context menu dialog select box, in addition to what was already there:
selection = xbmcgui.Dialog().select(heading='Choose option', list=listitems)
Utils.hide_busy()
if selection == 0:
So thats the start of the selection, so it will do something based on the index number of the item you selected from the context menu (starting at index 0).
So i added the specific option for TMDBHelper:
if selection == 1 and item_1 == True:
if self.type == 'tv':
url = 'plugin://plugin.video.themoviedb.helper?info=play&tvdb_id=%s&type=episode&season=%s&episode=%s' % (item_id, self.listitem.getProperty('season'), self.listitem.getProperty('episode'))
else:
url = 'plugin://plugin.video.themoviedb.helper?info=play&tmdb_id=%s&type=movie' % (item_id)
PLAYER.play_from_button(url, listitem=None, window=self)
So where you select index 1 (ie the 2nd item in the list) and item_1 is true (when it doesnt have a "TVShowTitle") you can 'Play - TMDB Helper'. The item_1 true part is because there is a 2nd index=1 item which may be there when the item is in you library and still links back to openmeta.
The various screens all relate to a specific script file so, DialogVideoList.py, DialogVideoInfo.py, DialogEpisodeInfo.py, DialogSeasonInfo.py, DialogBaseList.py, DialogActorInfo.py.
Hopefully you can tell what screens you want to add additional options for by the name of the file. If a particular file doesnt have a context menu you can add one yourself, just follow the format of a file which does.
I did add some click and play options to tv show season pages (which list episodes rather than having to go into each episode to play it), to the main search page, to the main movie page, and a few other places where it made sense to me to do so. Whether or not those are on the version you downloaded i really couldnt say.
But I added as many buttons as I wanted, whether or not that satisfies joe random internet, well thats not really something im too concerned about.
I mostly post this stuff so other people can see how to do things. Not necessarily to do it for them, unless it was something I already wanted to figure out how to do. Or its a very quick fix.
But your kind of vaguely worded request with a backhanded insult to boot is hardly going to spark me to leap into action.
If you want to actually have a go yourself i'll be happy to provide assistance once you can come back to me with specific stuff you want to do and maybe some log output if it doesnt work.
Attached is the full copy of "DialogVideoList.py" from the current version I have on my kodi box, uploaded as a log file as it wouldnt allow a ".py" script file to be uploaded.
Have fun.
Hi, sorry if I came off as rude I did not mean it in that way at all, I assumed modding extendedinfo in itself was a very difficult task to begin with I appreciate you did it on movies, I thought that maybe it was more difficult to do with episodes and that’s why it was not there. After re reading my post I can see how it comes off as rude so I apologize, but I did not mean any disrespect I promise you.
With that said thank you for pointing out this information and I will try to give this a go :)
I should also note that the context menu will relate to the specific panel from the appropriate XML file:
e.g.
~/.kodi/addons/script.extendedinfo/resources/skins/Default/1080i/script.extendedinfo-VideoList.xml
<control type="panel" id="500">
So if you wanted to add a context menu to the recommended movies panel on a video info screen its panel 150/250 in "script.extendedinfo-DialogVideoInfo.xml" (not sure if one is episodes and the other movies, and I never know if its the Aura/Estuary or normal version?)
~/.kodi/addons/script.extendedinfo/resources/lib/DialogVideoInfo.py
So you see the action is setup twice to present the same context menu in two places 150 and 250?
And similarly below the 4 select options there are then two click actions, which would open the next screen relating to the thing you clicked on (so open the movie informaiton for a movie in the recommended list as an example)
@ch.action('contextmenu', 150)
@ch.action('contextmenu', 250)
def context_menu(self):
Utils.show_busy()
if self.listitem.getProperty('dbid') and self.listitem.getProperty('dbid') != 0:
dbid = self.listitem.getProperty('dbid')
else:
dbid = 0
item_id = self.listitem.getProperty('id')
if self.type == 'tv':
imdb_id = Utils.fetch(TheMovieDB.get_tvshow_ids(item_id), 'imdb_id')
tvdb_id = Utils.fetch(TheMovieDB.get_tvshow_ids(item_id), 'tvdb_id')
else:
imdb_id = TheMovieDB.get_imdb_id_from_movie_id(item_id)
item_1 = False
if self.listitem.getProperty('TVShowTitle'):
listitems = ['Play first episode']
else:
listitems = ['Play']
listitems += ['Play - TMDB Helper!']
item_1 = True
if self.listitem.getProperty('dbid'):
listitems += ['Remove from library']
else:
listitems += ['Add to library']
listitems += ['Trailer']
listitems += ['Search item']
selection = xbmcgui.Dialog().select(heading='Choose option', list=listitems)
Utils.hide_busy()
if selection == 0:
if self.listitem.getProperty('TVShowTitle'):
url = 'plugin://plugin.video.openmeta/tv/play/%s/1/1' % tvdb_id
PLAYER.play_from_button(url, listitem=None, window=self, dbid=0)
else:
url = 'plugin://plugin.video.openmeta/movies/play/tmdb/%s' % item_id
if self.listitem.getProperty('dbid'):
dbid = self.listitem.getProperty('dbid')
else:
dbid = 0
PLAYER.play_from_button(url, listitem=None, window=self, type='movieid', dbid=dbid)
if selection == 1 and item_1 == True:
if self.type == 'tv':
url = 'plugin://plugin.video.themoviedb.helper?info=play&tvdb_id=%s&type=episode&season=%s&episode=%s' % (item_id, self.listitem.getProperty('season'), self.listitem.getProperty('episode'))
else:
url = 'plugin://plugin.video.themoviedb.helper?info=play&tmdb_id=%s&type=movie' % (item_id)
PLAYER.play_from_button(url, listitem=None, window=self)
if selection == 1 and item_1 == False:
if self.listitem.getProperty('TVShowTitle'):
TVLibrary = xbmcaddon.Addon('plugin.video.openmeta').getSetting('tv_library_folder')
if self.listitem.getProperty('dbid'):
Utils.get_kodi_json(method='VideoLibrary.RemoveTVShow', params='{"tvshowid": %s}' % dbid)
if os.path.exists(xbmc.translatePath('%s%s/' % (TVLibrary, tvdb_id))):
shutil.rmtree(xbmc.translatePath('%s%s/' % (TVLibrary, tvdb_id)))
Utils.after_add(type='tv')
Utils.notify(header='[B]%s[/B]' % self.listitem.getProperty('TVShowTitle'), message='Removed from library', icon=self.listitem.getProperty('poster'), time=5000, sound=False)
xbmc.sleep(250)
self.update(force_update=True)
self.getControl(500).selectItem(self.position)
else:
if xbmcgui.Dialog().yesno('OpenInfo', 'Add [B]%s[/B] to library?' % self.listitem.getProperty('TVShowTitle')):
xbmc.executebuiltin('RunPlugin(plugin://plugin.video.openmeta/tv/add_to_library/%s)' % tvdb_id)
Utils.after_add(type='tv')
Utils.notify(header='[B]%s[/B] added to library' % self.listitem.getProperty('TVShowTitle'), message='Exit & re-enter to refresh', icon=self.listitem.getProperty('poster'), time=5000, sound=False)
else:
if self.listitem.getProperty('dbid'):
if xbmcgui.Dialog().yesno('OpenInfo', 'Remove [B]%s[/B] from library?' % self.listitem.getProperty('title')):
Utils.get_kodi_json(method='VideoLibrary.RemoveMovie', params='{"movieid": %s}' % dbid)
MovieLibrary = xbmcaddon.Addon('plugin.video.openmeta').getSetting('movies_library_folder')
if os.path.exists(xbmc.translatePath('%s%s/' % (MovieLibrary, imdb_id))):
shutil.rmtree(xbmc.translatePath('%s%s/' % (MovieLibrary, imdb_id)))
Utils.after_add(type='movie')
Utils.notify(header='[B]%s[/B]' % self.listitem.getProperty('title'), message='Removed from library', icon=self.listitem.getProperty('poster'), time=5000, sound=False)
xbmc.sleep(250)
self.update(force_update=True)
self.getControl(500).selectItem(self.position)
else:
if xbmcgui.Dialog().yesno('OpenInfo', 'Add [B]%s[/B] to library?' % self.listitem.getProperty('title')):
xbmc.executebuiltin('RunPlugin(plugin://plugin.video.openmeta/movies/add_to_library/tmdb/%s)' % item_id)
Utils.after_add(type='movie')
Utils.notify(header='[B]%s[/B] added to library' % self.listitem.getProperty('title'), message='Exit & re-enter to refresh', icon=self.listitem.getProperty('poster'), time=5000, sound=False)
if selection == 2:
if self.listitem.getProperty('TVShowTitle'):
url = 'plugin://script.extendedinfo?info=playtvtrailer&&id=' + item_id
else:
url = 'plugin://script.extendedinfo?info=playtrailer&&id=' + item_id
PLAYER.play(url, listitem=None, window=self)
if selection == 4:
import urllib
item_title = self.listitem.getProperty('TVShowTitle') or self.listitem.getProperty('Title')
# item_title = urllib.quote_plus(item_title)
item_title = str(item_title).replace(' ', '+').replace('&', 'and')
# xbmc.executebuiltin('RunPlugin(plugin://script.extendedinfo/?info=search_string&str=%s' % item_title)
# xbmc.log(str('RunPlugin(plugin://script.extendedinfo/?info=search_string&str=%s)' % item_title)+'===>TMDB_HELPER_3', level=xbmc.LOGNOTICE)
self.close()
xbmc.executebuiltin('RunPlugin(plugin://script.extendedinfo/?info=search_string&str=%s)' % item_title)
@ch.click(150)
@ch.click(250)
def open_movie_info(self):
self.close()
wm.open_movie_info(prev_window=self, movie_id=self.listitem.getProperty('id'), dbid=self.listitem.getProperty('dbid'))
Its not too difficult but it did take me some time and trial and error to figure it out. Its been a long time since I did it so im not exactly sure what modifications I made.
Comparing it against the original openinfo would probably help you out.
I would just upload a copy of my version but Ive added a number of modifications for my own purposes, some of which include API keys so id need to figure out how to remove that stuff before id be happy sharing it. And i dont really want to/have the time.
I suggest if you need to add a context menu where there currently isnt one, look at the panel id's for whatever screen you want to add, then just setup 1 listitem and a dialog select against the first panel id and see if it appears when you load that screen and click the context menu in the area you wanted to add it in.
If it doesnt appear use the next panel.
You may be able to figure it out by looking at what each panel loads, but its normally pretty tricky to interpret.
I was having a look and I think the additional stuff I added which needed my api keys wasnt too extensive so ive tried removing them from this version:
So this one I think may already tmdb helper options already setup.
However I make no guarantees that it still works. I know for a fact that I have it unloading previously opened windows because it was causing juddering if you start a movie more than two windows deep.
Whether or not that is an acceptable change for you, you'll have to decide for yourself.
I dont particulary want to try and do any amount of remote testing because its an absolute ball ache, unless you can guarantee that you can use a terminal and actually do the testing steps which i require (like watching logs, greping files, adding debugging output and actually assisting in finding out why something doesnt work).
Ive been down this road trying to help people for them to ignore my suggestions and not do a damn thing to help, expecting me to do everything. And as you can imagine i have little appetite to do that again.
If thats why ive seemed a little short with you, thats why. Blame people on the kodi boards for wanting everything done for them and not wanting to do anything in return.
Hi, I’m a noob with this stuff but I’ll try my best thank you for providing me with this information. I’ll do what I can and hit u up but as u said if I don’t know what I’m doing or I’m not doing all the logging stuff you won’t be able to help much, in which case it’s fine bc I made a TMDBHelper player for OpenMeta after some trial and error and I have just been using that through openinfos play dialog, this is just something I was obsessing over bc I wanted movies and episodes to play the same way. If in the end I can’t figure it out I’ll jus go back to regular openinfo and use the tmdbplayer I made anyway, so thank you for the information thus far!
Closed