Continuing service after modifying file
Continuing service after modifying file
I've added "end at this position" to the cutlist editor, which truncates the .ts file (as well as .ap & .sc). The actual truncation is working fine, but I'd like to stay in the editor and that's where I'm having problems. If I do nothing, the gauge remains at the original length. If I restart the service (stopService/playService), the gauge updates, but then the edits are skipped and the last position is saved. If I get the cuesheet again (self.session.nav.getCurrentService().cueSheet()), then playback doesn't work at all. Is this doable or should I just "and exit"?
-
- Wizard God
- Posts: 32705
- Joined: Tue Sep 04, 2007 13:49
- Location: Canberra; Black Mountain Tower transmitters
Re: Continuing service after modifying file
Am I right in thinking that you're using file.truncate()? Chopping off the file at the point where it's being played is probably going to be tricky to do. Stopping the service is probably the right thing to do, but you should probably leave it stopped. I'm not sure I quite understand what happens after you restart it.adoxa wrote:... If I do nothing, the gauge remains at the original length. If I restart the service (stopService/playService), the gauge updates, but then the edits are skipped and the last position is saved.
I'd have thought that fetching the cue sheet reference again wouldn't change anything unless the new fetch returned None. You can compare the actual memory addresses of the C++ cue sheet objects with:adoxa wrote:If I get the cuesheet again (self.session.nav.getCurrentService().cueSheet()), then playback doesn't work at all. Is this doable or should I just "and exit"?
Code: Select all
oldCueSheet = self.cueSheet # or wherever it is
self.cueSheet = self.session.nav.getCurrentService().cueSheet()
print "Cue sheets old, new:", oldCueSheet.getPtrString(), self.cueSheet.getPtrString() # It returns an integer, not a string. See lib/base/smartptr.h
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
Re: Continuing service after modifying file
I adapted mcut, so ftruncate, but the principle's the same. Surprisingly, truncation was successful whilst playing, but nothing recognised the new length (but I didn't expect it to).prl wrote:Am I right in thinking that you're using file.truncate()? Chopping off the file at the point where it's being played is probably going to be tricky to do.
I stop it, then execute a program with eConsoleAppContainer, using its callback to restart it. That works fine, apart from not being able to disable the cuts again (setCutListEnable), so the cuts are skipped and the last position is saved.prl wrote:Stopping the service is probably the right thing to do, but you should probably leave it stopped. I'm not sure I quite understand what happens after you restart it.
The pointers are different. The log has "[eDVBVideo0] VIDEO_PLAY failed: Operation not permitted". It still starts at the initial in cut and pauses, and I can still toggle a mark and remove before/after, but none of the play/skip functions work.prl wrote:I'd have thought that fetching the cue sheet reference again wouldn't change anything unless the new fetch returned None. You can compare the actual memory addresses of the C++ cue sheet objects...
Re: Continuing service after modifying file
It's not related to the console callback, as it happens when I stop & start from __init__:
[/size]
That will seek, but remove the comment from the last line and seeking is disabled, even if the first self.cue is commented.
Code: Select all
session.nav.playService(service)
self.pauseService()
cur_service = session.nav.getCurrentService()
self.cue = cur_service and cur_service.cueSheet()
session.nav.stopService()
session.nav.playService(service)
self.pauseService()
service = session.nav.getCurrentService()
#self.cue = service and service.cueSheet()
That will seek, but remove the comment from the last line and seeking is disabled, even if the first self.cue is commented.
Re: Continuing service after modifying file
Getting the service and cuesheet each time solves the problem, so now I set the cutlist state from a function, rather than storing the cuesheet directly:
[/size]
Code: Select all
def setCutListEnable(self):
service = self.session.nav.getCurrentService()
cue = service and service.cueSheet()
if cue is not None:
cue.setCutListEnable(self.cut_state)