If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

PHT-Problem: wrong jump after after os-functions in combination with writing to Dict

rols1rols1 Posts: 389Members ✭✭✭

in my plugin TuneIn2017 I have two functions to start and stop recordings.
In Function RecordStart I use subprocess.Popen to call the external programm streamripper. If the call is successfull I write the process-ID (and more infos) to a Dict['PID'].
Then, before given a user-info with ObjectContainer, PHT jumps back at the beginning of function RecordStart and tries calling streamripper once more.
Nice to see on the basis of timestamps in PLugin-Log.
Other Players (Web, Media Player) works fine).

The same happens in the function RecordStop. Here the jump-back occurs after os.kill and removing the process-ID from the Dict.

Did I make a mistake or do we have a special PHT-Problem?

* Linux: PMS + OpenPHT
* Windows: PMS + OpenPHT-

Code-extract RecordStart:

    call = **subprocess.Popen**(args, shell=False)      # shell=False needs shlex   
    # output,error = call.communicate()             # blocked, not needed here
    Log('call: ' + str(call))                       # Bsp. <subprocess.Popen object at 0x7f16fad2e290>
    if str(call).find('object at') > 0:             # subprocess.Popen object OK
        PID_line = '%s|%s|%s|%s'    % (call.pid, url, title_org, summ)                                                                  
        Dict['PID'].append(PID_line)                # without no PHT-Problem 
        title_new = L('Aufnahme') + ' ' + L('gestartet')
        msg =  '%s: \n %s | %s | PID: %s' % (title_new, url, summ, call.pid)
        header = L('Info')
        # at this point PHT jumps back to the start if this function. Return of 
        #   ObjectContainer is not executed.
        return ObjectContainer(header='Info', message=msg)      
        return oc

except Exception as exception:


Plugins: ARDMediathek2016, Plex-Plugin-KIKA_und_tivi, Plex-Plugin-3Sat_Mediathek, Plex-Plugin-Flickr, Plex-Plugin-TagesschauXL, Plex-Plugin-Phoenix_Mediathek, TuneIn2017
Sign In or Register to comment.