Ticket #3788: expire_not_delete.2.diff
File expire_not_delete.2.diff, 13.8 KB (added by , 17 years ago) |
---|
-
mythplugins/mythweb/modules/_shared/lang/English.lang
171 171 "Delete and allow rerecord: $1" 172 172 "Delete and rerecord $1" 173 173 "DELETE this Saved Playlist" 174 "Undelete" 174 175 "description" 175 176 "Description" 176 177 "Destination" -
mythplugins/mythweb/modules/tv/tmpl/default/recorded.php
341 341 <a onclick="javascript:confirm_delete(<?php echo $row ?>, true)" 342 342 title="<?php echo html_entities(t('Delete and allow rerecord: $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>" 343 343 ><?php echo t('Delete + Rerecord') ?></a> 344 345 <?php if ($show->recgroup == 'Deleted') { 346 echo '<a href="', root, 'tv/recorded?undelete=yes&chanid=', $show->chanid, 347 '&starttime=', $show->starttime, '" ' ?> 348 title="<?php echo html_entities(t('Undelete: $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>" 349 <?php echo '>' , t('Undelete') ?></a> 350 <?php } ?> 344 351 <?php } ?> 345 352 </td> 346 353 </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/libs/libmythtv/remoteutil.h
39 39 bool RemoteDeleteRecording(ProgramInfo *pginfo, bool forgetHistory, 40 40 bool forceMetadataDelete = false); 41 41 MPUBLIC 42 bool RemoteUndeleteRecording(ProgramInfo *pginfo); 43 MPUBLIC 42 44 void RemoteGetAllScheduledRecordings(vector<ProgramInfo *> &scheduledlist); 43 45 MPUBLIC 44 46 void RemoteGetAllExpiringRecordings(vector<ProgramInfo *> &expiringlist); -
mythtv/libs/libmythtv/tv.h
50 50 kState_ChangingState, 51 51 } TVState; 52 52 53 const int kLiveTVAutoExpire = 10000;54 55 53 QString StateToString(TVState state); 56 54 57 55 typedef enum PictureAdjustType -
mythtv/libs/libmythtv/programinfo.h
118 118 wlExpireOff = -1 119 119 }; 120 120 121 enum AutoExpireType { 122 kDisableAutoExpire = 0, 123 kNormalAutoExpire = 1, 124 kDeletedAutoExpire = 9999, 125 kLiveTVAutoExpire = 10000 126 }; 127 121 128 class ScheduledRecording; 122 129 class QGridLayout; 123 130 -
mythtv/libs/libmythtv/remoteutil.cpp
164 164 return result; 165 165 } 166 166 167 bool RemoteUndeleteRecording(ProgramInfo *pginfo) 168 { 169 bool result = false; 170 171 bool undelete_possible = 172 gContext->GetNumSetting("AutoExpireInsteadOfDelete", 0); 173 174 if (!undelete_possible) 175 return result; 176 177 QStringList strlist; 178 179 strlist = QString("UNDELETE_RECORDING"); 180 pginfo->ToStringList(strlist); 181 182 gContext->SendReceiveStringList(strlist); 183 184 if (strlist[0].toInt() == 0) 185 result = true; 186 187 return result; 188 } 189 167 190 void RemoteGetAllScheduledRecordings(vector<ProgramInfo *> &scheduledlist) 168 191 { 169 192 QStringList strList = QString("QUERY_GETALLSCHEDULED"); -
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") && … … 2301 2302 if (!curitem) 2302 2303 return; 2303 2304 2304 if ((curitem->availableStatus != asPendingDelete) && 2305 bool undelete_possible = 2306 gContext->GetNumSetting("AutoExpireInsteadOfDelete", 0); 2307 2308 if (curitem->recgroup != "Deleted" && undelete_possible) 2309 doRemove(curitem, false, false); 2310 else if ((curitem->availableStatus != asPendingDelete) && 2305 2311 (REC_CAN_BE_DELETED(curitem))) 2306 2312 remove(curitem); 2307 2313 else … … 3171 3177 popup->addButton(tr("Job Options"), this, SLOT(showJobPopup())); 3172 3178 3173 3179 if (!(m_player && m_player->IsSameProgram(curitem))) 3174 popup->addButton(tr("Delete"), this, SLOT(askDelete())); 3180 { 3181 if (curitem->recgroup == "Deleted") 3182 { 3183 popup->addButton(tr("Undelete"), this, 3184 SLOT(doUndelete())); 3185 popup->addButton(tr("Delete"), this, 3186 SLOT(doDelete())); 3187 } 3188 else 3189 { 3190 bool can_undelete = 3191 gContext->GetNumSetting("AutoExpireInsteadOfDelete", 0); 3192 if (can_undelete) 3193 { 3194 popup->addButton(tr("Mark for Deletion"), this, 3195 SLOT(doDelete())); 3196 } 3197 else 3198 { 3199 popup->addButton(tr("Delete"), this, 3200 SLOT(askDelete())); 3201 } 3202 } 3203 } 3175 3204 3176 3205 popup->ShowPopup(this, SLOT(doCancel())); 3177 3206 … … 3517 3546 playList.clear(); 3518 3547 } 3519 3548 3549 void PlaybackBox::doUndelete(void) 3550 { 3551 if (!expectingPopup) 3552 { 3553 previewSuspend = false; 3554 return; 3555 } 3556 3557 cancelPopup(); 3558 RemoteUndeleteRecording(curitem); 3559 } 3560 3520 3561 void PlaybackBox::doDelete(void) 3521 3562 { 3522 3563 if (!expectingPopup) -
mythtv/programs/mythfrontend/globalsettings.cpp
576 576 return bs; 577 577 }; 578 578 579 static GlobalCheckBox *AutoExpireInsteadOfDelete() 580 { 581 GlobalCheckBox *cb = new GlobalCheckBox("AutoExpireInsteadOfDelete", 0); 582 cb->setLabel(QObject::tr("Auto Expire Instead of Delete Recording")); 583 cb->setValue(false); 584 cb->setHelpText(QObject::tr("Instead of deleting a recording, " 585 "move recording to the 'Deleted' recgroup " 586 "and turn on autoexpire.")); 587 return cb; 588 } 589 579 590 static GlobalComboBox *AutoExpireMethod() 580 591 { 581 592 GlobalComboBox *bc = new GlobalComboBox("AutoExpireMethod"); … … 3767 3778 autoexp->addChild(AutoExpireLiveTVMaxAge()); 3768 3779 autoexp->addChild(RerecordWatched()); 3769 3780 autoexp->addChild(AutoExpireExtraSpace()); 3781 autoexp->addChild(AutoExpireInsteadOfDelete()); 3770 3782 addChild(autoexp); 3771 3783 3772 3784 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", 0) && 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;