diff options
-rw-r--r-- | pages/edit_recording.ecpp | 25 | ||||
-rw-r--r-- | po/ca_ES.po | 5 | ||||
-rw-r--r-- | po/cs_CZ.po | 5 | ||||
-rw-r--r-- | po/da_DK.po | 5 | ||||
-rw-r--r-- | po/de_DE.po | 5 | ||||
-rw-r--r-- | po/el_GR.po | 5 | ||||
-rw-r--r-- | po/es_ES.po | 5 | ||||
-rw-r--r-- | po/et_EE.po | 5 | ||||
-rw-r--r-- | po/fi_FI.po | 7 | ||||
-rw-r--r-- | po/fr_FR.po | 5 | ||||
-rw-r--r-- | po/hr_HR.po | 5 | ||||
-rw-r--r-- | po/hu_HU.po | 5 | ||||
-rw-r--r-- | po/it_IT.po | 5 | ||||
-rw-r--r-- | po/lt_LT.po | 5 | ||||
-rw-r--r-- | po/nl_NL.po | 5 | ||||
-rw-r--r-- | po/nn_NO.po | 5 | ||||
-rw-r--r-- | po/pl_PL.po | 5 | ||||
-rw-r--r-- | po/pt_PT.po | 5 | ||||
-rw-r--r-- | po/ro_RO.po | 5 | ||||
-rw-r--r-- | po/ru_RU.po | 5 | ||||
-rw-r--r-- | po/sl_SI.po | 5 | ||||
-rw-r--r-- | po/sv_SE.po | 5 | ||||
-rw-r--r-- | po/tr_TR.po | 5 | ||||
-rw-r--r-- | recman.cpp | 7 | ||||
-rw-r--r-- | recman.h | 4 | ||||
-rw-r--r-- | tools.cpp | 28 | ||||
-rw-r--r-- | tools.h | 2 |
27 files changed, 127 insertions, 51 deletions
diff --git a/pages/edit_recording.ecpp b/pages/edit_recording.ecpp index a6862ba..dc124fd 100644 --- a/pages/edit_recording.ecpp +++ b/pages/edit_recording.ecpp @@ -22,7 +22,7 @@ using namespace vdrlive; // form parameters string name = ""; string directory = ""; - string deletions[]; + string options[]; </%args> <%session scope="global"> bool logged_in(false); @@ -53,18 +53,21 @@ const cRecording* recording; if (name.empty()) message = tr("Please set a name for the recording!"); else if (recording) { - for (deletions_type::const_iterator it = deletions.begin(); it != deletions.end(); ++it) { - if (*it == "resume") + bool copy_only = false; + for (options_type::const_iterator it = options.begin(); it != options.end(); ++it) { + if (*it == "delresume") LiveRecordingsManager()->DeleteResume(recording); - else if (*it == "marks") + else if (*it == "delmarks") LiveRecordingsManager()->DeleteMarks(recording); + else if (*it == "copy") + copy_only = true; } - deletions.clear(); + options.clear(); string filename = directory.empty() ? name : StringReplace(directory, "/", "~") + "~" + name; - if (LiveRecordingsManager()->RenameRecording(recording, FileSystemExchangeChars(filename, true))) + if (LiveRecordingsManager()->MoveRecording(recording, FileSystemExchangeChars(filename, true), copy_only)) return reply.redirect(!edit_rec_referer.empty() ? edit_rec_referer : "recordings.html"); else - message = tr("Cannot rename or move the recording."); + message = tr("Cannot copy, rename or move the recording."); } } @@ -137,11 +140,15 @@ const cRecording* recording; </tr> <tr> <td class="label leftcol"><div class="withmargin"><$ tr("Delete resume information") $>:</div></td> - <td class="rightcol"><input type="checkbox" name="deletions" value="resume"/></td> + <td class="rightcol"><input type="checkbox" name="options" value="delresume"/></td> </tr> <tr> <td class="label leftcol"><div class="withmargin"><$ tr("Delete marks information") $>:</div></td> - <td class="rightcol"><input type="checkbox" name="deletions" value="marks"/></td> + <td class="rightcol"><input type="checkbox" name="options" value="delmarks"/></td> + </tr> + <tr> + <td class="label leftcol"><div class="withmargin"><$ tr("Copy only") $>:</div></td> + <td class="rightcol"><input type="checkbox" name="options" value="copy"/></td> </tr> <tr> <td class="buttonpanel leftcol rightcol bottomrow" colspan="2"> diff --git a/po/ca_ES.po b/po/ca_ES.po index 5fd383d..9732e4f 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -138,7 +138,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -156,6 +156,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/cs_CZ.po b/po/cs_CZ.po index ec4b928..53d1fa2 100644 --- a/po/cs_CZ.po +++ b/po/cs_CZ.po @@ -136,7 +136,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -154,6 +154,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/da_DK.po b/po/da_DK.po index d75247d..aaed0a9 100644 --- a/po/da_DK.po +++ b/po/da_DK.po @@ -136,7 +136,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -154,6 +154,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/de_DE.po b/po/de_DE.po index 97ea68a..2b56825 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -138,7 +138,7 @@ msgstr "Konnte die Aufnahme nicht finden. Möglicherweise ein Tippfehler in der msgid "Please set a name for the recording!" msgstr "Bitte einen Namen für die Aufnahme setzen!" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "Konnte die Aufnahme nicht umbenennen oder verschieben." msgid "Edit recording" @@ -156,6 +156,9 @@ msgstr "Wiedergabeposition löschen" msgid "Delete marks information" msgstr "Schnittmarken löschen" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "Speichern" diff --git a/po/el_GR.po b/po/el_GR.po index c76d94b..6a104bf 100644 --- a/po/el_GR.po +++ b/po/el_GR.po @@ -136,7 +136,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -154,6 +154,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/es_ES.po b/po/es_ES.po index e832a81..b8382b2 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -136,7 +136,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -154,6 +154,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/et_EE.po b/po/et_EE.po index 5334845..5900ec7 100644 --- a/po/et_EE.po +++ b/po/et_EE.po @@ -136,7 +136,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -154,6 +154,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/fi_FI.po b/po/fi_FI.po index 23a6ec9..21fb162 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -136,8 +136,8 @@ msgstr "Tallennetta ei löydy. Kirjoititko varmasti oikein?" msgid "Please set a name for the recording!" msgstr "Aseta nimi tallenteelle!" -msgid "Cannot rename or move the recording." -msgstr "Tallenteen uudelleen nimeäminen tai siirto epäonnistui!" +msgid "Cannot copy, rename or move the recording." +msgstr "Tallenteen kopioiminen, uudelleen nimeäminen tai siirto epäonnistui!" msgid "Edit recording" msgstr "Muokkaa tallennetta" @@ -154,6 +154,9 @@ msgstr "Poista paluutiedot" msgid "Delete marks information" msgstr "Poista merkinnät" +msgid "Copy only" +msgstr "Kopioi ainoastaan" + msgid "Save" msgstr "Tallenna" diff --git a/po/fr_FR.po b/po/fr_FR.po index abfbfe3..f1ab857 100644 --- a/po/fr_FR.po +++ b/po/fr_FR.po @@ -142,7 +142,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -160,6 +160,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "Sauvegarde" diff --git a/po/hr_HR.po b/po/hr_HR.po index 689ac0e..ffd7a06 100644 --- a/po/hr_HR.po +++ b/po/hr_HR.po @@ -137,7 +137,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -155,6 +155,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/hu_HU.po b/po/hu_HU.po index cc097da..e04216d 100644 --- a/po/hu_HU.po +++ b/po/hu_HU.po @@ -137,7 +137,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -155,6 +155,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/it_IT.po b/po/it_IT.po index 45dac5a..be70cac 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -142,7 +142,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -160,6 +160,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "Salva" diff --git a/po/lt_LT.po b/po/lt_LT.po index 5fac9fc..bc95cd3 100644 --- a/po/lt_LT.po +++ b/po/lt_LT.po @@ -137,7 +137,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -155,6 +155,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "IÅ¡saugoti" diff --git a/po/nl_NL.po b/po/nl_NL.po index 053f825..b7002c1 100644 --- a/po/nl_NL.po +++ b/po/nl_NL.po @@ -142,7 +142,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -160,6 +160,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/nn_NO.po b/po/nn_NO.po index f87c838..a08350e 100644 --- a/po/nn_NO.po +++ b/po/nn_NO.po @@ -137,7 +137,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -155,6 +155,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/pl_PL.po b/po/pl_PL.po index 9e0cada..4e4e44c 100644 --- a/po/pl_PL.po +++ b/po/pl_PL.po @@ -136,7 +136,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -154,6 +154,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/pt_PT.po b/po/pt_PT.po index 10aca92..415dd3c 100644 --- a/po/pt_PT.po +++ b/po/pt_PT.po @@ -136,7 +136,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -154,6 +154,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/ro_RO.po b/po/ro_RO.po index 876d3a3..742aa25 100644 --- a/po/ro_RO.po +++ b/po/ro_RO.po @@ -137,7 +137,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -155,6 +155,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/ru_RU.po b/po/ru_RU.po index 0bd9488..565db6b 100644 --- a/po/ru_RU.po +++ b/po/ru_RU.po @@ -136,7 +136,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -154,6 +154,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/sl_SI.po b/po/sl_SI.po index fbe16cb..ab3bde0 100644 --- a/po/sl_SI.po +++ b/po/sl_SI.po @@ -137,7 +137,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -155,6 +155,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/sv_SE.po b/po/sv_SE.po index f61fef3..67201e3 100644 --- a/po/sv_SE.po +++ b/po/sv_SE.po @@ -137,7 +137,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -155,6 +155,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" diff --git a/po/tr_TR.po b/po/tr_TR.po index 21bd919..21e5e2a 100644 --- a/po/tr_TR.po +++ b/po/tr_TR.po @@ -137,7 +137,7 @@ msgstr "" msgid "Please set a name for the recording!" msgstr "" -msgid "Cannot rename or move the recording." +msgid "Cannot copy, rename or move the recording." msgstr "" msgid "Edit recording" @@ -155,6 +155,9 @@ msgstr "" msgid "Delete marks information" msgstr "" +msgid "Copy only" +msgstr "" + msgid "Save" msgstr "" @@ -101,7 +101,7 @@ namespace vdrlive { return 0; } - bool RecordingsManager::RenameRecording(cRecording const * recording, string const & name) const + bool RecordingsManager::MoveRecording(cRecording const * recording, string const & name, bool copy) const { if (!recording) return false; @@ -114,12 +114,13 @@ namespace vdrlive { string newname = string(VideoDirectory) + "/" + name + oldname.substr(found); - if (!MoveDirectory(oldname.c_str(), newname.c_str())) { + if (!MoveDirectory(oldname.c_str(), newname.c_str(), copy)) { esyslog("[LIVE]: renaming failed from '%s' to '%s'", oldname.c_str(), newname.c_str()); return false; } - Recordings.DelByName(oldname.c_str()); + if (!copy) + Recordings.DelByName(oldname.c_str()); Recordings.AddByName(newname.c_str()); cRecordingUserCommand::InvokeCommand(*cString::sprintf("rename \"%s\"", *strescape(oldname.c_str(), "\\\"$'")), newname.c_str()); @@ -78,10 +78,10 @@ namespace vdrlive { cRecording const* GetByMd5Hash(std::string const & hash) const; /** - * Rename a recording with the given hash according to + * Move a recording with the given hash according to * VDRs recording mechanisms. */ - bool RenameRecording(cRecording const * recording, std::string const & name) const; + bool MoveRecording(cRecording const * recording, std::string const & name, bool copy = false) const; /** * Delete recording resume with the given hash according to @@ -335,7 +335,7 @@ namespace vdrlive { return data; } - bool MoveDirectory(std::string const & sourceDir, std::string const & targetDir) + bool MoveDirectory(std::string const & sourceDir, std::string const & targetDir, bool copy) { const char* delim = "/"; std::string source = sourceDir; @@ -364,7 +364,7 @@ namespace vdrlive { struct stat st1, st2; stat(source.c_str(), &st1); stat(target.c_str(),&st2); - if (st1.st_dev == st2.st_dev) { + if (!copy && (st1.st_dev == st2.st_dev)) { if (!RenameVideoFile(source.c_str(), target.c_str())) { esyslog("[LIVE]: rename failed from %s to %s", source.c_str(), target.c_str()); return false; @@ -451,27 +451,29 @@ namespace vdrlive { esyslog("[LIVE]: copying failed"); return false; } - else if (!RemoveFileOrDir(source.c_str(), true)) { // delete source files + else if (!copy && !RemoveFileOrDir(source.c_str(), true)) { // delete source files esyslog("[LIVE]: cannot remove source directory %s", source.c_str()); return false; } // delete all empty source directories - size_t found = source.find_last_of(delim); - if (found != std::string::npos) { - source = source.substr(0, found); - while (source != VideoDirectory) { - found = source.find_last_of(delim); - if (found == std::string::npos) - break; + if (!copy) { + size_t found = source.find_last_of(delim); + if (found != std::string::npos) { source = source.substr(0, found); - if (!RemoveEmptyDirectories(source.c_str(), true)) - break; + while (source != VideoDirectory) { + found = source.find_last_of(delim); + if (found == std::string::npos) + break; + source = source.substr(0, found); + if (!RemoveEmptyDirectories(source.c_str(), true)) + break; + } } } } else { - esyslog("[LIVE]: renaming requires %dMB - only %dMB available", required, available); + esyslog("[LIVE]: %s requires %dMB - only %dMB available", copy ? "moving" : "copying", required, available); // delete all created empty target directories size_t found = target.find_last_of(delim); if (found != std::string::npos) { @@ -63,7 +63,7 @@ namespace vdrlive { std::string FileSystemExchangeChars(std::string const & s, bool ToFileSystem); - bool MoveDirectory(std::string const & sourceDir, std::string const & targetDir); + bool MoveDirectory(std::string const & sourceDir, std::string const & targetDir, bool copy = false); struct bad_lexical_cast: std::runtime_error { |