changeset 155:5d010d0ff6a1

Change line number of the CSV file to be used for ID management.
author Naoya OYAMA <naoya.oyama@gmail.com>
date Sun, 02 Sep 2012 20:52:45 +0900
parents 578ebda88997
children 159a729b90eb
files src/http.c src/metadata.c src/recpt1.c src/recpt1.h
diffstat 4 files changed, 22 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/http.c	Sun Sep 02 16:38:43 2012 +0900
+++ b/src/http.c	Sun Sep 02 20:52:45 2012 +0900
@@ -377,7 +377,7 @@
      * get_file_stream()を呼び出しハンドラを返却する
      */
     for (i=0; i < ut->channel_list->nr_channel; i++) {
-        if (!strcmp(entry->fullpath, ut->channel_list->channel_info[i]->sid)) {
+        if (atoi(entry->fullpath) == ut->channel_list->channel_info[i]->id) {
             ut->sid = ut->channel_list->channel_info[i]->sid;
             ut->tp  = ut->channel_list->channel_info[i]->tp;
             return get_file_stream (ut->sid, tdata);
--- a/src/metadata.c	Sun Sep 02 16:38:43 2012 +0900
+++ b/src/metadata.c	Sun Sep 02 20:52:45 2012 +0900
@@ -561,12 +561,14 @@
   st.st_size = 100*1024*1024;
   for(i=0; i < ut->channel_list->nr_channel; i++) {
       char name[1024];
+      char id[16];
       name[0] = '\0';
       strncpy(name, ut->channel_list->channel_info[i]->name, sizeof(name));
+      snprintf(id, sizeof(id), "%d", ut->channel_list->channel_info[i]->id);
       strncat(name, ".ts", sizeof(name));
       metadata_add_file (ut,
                          ut->root_entry,
-                         ut->channel_list->channel_info[i]->sid,
+                         id,
                          name,
                          &st);
   }
--- a/src/recpt1.c	Sun Sep 02 16:38:43 2012 +0900
+++ b/src/recpt1.c	Sun Sep 02 20:52:45 2012 +0900
@@ -58,7 +58,9 @@
 int close_tuner(thread_data *tdata);
 static int get_device_id_by_name ( const char *name );
 
-static struct channel_info_list *open_list_file(char *type)
+static struct channel_info_list *open_list_file(
+       char *type,
+       struct channel_info_list *info_list)
 {
     char   *buf                                 = NULL;
     char   filename[PATH_MAX];
@@ -74,10 +76,13 @@
     if(!f) {
         return channel_info_list;
     }
-    channel_info_list = malloc(sizeof(*channel_info_list));
-    if(!channel_info_list)
-        return NULL;
-    channel_info_list->nr_channel = 0;
+    if(!info_list) {
+        channel_info_list = malloc(sizeof(*channel_info_list));
+        if(!channel_info_list)
+            return NULL;
+        channel_info_list->nr_channel = 0;
+    } else
+        channel_info_list = info_list;
     while(1) {
         buf = NULL;
         buf = malloc(256);
@@ -97,6 +102,7 @@
         channel_info->tp   = NULL;
         channel_info->name = NULL;
 
+        channel_info->id  = channel_info_list->nr_channel;
         channel_info->sid = buf;
 
         p = strchr(buf, C_CHAR_COMMA);
@@ -1518,8 +1524,12 @@
     /* initialize DLNA */
     if(use_dlna) {
         do {
-            if(use_splitter)
-                channel_list = open_list_file("ISDB");
+            if(use_splitter && tdata.table->type == CHTYPE_GROUND)
+                channel_list = open_list_file("ISDB", NULL);
+            else {
+                channel_list = open_list_file("BS", NULL);
+                channel_list = open_list_file("CS", channel_list);
+            }
             tdata.stream_queue = stream_queue;
             tdata.streamer = malloc(sizeof(streamer));
             if ( tdata.streamer == NULL ) {
--- a/src/recpt1.h	Sun Sep 02 16:38:43 2012 +0900
+++ b/src/recpt1.h	Sun Sep 02 20:52:45 2012 +0900
@@ -102,6 +102,7 @@
 } thread_data;
 
 struct channel_info {
+    int   id;
     char *sid;
     char *tp;
     char *name;