jurialmunkey / plugin.video.themoviedb.helper

GNU General Public License v3.0
211 stars 96 forks source link

[Request] Create plexkodiconnect player #50

Closed webmaher closed 4 years ago

webmaher commented 4 years ago

I try to create plexkodiconnect player to play all movies and tvshows which i added with TMD helper to my library...

plexkodiconnect.json in folder players

{

 "name"         : "plexkodiconnect",
 "plugin"       : "plugin.video.plexkodiconnect",

  "play_movie"        : [
                            "plugin://plugin.video.plexkodiconnect/search/search/{title}/",
                            {"title": "{title}", "year": "{year}"}
                          ],
    "play_episode"      : [
                            "plugin://plugin.video.plexkodiconnect/directory/search/search/{showname}/",
                            {"title": "{showname}"},
                            {"position": "{season}"},
                            {"season": "{season}", "episode": "{episode}"}
                          ],
    "search_movie"      : "plugin://plugin.video.plexkodiconnect/directory/search/search/{title}/",
    "search_episode"    : "plugin://plugin.video.plexkodiconnect/directory/search/search/{showname}/"

}

and this is my settings.xml file

<settings version="2">
    <setting id="bundled_players">true</setting>
    <setting id="cache_details_days" default="true">0</setting>
    <setting id="cache_list_days" default="true">0</setting>
    <setting id="debug_logging" default="true">false</setting>
    <setting id="default_player_episodes" default="true">plexkodiconnect</setting>
    <setting id="default_player_movies" default="true">plexkodiconnect</setting>
    <setting id="fanarttv_apikey" default="true"></setting>
    <setting id="fanarttv_clientkey" default="true"></setting>
    <setting id="fanarttv_lookup" default="true">false</setting>
    <setting id="fuzzymatch_movie" default="true">false</setting>
    <setting id="fuzzymatch_tv" default="true">false</setting>
    <setting id="hide_unaired" default="true">false</setting>
    <setting id="language">18</setting>
    <setting id="local_db">true</setting>
    <setting id="mpaa_prefix" default="true">Rated </setting>
    <setting id="omdb_apikey" default="true"></setting>
    <setting id="players_url">http://bit.ly/openplayers</setting>
    <setting id="select_action" default="true">0</setting>
    <setting id="tmdb_apikey" default="true"></setting>
    <setting id="trakt_management">true</setting>
    <setting id="trakt_token" default="true">xxxxxx</setting>
    <setting id="trakt_unwatchedcounts">true</setting>
    <setting id="trakt_watchedindicators">true</setting>
    <setting id="widget_fanarttv_lookup" default="true">false</setting>
</settings>

and this is ERROR:

2020-01-19 16:41:41.535 T:1332   ERROR: Playlist Player: skipping unplayable item: 0, path [C:\Users\Jan\AppData\Roaming\Kodi\userdata\addon_data\plugin.video.themoviedb.helper\movies\Gemini Man (2019)\Gemini Man (2019).strm]
2020-01-19 16:41:41.913 T:35996   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.ValueError'>
                                            Error Contents: Expecting , delimiter: line 3 column 20 (char 135)
                                            Traceback (most recent call last):
                                              File "C:\Users\Jan\AppData\Roaming\Kodi\addons\plugin.video.themoviedb.helper\script.py", line 10, in <module>
                                                TMDbScript.router()
                                              File "C:\Users\Jan\AppData\Roaming\Kodi\addons\plugin.video.themoviedb.helper\resources\lib\script.py", line 387, in router
                                                self.play()
                                              File "C:\Users\Jan\AppData\Roaming\Kodi\addons\plugin.video.themoviedb.helper\resources\lib\script.py", line 324, in play
                                                season=self.params.get('season'), episode=self.params.get('episode'))
                                              File "C:\Users\Jan\AppData\Roaming\Kodi\addons\plugin.video.themoviedb.helper\resources\lib\player.py", line 130, in play
                                                self.setup_players(details=True)
                                              File "C:\Users\Jan\AppData\Roaming\Kodi\addons\plugin.video.themoviedb.helper\resources\lib\player.py", line 36, in setup_players
                                                self.build_players(tmdbtype)
                                              File "C:\Users\Jan\AppData\Roaming\Kodi\addons\plugin.video.themoviedb.helper\resources\lib\player.py", line 195, in build_players
                                                meta = loads(content) or {}
                                              File "C:\Program Files\Kodi\system\python\Lib\json\__init__.py", line 339, in loads
                                                return _default_decoder.decode(s)
                                              File "C:\Program Files\Kodi\system\python\Lib\json\decoder.py", line 364, in decode
                                                obj, end = self.raw_decode(s, idx=_w(s, 0).end())
                                              File "C:\Program Files\Kodi\system\python\Lib\json\decoder.py", line 380, in raw_decode
                                                obj, end = self.scan_once(s, idx)
                                            ValueError: Expecting , delimiter: line 3 column 20 (char 135)
                                            -->End of Python script error report<--
drinfernoo commented 4 years ago

The error suggests you're missing a , somewhere.

webmaher commented 4 years ago

i really dont know in which file i can find this error and why:

Error Type: <type 'exceptions.ValueError'> Error Contents: Expecting , delimiter: line 3 column 20 (char 135)

in file plexikodiconnect.json i think not ... i look also this but i dont understand much because im not a programmer https://github.com/jurialmunkey/plugin.video.themoviedb.helper/wiki/Player-Function Can please somebody help me :-(

jurialmunkey commented 4 years ago

Copying the Netflix player and just changing the plugin name is not going to work. You need to find out what the path is that the plugin uses for searching and then create steps that are appropriate.

jurialmunkey commented 4 years ago

Also, for future issues, please format your code blocks correctly by using three backticks so that it is readable. One backtick is only used for inline code - using it for multiline makes an unreadable mess.

E.g. ``` Code goes here Code goes here Code goes here ```

Code goes here
Code goes here
Code goes here
webmaher commented 4 years ago

I really dont know how to do that so please help :-( Here is code from plexkodiconnect.json for OpenMeta which work:

{
 "name"         : "PlexKodiConnect",
 "plugin"       : "plugin.video.plexkodiconnect",
 "priority"     : 200,
 "id"           : "plexkodiconnect",
 "filters"      : {},
 "postprocess"  : "",
 "movies"       : [
  [
   {
    "link"      : "plugin://plugin.video.plexkodiconnect/?mode=browseplex&key=%2fhubs%2fsearch%3ftype%3d1&prompt=Search+Movie",
    "steps"     : [
     "@keyboard:{realtitle}",
     "{realtitle} .{year}."
     ],
    "action"    : "PLAY"
   },
   {
    "link"      : "plugin://plugin.video.plexkodiconnect/?mode=browseplex&key=%2fhubs%2fsearch%3ftype%3d1&prompt=Search+Movie",
    "steps"     : [
     "@keyboard:{realtitle}",
     "{realtitle}"
     ],
    "action"    : "PLAY"
   }
  ]
 ],
 "tvshows"      : [
  [
   {
    "link"      : "plugin://plugin.video.plexkodiconnect/?mode=browseplex&key=%2fhubs%2fsearch%3ftype%3d2&prompt=Search+TVShow",
    "steps"     : [
     "@keyboard:{realname}",
     "{realname} .{year}.",
     ".* {season}",
     "{title}"
     ],
    "action"    : "PLAY"
   },
   {
    "link"      : "plugin://plugin.video.plexkodiconnect/?mode=browseplex&key=%2fhubs%2fsearch%3ftype%3d2&prompt=Search+TVShow",
    "steps"     : [
     "@keyboard:{realname}",
     "{realname} .{year}.",
     ".* {season}",
     "{season}x{episode}"
     ],
    "action"    : "PLAY"
   },
   {
    "link"      : "plugin://plugin.video.plexkodiconnect/?mode=browseplex&key=%2fhubs%2fsearch%3ftype%3d2&prompt=Search+TVShow",
    "steps"     : [
     "@keyboard:{realname}",
     "{realname}",
     ".* {season}",
     "{title}"
     ],
    "action"    : "PLAY"
   },
   {
    "link"      : "plugin://plugin.video.plexkodiconnect/?mode=browseplex&key=%2fhubs%2fsearch%3ftype%3d2&prompt=Search+TVShow",
    "steps"     : [
     "@keyboard:{realname}",
     "{realname}",
     ".* {season}",
     "{season}x{episode}"
     ],
    "action"    : "PLAY"
   }
  ]
 ]
}
webmaher commented 4 years ago

Copying the Netflix player and just changing the plugin name is not going to work. You need to find out what the path is that the plugin uses for searching and then create steps that are appropriate.

I put this in c:\Users\Jan\AppData\Roaming\Kodi\addons\plugin.video.themoviedb.helper\resources\players\ and delete Netflix and Youtube players....

Go to my movies or series library and start to play ...pop up window appear with two options: 1) - Play with PlexKodiConnect 2) - Search PlexKodiConnect

enter option 1 nothing happen and pop up window appear again but now only with option 2

I enter and my main plex folder is open and then i can go in any folders i want and start to play what i want...

For now im happy with that :-) I hope that @croneter help you soon...

webmaher commented 4 years ago

@jurialmunkey can you please contact @croneter and ask him when we can see some progress...

jurialmunkey commented 4 years ago

@jurialmunkey can you please contact @croneter and ask him when we can see some progress...

Why don't you?

I'm not interested in bugging him as this isn't a priority issue for me since I don't use PKC. Croneter hasn't made any updates to PKC in a few months, so clearly he's busy with other things.

webmaher commented 4 years ago

He just did it :-) https://github.com/croneter/PlexKodiConnect/issues/1103

@webmaher , @jurialmunkey Try PKC BETA version 2.10.9. Your search string would need to look like this:

plugin://plugin.video.plexkodiconnect?mode=search&query=YOUR SEARCH STRING HERE

Can you please make a test player :-)

jurialmunkey commented 4 years ago

@webmaher - Can you test the below player with the PKC beta? I have no idea if it will work since I don't use PKC but hopefully it will...

{
    "name"              : "PlexKodiConnect",
    "plugin"            : "plugin.video.plexkodiconnect",
    "priority"          : 500,
    "play_movie"        : [
                            "plugin://plugin.video.plexkodiconnect?mode=search&query={title}",
                            {"title": "{title}", "year": "{year}"}
                          ],
    "play_episode"      : [
                            "plugin://plugin.video.plexkodiconnect?mode=search&query={showname}",
                            {"title": "{showname}"},
                            {"season": "{season}"},
                            {"season": "{season}", "episode": "{episode}"}
                          ],
    "search_movie"      : "plugin://plugin.video.plexkodiconnect?mode=search&query={title}",
    "search_episode"    : "plugin://plugin.video.plexkodiconnect?mode=search&query={showname}"
}

If the above doesn't work for play, can you get me screenshots of what happens when you use the search function for each of the movies and episodes search (preferably with a media view that shows a lot of information). In particular, I'm interested in how tvshows are navigated (e.g. does the search show tvshow names or episodes, and what happens when you click on tvshows and each step to get to the episode from the search results).

webmaher commented 4 years ago

Thanks 4 this beta version :-)

just a few things about my plex

i have over 10 folders .... For movies now i have 3:

I tested a few movies and when I got 3 hits with exactly the same title (is any chance to see also folder name after title name) first one is from folder Movies, then Movies - 4K and last from Movies - 4K Remux

Then i try with Play PKC and always started movie from folder Movies Is possible create priority rules from which folder Play PKC must start first, second, third...

And now shows... i have 2 folders:

i tested with Search PKC series:

Always found 2 hits from both folders with exactly the same showtitle names (Witcher and The Widow which probably not so good because i start S01E01) first one is from folder Series and second one from Series - 4K When push enter i see folder Season 1 and push again to see all episodes...

Then i try play both series S01E01 with Play PKC and always started from folder Series Is possible create priority rules from which folder Play PKC must start first, second...

This is my Path in library: D:\01koditeka\serije\The Witcher\Season 1\S01E01 - The Ends Beginning.strm

filename in my Plex: The Widow 2019 - S01E01 - Mr. Tequila The Witcher - S01E01 - The Ends Beginning

So if any chance to improve search PKC series to find alway episode which we start from library and of course priority rules ...

For start this is very good because and you even not have Plex ..

Thanks again 4 all your help :-)

jurialmunkey commented 4 years ago

You would need something in the title of the Movie/Show which indicates what folder it is from. Otherwise, how would TMDbHelper know what folder it is from if all the info it is presented is exactly the same?

For instance, if you have the title of the 4k version of Alien as "Alien (4K)" then you could do:

{"title": "{title} (4K)", "year": "{year}"}

Alternatively, if you can recreate the exact path to the file consistently, then you can check against file instead:

{"file": "/Path/To/Plex/Kodi/Connect/Movies - 4K/{title}.mkv"}

I have no idea what the path would be - you will need to figure that out yourself. Also, you would need to have very consistent file naming with all the exact same file extensions and so on, so probably not a solution.

Other alternative is to rename your folders so that your preferences have priority by being the first item alphabetically. I imagine "Movies" provides first results because it comes alphabetically before "Movies- 4K". If you rename the "Movies" folder to "Movies - SD" then it will comes after "Movies - 4K" alphabetically, and so won't be chosen first.

Claw256 commented 3 years ago

Just wondering, why is this issue closed if a PKC player is not implemented?

croneter commented 3 years ago

@Claw256 but it is implemented, see 2nd last post by @jurialmunkey

Claw256 commented 3 years ago

@Claw256 but it is implemented, see 2nd last post by @jurialmunkey

Hi, I saw that indeed. Please see here for more info on why I posted that comment here: https://github.com/croneter/PlexKodiConnect/issues/1323

drinfernoo commented 3 years ago

I'm sure that if a 100% working player was created, @jurialmunkey could be persuaded to merge an appropriate PR 😉 He doesn't have to do all the work here, guys... this isn't business, it's open source 👍

Claw256 commented 3 years ago

I'm sure that if a 100% working player was created, @jurialmunkey could be persuaded to merge an appropriate PR 😉 He doesn't have to do all the work here, guys... this isn't business, it's open source 👍

Just wondering, were you refering to me when you said if a working player was created? Because I honestly have no idea what I am doing.

drinfernoo commented 3 years ago

Well, anyone 😅

jurialmunkey commented 3 years ago

Yep happy to merge a PR for a working PKC player.

I don't use PKC (because I don't use Plex) so I can't possibly make a player myself since it is impossible for me to test. I even gave some base code to get someone started If a PKC user makes a player and confirms it works, then I'd be happy to merge in a PR.

itinerantmarshmallow commented 7 months ago

I can help at least to confirm for the search player provided.

Device: Nvidia Shield PKC Path Type: Addon

I created a player json file using jurial's code above and set it up in the players folder in my device and then set it as the active player in TMDB Helper.

I selected a movie on Tmdb Helper widget for a known movie in my Plex Server and the movie was returned in a list, it was the only option but I assume other movies could be returned if sharing the same or similar file name. I was able to successfully play the movie from there.

I then clicked play on a movie not in my plex server and random results are returned that most closely match the search term.

I've included some very brief log snippets from the search, I can likely provide more verbose or the full log if it was useful to anyone.

info <general>: [plugin.video.themoviedb.helper] lib.player - executing action: Container.Update(plugin://plugin.video.plexkodiconnect?mode=search&query=Dune)

error <general>: GetItemsForPlayList: Unable to get playlist items for plugin://plugin.video.plexkodiconnect.movies/?mode=play&plex_id=419&plex_type=movie&filename=Dune (2021) Remux-2160p.mkv