[chronojump] Webcam photo temp filename without the videoDevice (great for windows)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Webcam photo temp filename without the videoDevice (great for windows)
- Date: Thu, 7 Nov 2019 10:19:42 +0000 (UTC)
commit 48624307c23dfa6570168f6c89cb5677917abde8
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Nov 7 11:19:20 2019 +0100
Webcam photo temp filename without the videoDevice (great for windows)
src/gui/person.cs | 4 ++--
src/util.cs | 8 ++++----
src/webcam/webcamFfmpeg.cs | 2 +-
src/webcam/webcamMplayer.cs | 8 ++++----
4 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/gui/person.cs b/src/gui/person.cs
index f9662160..16d04cb7 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -1100,8 +1100,8 @@ public class PersonAddModifyWindow
if(webcam.Snapshot())
{
- File.Copy(Util.GetWebcamPhotoTempFileNamePost(Util.ChangeChars(videoDevice, "/",
"_")),
- Util.GetPhotoPngFileName(false, currentPerson.UniqueID),
true); //overwrite
+ File.Copy(Util.GetWebcamPhotoTempFileNamePost(),
+ Util.GetPhotoPngFileName(false, currentPerson.UniqueID), true);
//overwrite
string filenameMini = Util.GetPhotoPngFileName(true, currentPerson.UniqueID);
bool miniSuccess = UtilMultimedia.LoadAndResizeImage(
diff --git a/src/util.cs b/src/util.cs
index 944e5ae4..41007183 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1119,17 +1119,17 @@ public class Util
*/
//Pre: filename without 0001.png
- public static string GetWebcamPhotoTempFileNamePre(string videoDevice)
+ public static string GetWebcamPhotoTempFileNamePre()
{
string fileName = Constants.PhotoTemp;
- return Path.Combine(Path.GetTempPath(), Constants.PhotoTemp + "-" + videoDevice + "-");
+ return Path.Combine(Path.GetTempPath(), Constants.PhotoTemp + "-");
}
//Pre: filename with 0001.png
- public static string GetWebcamPhotoTempFileNamePost(string videoDevice)
+ public static string GetWebcamPhotoTempFileNamePost()
{
- return GetWebcamPhotoTempFileNamePre(videoDevice) + "0001.png";
+ return GetWebcamPhotoTempFileNamePre() + "0001.png";
}
diff --git a/src/webcam/webcamFfmpeg.cs b/src/webcam/webcamFfmpeg.cs
index 478ce375..662bd1a4 100644
--- a/src/webcam/webcamFfmpeg.cs
+++ b/src/webcam/webcamFfmpeg.cs
@@ -324,7 +324,7 @@ public class WebcamFfmpeg : Webcam
parameters.Insert (i ++, "0:0:2");
parameters.Insert (i ++, "-frames");
parameters.Insert (i ++, "1");
- parameters.Insert (i ++, Util.GetWebcamPhotoTempFileNamePost(videoDeviceToFilename()));
+ parameters.Insert (i ++, Util.GetWebcamPhotoTempFileNamePost());
parameters.Insert (i ++, "-y"); //overwrite
return parameters;
diff --git a/src/webcam/webcamMplayer.cs b/src/webcam/webcamMplayer.cs
index 33e16065..31068cd3 100644
--- a/src/webcam/webcamMplayer.cs
+++ b/src/webcam/webcamMplayer.cs
@@ -45,7 +45,7 @@ public class WebcamMplayer : Webcam
if(process != null)
return new Result (false, "");
- string tempFile = Util.GetWebcamPhotoTempFileNamePost(videoDeviceToFilename());
+ string tempFile = Util.GetWebcamPhotoTempFileNamePost();
Util.FileDelete(tempFile);
List<string> parameters = new List<string>();
@@ -68,7 +68,7 @@ public class WebcamMplayer : Webcam
parameters.Insert (i ++, "driver=v4l2:gain=1:width=400:height=400:device=" + videoDevice +
":fps=10:outfmt=rgb16");
parameters.Insert (i ++, "tv://");
parameters.Insert (i ++, "-vf");
- parameters.Insert (i ++, "screenshot=" +
Util.GetWebcamPhotoTempFileNamePre(videoDeviceToFilename()));
+ parameters.Insert (i ++, "screenshot=" + Util.GetWebcamPhotoTempFileNamePre());
process = new Process();
bool success = ExecuteProcess.RunAtBackground (ref process, executable, parameters, true,
false, true, true, true); //redirectInput, redirectOutput, redirectError
@@ -276,7 +276,7 @@ public class WebcamMplayer : Webcam
private bool findIfThereAreImagesToConvert()
{
- return (File.Exists(Util.GetWebcamPhotoTempFileNamePre(videoDeviceToFilename()) +
"0001.png"));
+ return (File.Exists(Util.GetWebcamPhotoTempFileNamePre() + "0001.png"));
}
private bool convertImagesToVideo()
@@ -288,7 +288,7 @@ public class WebcamMplayer : Webcam
parameters.Insert (1, "20");
parameters.Insert (2, "-y"); //force overwrite without asking
parameters.Insert (3, "-i"); //input files
- parameters.Insert (4, Util.GetWebcamPhotoTempFileNamePre(videoDeviceToFilename()) +
"%04d.png");
+ parameters.Insert (4, Util.GetWebcamPhotoTempFileNamePre() + "%04d.png");
parameters.Insert (5, Util.GetVideoTempFileName());
ExecuteProcess.Result execute_result = ExecuteProcess.run (executable, parameters, true,
true);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]