elgatito / plugin.video.elementum

Elementum add-on for Kodi. Development of this addon has been stopped!
http://elementum.surge.sh
MIT License
485 stars 159 forks source link

[Bug] Using the "Download" from contextmenu show "Playback failed" dialog #960

Open burekas7 opened 10 months ago

burekas7 commented 10 months ago

@elgatito @antonsoroko

Using the "Download" option from Elementum context menu options start downloading in the background but also shows the "Playback failed" dialog which shouldn't be shown on this option.

Kodi log debug: https://paste.ubuntu.com/p/9yj9zTRQcZ/plain


Elementum 0.1.98 Elementum Context menu: 0.0.13

antonsoroko commented 10 months ago

but also shows the "Playback failed" dialog

this is true.

which shouldn't be shown on this option.

but i am not sure that it can be easily fixed without rewriting a lot of code. for "download" we just re-use "play" code, but then we simply close the "player" immediately. see https://github.com/elgatito/elementum/blob/6aea37dab272b523d6ec42dd75ef123031e388d6/api/play.go#L119

antonsoroko commented 10 months ago

By the way, when I choose "Delete torrents and files" from context menu in the Torrents list, does it should show a dialog to confirm? Because it doesn't.

it could, but there is no such code. but i agree - it sounds like a good idea to confirm before delete real files.

burekas7 commented 10 months ago

but also shows the "Playback failed" dialog

this is true.

which shouldn't be shown on this option.

but i am not sure that it can be easily fixed without rewriting a lot of code. for "download" we just re-use "play" code, but then we simply close the "player" immediately. see https://github.com/elgatito/elementum/blob/6aea37dab272b523d6ec42dd75ef123031e388d6/api/play.go#L119

I understand.

@elgatito What do you think?

elgatito commented 10 months ago

I guess that si because context plugin is calling xbmc.Player().play(url), which expects a playback to start. So for non-playback actions it should use something else.

antonsoroko commented 5 days ago

@elgatito so i tried to use RunPlugin() to avoid this "Playback failed" message

to https://github.com/elgatito/context.elementum/blob/bb7786cb31434db42d5c770d5cea48aa82ddf576/plugin.py#L172 i added

    if action == "play":
        xbmc.Player().play(url)
    else:
        xbmc.executebuiltin('RunPlugin("%s")' % url) # to avoid "Playback failed" notification when we do not actually start playback

so it starts burst search but then it does nothing. so in log it stops after

[plugin.video.elementum] Redirecting with code 302 to: plugin://plugin.video.elementum/download?doresume=false&tmdb=1184918&type=movie&uri=magnet...
[plugin.video.elementum] Resolving TMDB item by calling http://127.0.0.1:65220/movie/1184918/infolabels for ['plugin://plugin.video.elementum/movie/1184918/download/...', '-1', '', 'resume:false']

it looks like redirect does not work with RunPlugin.

with xbmc.Player().play(url) it goes further, for example i see

CScriptRunner: running add-on script Elementum('plugin://plugin.video.elementum/download', '11', '?doresume=false&resume=...&tmdb=1184918&type=movie')

but i am not sure about this. and i am not sure how to overcome this.