22 |
22 |
#include <stdlib.h>
|
23 |
23 |
#include <string.h>
|
24 |
24 |
|
|
25 |
#include "audstrings.h"
|
25 |
26 |
#include "runtime.h"
|
26 |
27 |
#include "scanner.h"
|
27 |
28 |
#include "tuple-compiler.h"
|
... | ... | |
172 |
173 |
if (entry->selected)
|
173 |
174 |
m_selected_length -= entry->length;
|
174 |
175 |
|
|
176 |
/* JWT: KEEP (DON'T OVERWRITE) ENTRY'S TITLE IF TUPLE'S TITLE IS NOT SET!
|
|
177 |
(NEEDED FOR EXTENDED M3U PLAYLIST ITEMS TO KEEP THE TITLE!)
|
|
178 |
*/
|
|
179 |
String Title = entry->tuple.get_str (Tuple::Title);
|
|
180 |
if (! tuple.is_set (Tuple::Title))
|
|
181 |
tuple.set_str (Tuple::Title, Title);
|
|
182 |
|
175 |
183 |
entry->set_tuple (std::move (tuple));
|
176 |
184 |
|
177 |
185 |
m_total_length += entry->length;
|
... | ... | |
1032 |
1040 |
ScanRequest::Callback callback, int extra_flags)
|
1033 |
1041 |
{
|
1034 |
1042 |
int flags = extra_flags;
|
1035 |
|
if (! entry->tuple.valid ())
|
|
1043 |
/* JWT:ADDED NEXT TEST - NECESSARY TO FORCE RESCAN OF CUESHEETS, OTHERWISE TUPLE METADATA IS
|
|
1044 |
INCORRECT IF THE *FIRST* ENTRY IS A CUESHEET AND IT WON'T PLAY A SECOND TIME?!
|
|
1045 |
*/
|
|
1046 |
if (! strncmp (entry->filename, "file://", 7) && strstr ((const char *) entry->filename, ".cue?"))
|
|
1047 |
flags |= SCAN_CUESHEET; // WE'RE A CUESHEET, HANDLE W/SPECIAL CARE! (in scanner.cc)
|
|
1048 |
else if (! entry->tuple.valid ())
|
1036 |
1049 |
flags |= SCAN_TUPLE;
|
1037 |
1050 |
|
1038 |
1051 |
/* scanner uses Tuple::AudioFile from existing tuple, if valid */
|
... | ... | |
1045 |
1058 |
if (! entry->decoder)
|
1046 |
1059 |
entry->decoder = request->decoder;
|
1047 |
1060 |
|
|
1061 |
const char * base;
|
|
1062 |
const char * ext;
|
|
1063 |
int isub_p;
|
|
1064 |
uri_parse (request->filename, & base, & ext, nullptr, & isub_p);
|
|
1065 |
int baselen = ext - base;
|
1048 |
1066 |
if (! entry->tuple.valid () && request->tuple.valid ())
|
1049 |
1067 |
{
|
|
1068 |
int cuesetlength = entry->tuple.get_int (Tuple::Length); // JWT:DON'T LET SCAN REPLACE CUESHEET-SET LENGTH, IF SET!
|
|
1069 |
/* JWT: ONLY REPLACE ENTRY'S TITLE W/REQUEST'S TITLE IF CUESHEET AND THE ENTRY'S TITLE
|
|
1070 |
IS STILL JUST THE FILENAME! (ACCOMPLISHED BY STUFFING THE CURRENT ENTRY'S TITLE
|
|
1071 |
INTO THE REQUEST TUPLE BEFORE REPLACING ENTRY'S TUPLE W/REQUEST'S TUPLE)
|
|
1072 |
THIS NEEDED TO ENSURE THAT A CUESHEET ENTRY'S TITLE IN A NON-EXTENDED M3U PLAYLIST
|
|
1073 |
GETS (STAYS) OVERRIDDEN BY THE TITLE IN THE CUESHEET (PREVIOUSLY WE DIDN'T SUPPORT
|
|
1074 |
CUESHEETS IN M3U PLAYLISTS).
|
|
1075 |
*/
|
|
1076 |
String oldTitle = entry->tuple.get_str (Tuple::Title);
|
|
1077 |
if (oldTitle && oldTitle[0] && isub_p > 0 && strncmp ((const char *) oldTitle, base, baselen))
|
|
1078 |
request->tuple.set_str (Tuple::Title, oldTitle);
|
|
1079 |
|
1050 |
1080 |
set_entry_tuple (entry, std::move (request->tuple));
|
|
1081 |
if (cuesetlength > 0) // JWT:MAKE SURE RECALCULATED LENGTH FROM CUESHEETS DOESN'T GET CLOBBERED!
|
|
1082 |
entry->tuple.set_int (Tuple::Length, cuesetlength);
|
|
1083 |
|
1051 |
1084 |
queue_update (Playlist::Metadata, entry->number, 1, update_flags);
|
1052 |
1085 |
}
|
1053 |
1086 |
|