Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prt sessions command reports NONE for file #58

Open
shushry opened this issue Apr 28, 2017 · 2 comments
Open

prt sessions command reports NONE for file #58

shushry opened this issue Apr 28, 2017 · 2 comments

Comments

@shushry
Copy link

shushry commented Apr 28, 2017

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

@shushry shushry changed the title prt sessions command reports NONE for filen prt sessions command reports NONE for file Apr 28, 2017
@rendragnet
Copy link

rendragnet commented Nov 16, 2019

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
Copy link
Collaborator

liviynz commented Nov 17, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants