Mercurial > pt1.oyama
comparison src/metadata.c @ 152:30e91361506a
EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
author | Naoya OYAMA <naoya.oyama@gmail.com> |
---|---|
date | Sun, 02 Sep 2012 01:59:27 +0900 |
parents | 066f33b2213a |
children | 5d010d0ff6a1 |
comparison
equal
deleted
inserted
replaced
151:f7f594bf4e98 | 152:30e91361506a |
---|---|
36 #include "metadata.h" | 36 #include "metadata.h" |
37 #include "util_iconv.h" | 37 #include "util_iconv.h" |
38 #include "content.h" | 38 #include "content.h" |
39 #include "gettext.h" | 39 #include "gettext.h" |
40 #include "trace.h" | 40 #include "trace.h" |
41 #include "recpt1.h" | |
41 | 42 |
42 #define TITLE_UNKNOWN "unknown" | 43 #define TITLE_UNKNOWN "unknown" |
43 | 44 |
44 #define MAX_URL_SIZE 32 | 45 #define MAX_URL_SIZE 32 |
45 | 46 |
554 | 555 |
555 /* build root entry */ | 556 /* build root entry */ |
556 if (!ut->root_entry) | 557 if (!ut->root_entry) |
557 ut->root_entry = upnp_entry_new (ut, "root", NULL, NULL, -1, true); | 558 ut->root_entry = upnp_entry_new (ut, "root", NULL, NULL, -1, true); |
558 | 559 |
559 #if 0 | |
560 entry = upnp_entry_new (ut, "stream.ts", "/web/stream.ts", | |
561 ut->root_entry, -1, false); | |
562 upnp_entry_add_child (ut, ut->root_entry, entry); | |
563 metadata_add_container (ut, entry, "/web/"); | |
564 #endif | |
565 struct upnp_entry_t *entry = ut->root_entry; | 560 struct upnp_entry_t *entry = ut->root_entry; |
566 st.st_size = 100*1024*1024; | 561 st.st_size = 100*1024*1024; |
567 if (ut->nr_channel == 0) { | 562 for(i=0; i < ut->channel_list->nr_channel; i++) { |
568 metadata_add_file (ut, ut->root_entry, STREAM_LOCATION, STREAM_FILE_NAME, &st); | 563 char name[1024]; |
569 } else { | 564 name[0] = '\0'; |
570 for (i=0; i < ut->nr_channel; i++) | 565 strncpy(name, ut->channel_list->channel_info[i]->name, sizeof(name)); |
571 metadata_add_file (ut, ut->root_entry, ut->location_name[i], ut->channel_name[i], &st); | 566 strncat(name, ".ts", sizeof(name)); |
567 metadata_add_file (ut, | |
568 ut->root_entry, | |
569 ut->channel_list->channel_info[i]->sid, | |
570 name, | |
571 &st); | |
572 } | 572 } |
573 ut->contentlist = NULL; | 573 ut->contentlist = NULL; |
574 //metadata_add_container (ut, ut->root_entry, "/web/"); | |
575 | |
576 #if 0 | |
577 /* add files from content directory */ | |
578 for (i=0 ; i < ut->contentlist->count ; i++) | |
579 { | |
580 struct upnp_entry_t *entry = NULL; | |
581 char *title = NULL; | |
582 int size = 0; | |
583 | |
584 log_info (_("Looking for files in content directory : %s\n"), | |
585 ut->contentlist->content[i]); | |
586 | |
587 size = strlen (ut->contentlist->content[i]); | |
588 if (ut->contentlist->content[i][size - 1] == '/') | |
589 ut->contentlist->content[i][size - 1] = '\0'; | |
590 title = strrchr (ut->contentlist->content[i], '/'); | |
591 if (title) | |
592 title++; | |
593 else | |
594 { | |
595 /* directly use content directory name if no '/' before basename */ | |
596 title = ut->contentlist->content[i]; | |
597 } | |
598 | |
599 entry = upnp_entry_new (ut, title, ut->contentlist->content[i], | |
600 ut->root_entry, -1, true); | |
601 | |
602 if (!entry) | |
603 continue; | |
604 upnp_entry_add_child (ut, ut->root_entry, entry); | |
605 metadata_add_container (ut, entry, ut->contentlist->content[i]); | |
606 } | |
607 #endif | |
608 | |
609 log_info (_("Found %d files and subdirectories.\n"), ut->nr_entries); | 574 log_info (_("Found %d files and subdirectories.\n"), ut->nr_entries); |
610 ut->init = 1; | 575 ut->init = 1; |
611 } | 576 } |
612 | 577 |
613 int | 578 int |