wnielson / Plex-Remote-Transcoder

A distributed transcoding backend for Plex
MIT License
640 stars 59 forks source link

prt sessions command reports NONE for file #58

Open shushry opened 7 years ago

shushry commented 7 years ago

prt 0.4.3 pms 1.6.x

prt sessions command reports "None" for the file for each session, but otherwise reports the correct number of sessions in flight. Pretty low priority and non critical, but nice to fix.

Sample output:

Session 1/1 Host: xxxxxxxxxxxx File: None

rendragnet commented 4 years ago

The plex sessions XML no longer includes a filename. I've modified my prt.py to instead show the title/etc so at least you still mostly know what's being transcoded (Doesn't help if there's multiple files for the same Title though. The other hiccup is they've also changed the format of the key field in the TranscodeSession node - it now has /transcodes/session/ prepended to the key

I'm now getting the following output in mine:

plex@plex:~$ prt sessions Session 1/2 Host: 192.168.103.218 Name: TV Shows, Hawaii Five-0 - Season 10 - Ne'e aku, ne'e mai ke one o Punahoa User: Rendrag Session 2/2 Host: 192.168.103.217 Name: Movies, The Boss Baby User: Rendrag

The diff for my changes is:

@@ -457,8 +457,11 @@ def get_plex_sessions(auth_token=None):
     for node in dom.findall('.//Video'):
         session_id = et_get(node.find('.//TranscodeSession'), 'key')
         if session_id:
+            titlePath = et_get(node, 'grandparentTitle', '') + ' - ' + et_get(node, 'parentTitle', '') + ' - '
+            titlePath = (titlePath, '') [ titlePath==' -  - ' ]
             sessions[session_id] = {
-                'file': et_get(node.find('.//Media/Part'), 'file')
+                'name': et_get(node, 'librarySectionTitle') +  ', ' + titlePath + et_get(node, 'title', ''),
+                'user': et_get(node.find('.//User'), 'title')
         }
     return sessions

@@ -498,7 +501,7 @@ def get_sessions():
                 session_id = re_get(SESSION_RE, cmdline)
                 data = {
                     'proc': pinfo,
-                    'plex': plex_sessions.get(session_id, {}),
+                    'plex': plex_sessions.get('/transcode/sessions/' + session_id, {}),
                     'host': {}
                 }

@@ -606,7 +609,8 @@ def sessions():
     for i, (session_id, session) in enumerate(sessions.items()):
         print "Session %s/%s" % (i+1, len(sessions))
         print "  Host: %s" % session.get('host', {}).get('address')
-        print "  File: %s" % session.get('plex', {}).get('file')
+        print "  Name: %s" % session.get('plex', {}).get('name')
+        print "  User: %s" % session.get('plex', {}).get('user')

maybe wnielson could incorporate something like this into prt proper? :)

liviynz commented 4 years ago

Looks good. I really need to find some time to finish my update as it covers the readme and redoes all the self diag. I did manage to manually get the Easy Audio to cluster too but it’s a little buggy. I also want to include the admin transcodes from scans and do the groups for the clustering so you can have particular transcodes going to specific nodes.

On 17/11/2019, at 12:01, Damien Gardner notifications@github.com wrote:

The plex sessions XML no longer includes a filename. I've modified my prt.py to instead show the title/etc so at least you still mostly know what's being transcoded (Doesn't help if there's multiple files for the same Title though. The other hiccup is they've also changed the format of the key field in the TranscodeSession node - it now has /transcodes/session/ prepended to the key

I'm now getting the following output in mine:

plex@plex:~$ prt sessions Session 1/2 Host: 192.168.103.218 Name: TV Shows, Hawaii Five-0 - Season 10 - Ne'e aku, ne'e mai ke one o Punahoa User: Rendrag Session 2/2 Host: 192.168.103.217 Name: Movies, The Boss Baby User: Rendrag

The diff for my changes is: @@ -457,8 +457,11 @@ def get_plex_sessions(auth_token=None): for node in dom.findall('.//Video'): session_id = et_get(node.find('.//TranscodeSession'), 'key') if session_id:

   titlePath = et_get(node, 'grandparentTitle', '') + ' - ' + et_get(node, 'parentTitle', '') + ' - '
   titlePath = (titlePath, '') [ titlePath==' -  - ' ]
   sessions[session_id] = {
       'file': et_get(node.find('.//Media/Part'), 'file')
       'name': et_get(node, 'librarySectionTitle') +  ', ' + titlePath + et_get(node, 'title', ''),
       'user': et_get(node.find('.//User'), 'title')

} return sessions @@ -498,7 +501,7 @@ def get_sessions(): session_id = re_get(SESSION_RE, cmdline) data = { 'proc': pinfo,

           'plex': plex_sessions.get(session_id, {}),
           'plex': plex_sessions.get('/transcode/sessions/' + session_id, {}),
           'host': {}
       }

@@ -606,7 +609,8 @@ def sessions(): for i, (session_id, session) in enumerate(sessions.items()): print "Session %s/%s" % (i+1, len(sessions)) print " Host: %s" % session.get('host', {}).get('address')

print " File: %s" % session.get('plex', {}).get('file') print " Name: %s" % session.get('plex', {}).get('name') print " User: %s" % session.get('plex', {}).get('user') maybe wnielson could incorporate something like this into prt proper? :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.