# Adapted from: merge 1.03a (c)2002 embeem if {[info exists allow_merge] && $allow_merge == 1} { proc action_merge {chan path env} { global db set recfsids "" if {[string index $path 0] == "/"} { set path [string range $path 1 end] } set firstslash [string first "/" $path] set recfsids [string range $path [expr $firstslash + 1] end] eval $env set rlist [lsort -dictionary -decreasing [info vars "fsid_*"]] foreach rec $rlist { lappend recfsids [lindex [split $rec "_"] 2] } puts $chan [html_start "Merge Recordings (by embeem)"] if { $recfsids == "" } { puts $chan "

ERROR: Not allowed to make empty recordings

" } else { puts $chan "

Creating Multipart Recording

" set today [expr [clock seconds] / 86400] set now [expr [clock seconds] % 86400 + 10] RetryTransaction { set duration 0 set newtitle "" set parttime 0 set multirec [db $db create Recording] #puts "merged obj: [dbobj $multirec fsid]/[dbobj $multirec subobjid]" dbobj $multirec set BitRate 0 ;# obsolete dbobj $multirec set ErrorString "Multipart recording (embeem)" dbobj $multirec set RecordQuality 100 dbobj $multirec set Score 0 dbobj $multirec set SelectionType 3 dbobj $multirec set State 4 ;# complete foreach recording $recfsids { set recording [db $db openid $recording] set showing [dbobj $recording get Showing] set parts [dbobj $recording get Part] foreach part $parts { set multipart [db $db createsub RecordingPart $multirec] dbobj $multipart copyfrom $part dbobj $multipart set Begin $parttime set elapsed [expr [dbobj $part get End] - [dbobj $part get Begin]] incr parttime $elapsed dbobj $multipart set End $parttime dbobj $multirec add Part $multipart } incr duration [defaultval 0 [dbobj $recording get StartPadding]] incr duration [dbobj $showing get Duration] incr duration [defaultval 0 [dbobj $recording get EndPadding]] set program [dbobj $showing get Program] set title [strim [dbobj $program get Title]] set eptitle [strim [dbobj $program get EpisodeTitle]] if {$eptitle != ""} { set title "$title : $eptitle\n" } set newtitle "$newtitle$title\n" puts $chan "Added - $title
" } dbobj $multirec set StartDate $today dbobj $multirec set StartTime [expr $now - $duration] dbobj $multirec set StopDate $today dbobj $multirec set StopTime $now dbobj $multirec set ExpirationDate [expr $today + 2] dbobj $multirec set ExpirationTime $now set series [db $db create Series] dbobj $series set Title "Multipart" set program [db $db create Program] dbobj $program set Title "Multipart" dbobj $program set Description "$newtitle" dbobj $program set IsEpisode 0 dbobj $program set Series $series set station [db $db create Station] dbobj $station set CallSign "Multipart" dbobj $station set Name "n/a" set showing [db $db createsub Showing $multirec] dbobj $showing set Date $today dbobj $showing set Duration $duration dbobj $showing set Time [expr $now - $duration] dbobj $showing set Program $program dbobj $showing set Station $station dbobj $multirec set Showing $showing dbobj $multirec set ActualShowing $showing if { $::version3 } { # Only needed for 3.x and above dbobj $multirec set StreamFileSize 0 dbobj $multirec set UsedBy 1 set recordingbehavior [db $db createsub RecordingBehavior $multirec] dbobj $recordingbehavior set DiskBehavior 7 dbobj $recordingbehavior set PresentationBehavior 1 dbobj $recordingbehavior set ProgramGuideBehavior 1 dbobj $recordingbehavior set TunerBehavior 1 dbobj $multirec set RecordingBehavior $recordingbehavior } } if {$::version < 6} { event send $TmkEvent::EVT_DATA_CHANGED $TmkDataChanged::RECORDINGS_ON_DISK 0 } } puts $chan "

Multipart recording has been created.

" puts $chan {


These recordings don't work well unless you just play the recording and 'leave it alone'.

While the total length is correct (5x 1/2 hour shows = 2:30), the progress bar makes it look like a partial recording, with only the first 1/2 hour being green. Then, when it reaches the end of the first 1/2 hour, the second 1/2 hour starts to play, but the progress bar "loops". If you stop playing, and then later resume, it will jump to that same point, but only in the first clip. So, if you are 15 minutes into program 2, then stop, and resume later, it starts playing 15 minutes into program 1. If you fastforward/rewind/skip (and maybe pause) the merged recording will not play properly. The merged recording is more of a playlist. It doesn't actually take more space, so don't merge recordings then delete the individual shows and expect it to work.


} puts $chan [html_link "/nowshowing" "Return to Now Playing"] puts $chan [html_end] } }