Skip to content

Commit

Permalink
Fixup how we set item title from metadata.
Browse files Browse the repository at this point in the history
We don't want to do this when we actually play a file because it might
have already been set by the code in video_playback.c
  • Loading branch information
andoma committed Apr 30, 2011
1 parent dcefaae commit 5ae6153
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/fileaccess/fa_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ file_open_file(prop_t *page, const char *url, struct fa_stat *fs)

meta = prop_create_root("metadata");

r = fa_probe(meta, url, redir, sizeof(redir), errbuf, sizeof(errbuf), fs);
r = fa_probe(meta, url, redir, sizeof(redir), errbuf, sizeof(errbuf), fs, 1);

switch(r) {
case CONTENT_ARCHIVE:
Expand Down
2 changes: 1 addition & 1 deletion src/fileaccess/fa_locatedb.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ fa_locate_searcher (fa_search_t *fas)
ctype = CONTENT_DIR;
prop_set_string(prop_create(metadata, "title"), basename(buf));
} else
ctype = fa_probe(metadata, url, NULL, 0, NULL, 0, NULL);
ctype = fa_probe(metadata, url, NULL, 0, NULL, 0, NULL, 1);

if (ctype == CONTENT_UNKNOWN)
continue;
Expand Down
12 changes: 7 additions & 5 deletions src/fileaccess/fa_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@ fa_probe_fill_cache(metadata_t *md, const char *url, char *errbuf,
*/
static int
fa_probe_set_from_cache(const metadata_t *md, prop_t *proproot,
char *newurl, size_t newurlsize)
char *newurl, size_t newurlsize,
int overwrite_title)
{
metadata_stream_t *ms;
prop_t *p;
Expand All @@ -704,7 +705,7 @@ fa_probe_set_from_cache(const metadata_t *md, prop_t *proproot,
av_strlcpy(newurl, md->md_redirect, newurlsize);

if(md->md_title && (p = prop_create_check(proproot, "title")) != NULL) {
prop_set_rstring_ex(p, NULL, md->md_title, 1);
prop_set_rstring_ex(p, NULL, md->md_title, !overwrite_title);
prop_ref_dec(p);
}

Expand Down Expand Up @@ -787,7 +788,7 @@ fa_probe_set_from_cache(const metadata_t *md, prop_t *proproot,
*/
unsigned int
fa_probe(prop_t *proproot, const char *url, char *newurl, size_t newurlsize,
char *errbuf, size_t errsize, struct fa_stat *fs)
char *errbuf, size_t errsize, struct fa_stat *fs, int overwrite_title)
{
struct fa_stat fs0;
unsigned int hash, r;
Expand Down Expand Up @@ -831,7 +832,8 @@ fa_probe(prop_t *proproot, const char *url, char *newurl, size_t newurlsize,
}
}

r = fa_probe_set_from_cache(md, proproot, newurl, newurlsize);
r = fa_probe_set_from_cache(md, proproot, newurl, newurlsize,
overwrite_title);

hts_mutex_unlock(&metadata_mutex);
return r;
Expand All @@ -848,7 +850,7 @@ fa_probe_load_metaprop(prop_t *p, AVFormatContext *fctx, const char *url)
TAILQ_INIT(&md.md_streams);

fa_lavf_load_meta(&md, fctx, url);
fa_probe_set_from_cache(&md, p, NULL, 0);
fa_probe_set_from_cache(&md, p, NULL, 0, 0);
metadata_clean(&md);
}

Expand Down
2 changes: 1 addition & 1 deletion src/fileaccess/fa_probe.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct metadata;
unsigned int fa_probe(prop_t *proproot, const char *url,
char *newurl, size_t newurlsize,
char *errbuf, size_t errsize,
struct fa_stat *fs);
struct fa_stat *fs, int overwrite_title);

unsigned int fa_probe_dir(prop_t *proproot, const char *url);

Expand Down
4 changes: 2 additions & 2 deletions src/fileaccess/fa_scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ deep_analyzer(scanner_t *s)
} else {
fde->fde_type = fa_probe(metadata, fde->fde_url, NULL, 0,
buf, sizeof(buf),
fde->fde_statdone ? &fde->fde_stat : NULL);
fde->fde_statdone ? &fde->fde_stat : NULL, 1);

if(fde->fde_type == CONTENT_UNKNOWN)
TRACE(TRACE_DEBUG, "BROWSE",
Expand Down Expand Up @@ -305,7 +305,7 @@ scanner_entry_setup(scanner_t *s, fa_dir_entry_t *fde)
r = fa_probe_dir(metadata, fde->fde_url);
} else {
r = fa_probe(metadata, fde->fde_url, NULL, 0, NULL, 0,
fde->fde_statdone ? &fde->fde_stat : NULL);
fde->fde_statdone ? &fde->fde_stat : NULL, 1);
}
prop_ref_dec(metadata);

Expand Down

0 comments on commit 5ae6153

Please sign in to comment.