forked from j62/ctbrec
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) {
|
||||
try {
|
||||
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);
|
||||
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()));
|
||||
String path = ts.getAbsolutePath().replace(config.getSettings().recordingsDir, "");
|
||||
if(!path.startsWith("/")) {
|
||||
|
@ -775,6 +776,10 @@ public class LocalRecorder implements Recorder {
|
|||
try {
|
||||
LOG.debug("Determining video length for {}", download.getTarget());
|
||||
File target = download.getTarget();
|
||||
if(!target.exists()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
double duration = 0;
|
||||
if(target.isDirectory()) {
|
||||
File playlist = new File(target, "playlist.m3u8");
|
||||
|
|
Loading…
Reference in New Issue