Ticket #3788: expire_not_delete.3.diff
File expire_not_delete.3.diff, 11.2 KB (added by , 17 years ago) |
---|
-
mythplugins/mythweb/modules/tv/tmpl/default/recorded.php
337 337 if ($show->can_delete) { 338 338 ?><a onclick="javascript:confirm_delete(<?php echo $row ?>, false)" 339 339 title="<?php echo html_entities(t('Delete $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>" 340 ><?php echo t('Delete') ?></a> 340 ><?php if (get_backend_setting('AutoExpireInsteadOfDelete') > 0 && 341 $show->recgroup == 'Deleted') 342 echo t('Delete Forever'); 343 else 344 echo t('Delete'); 345 ?></a> 341 346 <a onclick="javascript:confirm_delete(<?php echo $row ?>, true)" 342 347 title="<?php echo html_entities(t('Delete and allow rerecord: $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>" 343 348 ><?php echo t('Delete + Rerecord') ?></a> 349 350 <?php if ($show->recgroup == 'Deleted') { 351 echo '<a href="', root, 'tv/recorded?undelete=yes&chanid=', $show->chanid, 352 '&starttime=', $show->starttime, '" ' ?> 353 title="<?php echo html_entities(t('Undelete: $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>" 354 <?php echo '>' , t('Undelete') ?></a> 355 <?php } ?> 344 356 <?php } ?> 345 357 </td> 346 358 </tr><tr id="statusrow_<?php echo $row ?>" class="recorded"> -
mythplugins/mythweb/modules/tv/recorded.php
19 19 // Load the sorting routines 20 20 require_once 'includes/sorting.php'; 21 21 22 // Delete a program?22 // Delete or undelete a program? 23 23 isset($_GET['forget_old']) or $_GET['forget_old'] = $_POST['forget_old']; 24 24 isset($_GET['delete']) or $_GET['delete'] = $_POST['delete']; 25 25 isset($_GET['file']) or $_GET['file'] = $_POST['file']; 26 if ($_GET['delete']) { 26 if ($_GET['delete'] || $_GET['undelete']) { 27 if ($_GET['delete']) 28 $backendstr = 'DELETE_RECORDING'; 29 else 30 $backendstr = 'UNDELETE_RECORDING'; 27 31 // Keep a previous-row counter to return to after deleting 28 32 $prev_row = -2; 29 33 // We need to scan through the available recordings to get at the additional information required by the DELETE_RECORDING query … … 35 39 if ($row[4] != $_GET['chanid'] || $row[26] != $_GET['starttime']) 36 40 continue; 37 41 // Delete the recording 38 backend_command(array( 'FORCE_DELETE_RECORDING', implode(backend_sep, $row), '0'));42 backend_command(array($backendstr, implode(backend_sep, $row), '0')); 39 43 // Forget all knowledge of old recordings? 40 44 if (isset($_GET['forget_old'])) { 41 45 backend_command(array('FORGET_RECORDING', implode(backend_sep, $row), '0')); … … 105 109 // keep track of their names and how many episodes we have recorded 106 110 $Total_Programs++; 107 111 $Groups[$record[30]]++; 108 // Hide LiveTV recordings from the title list109 if (($_GET['recgroup'] && $_GET['recgroup'] == $record[30]) || (!$_GET['recgroup'] && $record[30] != 'LiveTV' ))112 // Hide LiveTV and Deleted recordings from the title list 113 if (($_GET['recgroup'] && $_GET['recgroup'] == $record[30]) || (!$_GET['recgroup'] && $record[30] != 'LiveTV' && $record[30] != 'Deleted')) 110 114 $Program_Titles[$record[0]]++; 111 115 // Skip files with no chanid 112 116 if (!$record[4]) … … 116 120 continue; 117 121 if ($_GET['recgroup'] && $_GET['recgroup'] != $record[30]) 118 122 continue; 119 // Hide livetvrecordings from the default view120 if (empty($_GET['recgroup']) && $record[30] == 'LiveTV')123 // Hide LiveTV recordings from the default view 124 if (empty($_GET['recgroup']) && ($record[30] == 'LiveTV' || $record[30] == 'Deleted')) 121 125 continue; 122 126 // Make sure that everything we're dealing with is an array 123 127 if (!is_array($Programs[$record[0]])) -
mythtv/programs/mythfrontend/playbackbox.cpp
1664 1664 p = *i; 1665 1665 if ((((p->recgroup == recGroup) || 1666 1666 ((recGroup == "All Programs") && 1667 (p->recgroup != "Deleted") && 1667 1668 (p->recgroup != "LiveTV" || LiveTVInAllPrograms))) && 1668 1669 (recGroupPassword == curGroupPassword)) || 1669 1670 ((recGroupType[recGroup] == "category") && … … 2304 2305 if (!curitem) 2305 2306 return; 2306 2307 2307 if ((curitem->availableStatus != asPendingDelete) && 2308 bool undelete_possible = 2309 gContext->GetNumSetting("AutoExpireInsteadOfDelete", 0); 2310 2311 if (curitem->recgroup != "Deleted" && undelete_possible) 2312 doRemove(curitem, false, false); 2313 else if ((curitem->availableStatus != asPendingDelete) && 2308 2314 (REC_CAN_BE_DELETED(curitem))) 2309 2315 remove(curitem); 2310 2316 else … … 3174 3180 popup->addButton(tr("Job Options"), this, SLOT(showJobPopup())); 3175 3181 3176 3182 if (!(m_player && m_player->IsSameProgram(curitem))) 3177 popup->addButton(tr("Delete"), this, SLOT(askDelete())); 3183 { 3184 if (curitem->recgroup == "Deleted") 3185 { 3186 popup->addButton(tr("Undelete"), this, 3187 SLOT(doUndelete())); 3188 popup->addButton(tr("Delete Forever"), this, 3189 SLOT(doDelete())); 3190 } 3191 else 3192 { 3193 popup->addButton(tr("Delete"), this, 3194 SLOT(askDelete())); 3195 } 3196 } 3178 3197 3179 3198 popup->ShowPopup(this, SLOT(doCancel())); 3180 3199 … … 3522 3541 playList.clear(); 3523 3542 } 3524 3543 3544 void PlaybackBox::doUndelete(void) 3545 { 3546 if (!expectingPopup) 3547 { 3548 previewSuspend = false; 3549 return; 3550 } 3551 3552 cancelPopup(); 3553 RemoteUndeleteRecording(curitem); 3554 } 3555 3525 3556 void PlaybackBox::doDelete(void) 3526 3557 { 3527 3558 if (!expectingPopup) -
mythtv/programs/mythfrontend/globalsettings.cpp
577 577 return bs; 578 578 }; 579 579 580 static GlobalCheckBox *AutoExpireInsteadOfDelete() 581 { 582 GlobalCheckBox *cb = new GlobalCheckBox("AutoExpireInsteadOfDelete"); 583 cb->setLabel(QObject::tr("Auto Expire Instead of Delete Recording")); 584 cb->setValue(false); 585 cb->setHelpText(QObject::tr("Instead of deleting a recording, " 586 "move recording to the 'Deleted' recgroup " 587 "and turn on autoexpire.")); 588 return cb; 589 } 590 580 591 static GlobalComboBox *AutoExpireMethod() 581 592 { 582 593 GlobalComboBox *bc = new GlobalComboBox("AutoExpireMethod"); … … 3823 3834 autoexp->addChild(AutoExpireLiveTVMaxAge()); 3824 3835 autoexp->addChild(RerecordWatched()); 3825 3836 autoexp->addChild(AutoExpireExtraSpace()); 3837 autoexp->addChild(AutoExpireInsteadOfDelete()); 3826 3838 addChild(autoexp); 3827 3839 3828 3840 VerticalConfigurationGroup* jobs = new VerticalConfigurationGroup(false); -
mythtv/programs/mythfrontend/playbackbox.h
160 160 void doEditScheduled(); 161 161 162 162 void askDelete(); 163 void doUndelete(); 163 164 void doDelete(); 164 165 void doDeleteForgetHistory(); 165 166 void doForceDelete(); -
mythtv/programs/mythbackend/mainserver.h
80 80 bool forceMetadataDelete); 81 81 void DoHandleDeleteRecording(ProgramInfo *pginfo, PlaybackSock *pbs, 82 82 bool forceMetadataDelete); 83 void HandleUndeleteRecording(QStringList &slist, PlaybackSock *pbs); 84 void DoHandleUndeleteRecording(ProgramInfo *pginfo, PlaybackSock *pbs); 83 85 void HandleForgetRecording(QStringList &slist, PlaybackSock *pbs); 84 86 void HandleRescheduleRecordings(int recordid, PlaybackSock *pbs); 85 87 void HandleQueryFreeSpace(PlaybackSock *pbs, bool allBackends); -
mythtv/programs/mythbackend/mainserver.cpp
396 396 { 397 397 HandleDeleteRecording(listline, pbs, true); 398 398 } 399 else if (command == "UNDELETE_RECORDING") 400 { 401 HandleUndeleteRecording(listline, pbs); 402 } 399 403 else if (command == "RESCHEDULE_RECORDINGS") 400 404 { 401 405 if (tokens.size() != 2) … … 1916 1920 if (pbs) 1917 1921 pbssock = pbs->getSocket(); 1918 1922 1923 bool justexpire = 1924 (gContext->GetNumSetting("AutoExpireInsteadOfDelete") && 1925 (pginfo->recgroup != "Deleted") && (pginfo->recgroup != "LiveTV")); 1926 1927 if (justexpire && !forceMetadataDelete) 1928 { 1929 pginfo->ApplyRecordRecGroupChange("Deleted"); 1930 pginfo->SetAutoExpire(kDeletedAutoExpire); 1931 if (pginfo->recstatus == rsRecording) 1932 DoHandleStopRecording(pginfo, pbs); 1933 else 1934 delete pginfo; 1935 QStringList outputlist = QString::number(0); 1936 SendResponse(pbssock, outputlist); 1937 MythEvent me("RECORDING_LIST_CHANGE"); 1938 gContext->dispatch(me); 1939 return; 1940 } 1941 1919 1942 QString filename = pginfo->GetPlaybackURL(); 1920 1943 1921 1944 // If this recording was made by a another recorder, and that … … 2038 2061 delete pginfo; 2039 2062 } 2040 2063 2064 void MainServer::HandleUndeleteRecording(QStringList &slist, PlaybackSock *pbs) 2065 { 2066 ProgramInfo *pginfo = new ProgramInfo(); 2067 pginfo->FromStringList(slist, 1); 2068 2069 DoHandleUndeleteRecording(pginfo, pbs); 2070 } 2071 2072 void MainServer::DoHandleUndeleteRecording(ProgramInfo *pginfo, PlaybackSock *pbs) 2073 { 2074 bool ret = -1; 2075 bool undelete_possible = 2076 gContext->GetNumSetting("AutoExpireInsteadOfDelete", 0); 2077 MythSocket *pbssock = NULL; 2078 if (pbs) 2079 pbssock = pbs->getSocket(); 2080 2081 if (undelete_possible) 2082 { 2083 pginfo->ApplyRecordRecGroupChange("Default"); 2084 pginfo->UpdateLastDelete(false); 2085 pginfo->SetAutoExpire(kDisableAutoExpire); 2086 delete pginfo; 2087 ret = 0; 2088 MythEvent me("RECORDING_LIST_CHANGE"); 2089 gContext->dispatch(me); 2090 } 2091 2092 QStringList outputlist = QString::number(ret); 2093 SendResponse(pbssock, outputlist); 2094 } 2095 2041 2096 void MainServer::HandleRescheduleRecordings(int recordid, PlaybackSock *pbs) 2042 2097 { 2043 2098 QStringList result;