Jump to content


Photo

Plugin development: get length of timeshift file


  • Please log in to reply
8 replies to this topic

#1 quad

  • Member
  • 10 posts

0
Neutral

Posted 7 February 2014 - 22:30

I'm trying to write a plugin and would like to determine the length (time duration) of the timeshift file.

 

If timeshift is enabled and I'm "in the past", the service is seekable and I can simply use something like

 

   

        service = self.session.nav.getCurrentService()
        seek = service.seek()
        length = seek.getLength()
        return int(length[1]) #pts


Unfortunately this does not work when timeshift is enabled but playing "live" at 0:00 (EOF), then the service is not seekable and the above does not work.

 

Does anyone have an idea how to get the length (time duration) of the timeshift file if the service is not seekable? - Thanks.



Re: Plugin development: get length of timeshift file #2 betacentauri

  • PLi® Core member
  • 7,185 posts

+323
Excellent

Posted 7 February 2014 - 22:47

Will be difficult to get the information. I guess you need to adapt the c++ part...


Xtrend ET-9200, ET-8000, ET-10000, OpenPliPC on Ubuntu 12.04

Re: Plugin development: get length of timeshift file #3 quad

  • Member
  • 10 posts

0
Neutral

Posted 8 February 2014 - 18:16

I'm afraid that's beyond my skills.

 

Are the file size of the timeshift file (in bytes) and the bit rate of the stream easily available for a rough estimation of the duration?



Re: Plugin development: get length of timeshift file #4 betacentauri

  • PLi® Core member
  • 7,185 posts

+323
Excellent

Posted 8 February 2014 - 18:29

Filename is available and with python you should be able to get file size. But bitrate I guess no. But perhaps somebody else with more experience can answer this
Xtrend ET-9200, ET-8000, ET-10000, OpenPliPC on Ubuntu 12.04

Re: Plugin development: get length of timeshift file #5 quad

  • Member
  • 10 posts

0
Neutral

Posted 8 February 2014 - 20:56

Thanks, sounds like a good starting point. Do you know the commands or in which class the functions are defined for getting filename and size?



Re: Plugin development: get length of timeshift file #6 betacentauri

  • PLi® Core member
  • 7,185 posts

+323
Excellent

Posted 9 February 2014 - 00:24

Here is an example:

http://sourceforge.n...oBarGenerics.py

Line 1617

http://stackoverflow...-size-in-python


Xtrend ET-9200, ET-8000, ET-10000, OpenPliPC on Ubuntu 12.04

Re: Plugin development: get length of timeshift file #7 quad

  • Member
  • 10 posts

0
Neutral

Posted 10 February 2014 - 20:47

Works perfectly, thanks a lot.



Re: Plugin development: get length of timeshift file #8 quad

  • Member
  • 10 posts

0
Neutral

Posted 16 February 2014 - 21:32

Sorry about the stupid question: What is the equivalent for getting the filename of the file currently being played (within EMC)? I found "getRecordingFilename", but from its arguments and usage I don't think this is what I need...



Re: Plugin development: get length of timeshift file #9 quad

  • Member
  • 10 posts

0
Neutral

Posted 20 February 2014 - 19:42

Ah, I think I can get the file name using

service.getPath() 



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users