Fix parsing of model name for recordings
This commit is contained in:
parent
58df996edc
commit
4516b8d787
|
@ -468,10 +468,11 @@ public class LocalRecorder implements Recorder {
|
||||||
for (File ts: possibleRecordings) {
|
for (File ts: possibleRecordings) {
|
||||||
try {
|
try {
|
||||||
String filename = ts.getName();
|
String filename = ts.getName();
|
||||||
String dateString = filename.substring(filename.length() - 3 - DATE_FORMAT.length(), filename.length() - 3);
|
int extLength = filename.length() - filename.lastIndexOf('.');
|
||||||
|
String dateString = filename.substring(filename.length() - extLength - DATE_FORMAT.length(), filename.length() - extLength);
|
||||||
Date startDate = sdf.parse(dateString);
|
Date startDate = sdf.parse(dateString);
|
||||||
Recording recording = new Recording();
|
Recording recording = new Recording();
|
||||||
recording.setModelName(filename.substring(0, filename.length() - 4 - DATE_FORMAT.length()));
|
recording.setModelName(filename.substring(0, filename.length() - extLength - 1 - DATE_FORMAT.length()));
|
||||||
recording.setStartDate(Instant.ofEpochMilli(startDate.getTime()));
|
recording.setStartDate(Instant.ofEpochMilli(startDate.getTime()));
|
||||||
String path = ts.getAbsolutePath().replace(config.getSettings().recordingsDir, "");
|
String path = ts.getAbsolutePath().replace(config.getSettings().recordingsDir, "");
|
||||||
if(!path.startsWith("/")) {
|
if(!path.startsWith("/")) {
|
||||||
|
@ -775,6 +776,10 @@ public class LocalRecorder implements Recorder {
|
||||||
try {
|
try {
|
||||||
LOG.debug("Determining video length for {}", download.getTarget());
|
LOG.debug("Determining video length for {}", download.getTarget());
|
||||||
File target = download.getTarget();
|
File target = download.getTarget();
|
||||||
|
if(!target.exists()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
double duration = 0;
|
double duration = 0;
|
||||||
if(target.isDirectory()) {
|
if(target.isDirectory()) {
|
||||||
File playlist = new File(target, "playlist.m3u8");
|
File playlist = new File(target, "playlist.m3u8");
|
||||||
|
|
Loading…
Reference in New Issue