Ticket #3788: expire_not_delete.diff
File expire_not_delete.diff, 11.9 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/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 = gContext->GetNumSetting("AutoExpireInsteadOfDelete"); 172 if (!undelete_possible) 173 return result; 174 175 QStringList strlist; 176 177 strlist = QString("UNDELETE_RECORDING"); 178 pginfo->ToStringList(strlist); 179 180 gContext->SendReceiveStringList(strlist); 181 182 if (strlist[0].toInt() == 0) 183 result = true; 184 185 return result; 186 } 187 167 188 void RemoteGetAllScheduledRecordings(vector<ProgramInfo *> &scheduledlist) 168 189 { 169 190 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 != "LiveTV" || LiveTVInAllPrograms))) && 1667 ((p->recgroup != "LiveTV" && p->recgroup != "Deleted") 1668 || LiveTVInAllPrograms))) && 1668 1669 (recGroupPassword == curGroupPassword)) || 1669 1670 ((recGroupType[recGroup] == "category") && 1670 1671 ((p->category == recGroup ) || … … 3159 3160 popup->addButton(tr("Stop Recording"), this, SLOT(askStop())); 3160 3161 } 3161 3162 3163 if (program->recgroup == "Deleted") 3164 popup->addButton(tr("Undelete"), this, 3165 SLOT(doUndelete())); 3166 3162 3167 if (curitem->programflags & FL_WATCHED) 3163 3168 popup->addButton(tr("Mark as Unwatched"), this, 3164 3169 SLOT(setUnwatched())); … … 3517 3522 playList.clear(); 3518 3523 } 3519 3524 3525 void PlaybackBox::doUndelete(void) 3526 { 3527 if (!expectingPopup) 3528 { 3529 previewSuspend = false; 3530 return; 3531 } 3532 3533 cancelPopup(); 3534 RemoteUndeleteRecording(curitem); 3535 } 3536 3520 3537 void PlaybackBox::doDelete(void) 3521 3538 { 3522 3539 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"); 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"); … … 3736 3747 autoexp->addChild(AutoExpireLiveTVMaxAge()); 3737 3748 autoexp->addChild(RerecordWatched()); 3738 3749 autoexp->addChild(AutoExpireExtraSpace()); 3750 autoexp->addChild(AutoExpireInsteadOfDelete()); 3739 3751 addChild(autoexp); 3740 3752 3741 3753 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(1); 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 = gContext->GetNumSetting("AutoExpireInsteadOfDelete"); 2076 MythSocket *pbssock = NULL; 2077 if (pbs) 2078 pbssock = pbs->getSocket(); 2079 2080 if (undelete_possible) 2081 { 2082 pginfo->ApplyRecordRecGroupChange("Default"); 2083 pginfo->UpdateLastDelete(false); 2084 delete pginfo; 2085 ret = 0; 2086 MythEvent me("RECORDING_LIST_CHANGE"); 2087 gContext->dispatch(me); 2088 } 2089 2090 QStringList outputlist = QString::number(ret); 2091 SendResponse(pbssock, outputlist); 2092 } 2093 2041 2094 void MainServer::HandleRescheduleRecordings(int recordid, PlaybackSock *pbs) 2042 2095 { 2043 2096 QStringList result;