Skip to content

Commit

Permalink
cleanup and initial Play action
Browse files Browse the repository at this point in the history
  • Loading branch information
elgatito committed Feb 2, 2018
1 parent d5307d1 commit 47381a8
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 47 deletions.
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ clean:
rm -f $(ZIP_FILE)
rm -rf $(NAME)

# extract:
# ./scripts/extract.py --exclude-icons
#
# extract-icons:
# ./scripts/extract.py --exclude-defs

upload:
$(eval EXISTS := $(shell github-release info --user $(GIT_USER) --repo $(GIT_REPOSITORY) --tag v$(VERSION) 1>&2 2>/dev/null; echo $$?))
ifneq ($(EXISTS),1)
Expand Down
31 changes: 12 additions & 19 deletions addon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@
<addon id="context.elementum" name="Elementum Context Helper" version="0.0.1" provider-name="elgatito">
<requires>
<import addon="xbmc.python" version="2.23.0"/>
<import addon="script.module.requests"/>
<import addon="plugin.video.elementum" optional="true"/>
</requires>
<extension point="kodi.context.item">
<menu id="kodi.core.main">
<item library="context_play.py">
<label>32000</label>
<icon>special://userdata/addon_data/context.elementum/icon.png</icon>
<visible>String.IsEqual(ListItem.DBTYPE,episode) | String.IsEqual(ListItem.DBTYPE,movie)</visible>
</item>
<!--item library="context_assign_season.py">
<label>32001</label>
<visible>String.IsEqual(ListItem.DBTYPE,episode) | String.IsEqual(ListItem.DBTYPE,season)</visible>
</item>
<item library="context_assign.py">
<label>32002</label>
<visible>String.IsEqual(ListItem.DBTYPE,episode) | String.IsEqual(ListItem.DBTYPE,movie)</visible>
</item-->
</menu>
<menu id="kodi.core.main">
<label>My submenu</label>
<item library="context_play.py">
<label>32000</label>
<visible>StringCompare(ListItem.dbtype,movie) | StringCompare(ListItem.dbtype,episode)</visible>
</item>
<!-- <item library="context_menu.py">
<label>32001</label>
<visible>StringCompare(ListItem.dbtype,movie) | StringCompare(ListItem.dbtype,tvshow) | StringCompare(ListItem.dbtype,season) | StringCompare(ListItem.dbtype,episode)</visible>
</menu> -->
</menu>
</extension>
<extension point="kodi.addon.metadata">
<summary lang="en">Elementum Context Menu</summary>
Expand All @@ -30,9 +27,5 @@
<website>https://elementum.surge.sh</website>
<source>https://github.com/elgatito/context.elementum</source>
<forum></forum>
<assets>
<icon>icon.png</icon>
<fanart>fanart.jpg</fanart>
</assets>
</extension>
</addon>
6 changes: 6 additions & 0 deletions context_menu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sys
import xbmc

if __name__ == '__main__':
message = "Clicked on '%s'" % sys.listitem.getlabel()
xbmc.executebuiltin("Notification(\"Hello context items!\", \"%s\")" % message)
2 changes: 1 addition & 1 deletion context_play.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))

from context.utils import doPlay
from plugin import doPlay

if __name__ == '__main__':
doPlay()
Binary file removed fanart.jpg
Binary file not shown.
Binary file removed icon-menu.png
Binary file not shown.
Binary file removed icon.png
Binary file not shown.
Binary file removed logo.png
Binary file not shown.
21 changes: 4 additions & 17 deletions lib/context/utils.py → plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,16 @@ def doAssign():


def doPlay():
if not configureTMDB():
return

dbid = getDbId()
imdbnumber = getIMDBNumber()
mediatype = getMediaType()

xbmcgui.Dialog().notification(ADDON.getLocalizedString(32009), sys.listitem.getLabel(), xbmcgui.NOTIFICATION_INFO, 3000)

log.debug("Playing for: DBID=%s, IMDB=%s, MediaType=%s" % (dbid, imdbnumber, mediatype))

if mediatype == 'movie':
tmdb_id = getTMDBId('movie', imdbnumber)
url = "plugin://plugin.video.elementum/library/movie/play/%s" % tmdb_id
elif mediatype == 'episode':
(show_id, season_number, episode_number) = getEpisodeDetails()
tmdb_id = getTMDBId('show', show_id)
url = "plugin://plugin.video.elementum/library/show/play/%s/%s/%s" % (tmdb_id, season_number, episode_number)
log.debug("Playing for: DBID=%s, MediaType=%s" % (dbid, mediatype))

log.debug("Fetched TMDB: %s" % tmdb_id)
if tmdb_id is not None:
log.debug("Starting Elementum with: %s" % url)
xbmc.Player().play(url)
url = "plugin://plugin.video.elementum/context/%s/%s/play" % (mediatype, dbid)
log.debug("Starting Elementum with: %s" % url)
xbmc.Player().play(url)


def getDbId():
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
flake8
sphinx
sphinx-autobuild
https://github.com/romanvm/Kodistubs/tarball/master
2 changes: 1 addition & 1 deletion resources/language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ msgid "[COLOR FF46B3B3]Elementum[/COLOR] Play"
msgstr ""

msgctxt "#32001"
msgid "[COLOR FF46B3B3]Elementum[/COLOR] Season Assign"
msgid "[COLOR FF46B3B3]Elementum[/COLOR] Control"
msgstr ""

msgctxt "#32002"
Expand Down
4 changes: 2 additions & 2 deletions resources/language/Russian/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ msgid "[COLOR FF46B3B3]Elementum[/COLOR] Play"
msgstr "[COLOR FF46B3B3]Elementum[/COLOR] Воспроизвести"

msgctxt "#32001"
msgid "[COLOR FF46B3B3]Elementum[/COLOR] Season Assign"
msgstr "[COLOR FF46B3B3]Elementum[/COLOR] Выбрать стрим для сезона"
msgid "[COLOR FF46B3B3]Elementum[/COLOR] Control"
msgstr "[COLOR FF46B3B3]Elementum[/COLOR] Управление"

msgctxt "#32002"
msgid "[COLOR FF46B3B3]Elementum[/COLOR] Assign"
Expand Down

0 comments on commit 47381a8

Please sign in to comment.