Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

metadata for videos

Gjoenge
2013-03-20
2014-05-04
  • Gjoenge
    Gjoenge
    2013-03-20

    Looking at the database minidlna has scanned of my video folders it looks to be pretty complete in regards to metadata collection. Unfortunately it looks like this data isn't used anywhere. Would it be possible to make a request to represent this data like the folder structure already used for music files so you could get something like a genre / year / latest folder listing?

     
  • Gjoenge
    Gjoenge
    2013-03-24

    I'm experimenting with this change for the videoitem handling part in insert_containers, seems to be doing the job ok if others want to add the functionality:

        else if( strstr(class, "videoItem") )
        {
            snprintf(sql, sizeof(sql), "SELECT GENRE from DETAILS where ID = %lld", detailID);
            ret = sql_get_table(db, sql, &result, &row, &cols);
            if( ret != SQLITE_OK )
                return;
            if( !row )
            {
                sqlite3_free_table(result);
                return;
            }
            char *genre = result[5];
            static struct virtual_item last_genre;
            static sqlite_int64 last_all_objectID = 0;
            char *tmpstr;
            if( genre )
            {
            //Genre delimiter handling ; or /
            char delimiter[3] = "/";
            if (strstr(genre, ";"))
                sprintf(delimiter, ";");
              
            tmpstr = strtok (genre, delimiter);
    
              while (tmpstr != NULL)
                {
                    // Handle result
                    if (strstr(tmpstr,"SciFi") || strstr(tmpstr,"Science Fiction")  )
                     strcpy(last_genre.name, "Sci-Fi");
                    else
                     strcpy(last_genre.name, tmpstr);
                    trim(last_genre.name);  
                    insert_container(last_genre.name, VIDEO_GENRE_ID, NULL, "genre.videoGenre", NULL, NULL, NULL, &objectID, &parentID);
                    sprintf(last_genre.parentID, VIDEO_GENRE_ID"$%"PRIX64, parentID);
                    last_genre.objectID = objectID;
                    sql_exec(db, "INSERT into OBJECTS"
                             " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
                             "VALUES"
                             " ('%s$%"PRIX64"', '%s', '%s', '%s', %"PRId64", %Q)",
                             last_genre.parentID, last_genre.objectID, last_genre.parentID, refID, class, detailID, name);
                    tmpstr = strtok (NULL, delimiter);
                }
            }
            /* All Videos */
            if( !last_all_objectID )
                last_all_objectID = get_next_available_id("OBJECTS", VIDEO_ALL_ID);
            sql_exec(db, "INSERT into OBJECTS"
                         " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
                         "VALUES"
                         " ('"VIDEO_ALL_ID"$%"PRIX64"', '"VIDEO_ALL_ID"', '%s', '%s', %"PRId64", %Q)",
                         last_all_objectID++, refID, class, detailID, name);
            return;
        }
    
     
  • alain1980
    alain1980
    2013-09-15

    hey would you be able to add support for all metadata (like plot summary) ?
    i would really like to be able to pass them to xmbc (as a upnp client)

     
  • Darkvater
    Darkvater
    2014-05-04

    Hi alain, try this: https://github.com/Darkvater/minidlna/tree/nfo_metadata

    I've added support for genres, actors, director, year (current year was date added to minidlna lib), tagline (was already present but was sent as description), description.

    Sadly XMBC does not support everything and has proprietary tags for some fields so if you want this you would need to add XMBC-client specific entries.
    Do note that minidlna does not retrieve any metadata itself but uses either 'movie.nfo' or '<filename>.nfo' if available in the XMBC format so you will have to populate that data yourself. There are quite a few programs that can do it for you.