Mediatomb 0.9.0 patch

2007-05-16
2013-05-30
  • Ricky Cross
    Ricky Cross
    2007-05-16

    Hi

    I hope you don't mind but ive created a patch that exposes the "serial number" and "modelDescription" fields into the config file. Hopefully others will find it useful.

    The patch is below. You can add <serial-number>whatever here</serial-number> and <modelDescription></modelDescription>

    Thanks

    Ricky

    diff -Naur src.orig/common.h src/common.h
    --- src.orig/common.h    2007-05-15 18:09:26.000000000 +0100
    +++ src/common.h    2007-05-15 18:02:24.000000000 +0100
    @@ -204,6 +204,7 @@
    #define DEFAULT_ITEMS_PER_PAGE_3         50
    #define DEFAULT_ITEMS_PER_PAGE_4         100
    #define DEFAULT_LAYOUT_TYPE             "builtin"
    +#define DEFAULT_SERIAL_NUMBER            "1"

    #ifdef HAVE_SQLITE3
         #define DEFAULT_STORAGE_DRIVER      "sqlite3"
    diff -Naur src.orig/config_manager.cc src/config_manager.cc
    --- src.orig/config_manager.cc    2007-03-27 22:03:32.000000000 +0100
    +++ src/config_manager.cc    2007-05-16 14:33:03.000000000 +0100
    @@ -163,7 +163,9 @@
        
         server->appendChild(ui);
         server->appendTextChild(_("name"), _(PACKAGE_NAME));
    -   
    +    server->appendTextChild(_("serial-number"), _(DEFAULT_SERIAL_NUMBER));
    +    server->appendTextChild(_("modelDescription"), _(DESC_MODEL_DESCRIPTION));
    +
         Ref<Element> udn(new Element(_("udn")));
         server->appendChild(udn);

    @@ -455,8 +457,10 @@
         log_info("Setting metadata import charset to %s\n", charset.c_str());

         getOption(_("/server/ip"), _("")); // bind to any IP address
    +    getOption(_("/server/serial-number"), _(DEFAULT_SERIAL_NUMBER));
         getOption(_("/server/bookmark"), _(DEFAULT_BOOKMARK_FILE));
         getOption(_("/server/name"), _(DESC_FRIENDLY_NAME));
    +    getOption(_("/server/modelDescription"), _(DESC_MODEL_DESCRIPTION));
         getOption(_("/server/modelName"), _(DESC_MODEL_NAME));
         getOption(_("/server/modelNumber"), _(DESC_MODEL_NUMBER));
         getOption(_("/server/manufacturerURL"), _(DESC_MANUFACTURER_URL));
    diff -Naur src.orig/upnp_xml.cc src/upnp_xml.cc
    --- src.orig/upnp_xml.cc    2007-03-27 22:03:32.000000000 +0100
    +++ src/upnp_xml.cc    2007-05-16 14:34:04.000000000 +0100
    @@ -219,10 +219,10 @@
         device->appendTextChild(_("friendlyName"), config->getOption(_("/server/name")));
         device->appendTextChild(_("manufacturer"), _(DESC_MANUFACTURER));
         device->appendTextChild(_("manufacturerURL"), config->getOption(_("/server/manufacturerURL")));
    -    device->appendTextChild(_("modelDescription"), _(DESC_MODEL_DESCRIPTION));
    +    device->appendTextChild(_("modelDescription"), config->getOption(_("/server/modelDescription"), _(DESC_MODEL_DESCRIPTION)));
         device->appendTextChild(_("modelName"), config->getOption(_("/server/modelName")));
         device->appendTextChild(_("modelNumber"), config->getOption(_("/server/modelNumber")));
    -    device->appendTextChild(_("serialNumber"), _(DESC_SERIAL_NUMBER));
    +    device->appendTextChild(_("serialNumber"), config->getOption(_("/server/serial-number"), _(DEFAULT_SERIAL_NUMBER)));
         device->appendTextChild(_("UDN"), config->getOption(_("/server/udn")));

         Ref<Element> iconList(new Element(_("iconList")));

     
    • Jin
      Jin
      2007-05-16

      Hi,

      may I ask - what exactly did you need this for? Is there some renderer that expects custom settings or why would you want to set those fields? :>

      I do not really see a problem in taking those changes, so you can expect them in trunk soon, but I'm just curious regarding the reason behind this :)

      Greetings,
      Jin

       
    • Ricky Cross
      Ricky Cross
      2007-05-16

      Hi Jin

      The company I work for are developing a NAS / Multimedia device. We use a unique 40 character string to identify each unit. We are able to store the unique hostkey in the serial number field.

      We have a piece of windows software that can set-up the NAS box. This software uses UPNP. However, the client could have multiple mediaservers running so we need a way of identifying our devices from others. We therefore look for a 40 key serial number and specific text in the modelDescription field.

      I have noticed on our patch that we created a variable DEFAULT_SERIAL_NUMBER but you already have one defined DESC_SERIAL_NUMBER. I can send the modified patch if you require

      Thanks for a great piece of software

      Ricky

       
    • Jin
      Jin
      2007-05-16

      Ah, I see :)

      No need to send the modified patch, that's an easy change.

      Let me know what device it is when it hits the market :) ...or do I already know? :>
      We are always happy to see MediaTomb running on new hardware.

      Thanks for the feedback,
      Jin

       
    • Jin
      Jin
      2007-05-16

      ok, functionality commited in r1297

      I decided to use serialNumber instead of the proposed serial-number tag, the reason is that we already have things like manufacturerURL, modelNumber and so on, the names of those tags simply match the ones in the device description XML.

      Further, I did not add the tags to ConfigManager::createDefaultConfig(), the reason is: we want to keep the config.xml that is created by the server as simple and as clean as possible, so we try to only write tags into the default config.xml that are likely to be changed by the user. The default for each and every option is then anyway filled in by the ConfigManager::validate() function upon startup.

      So in the end I did not really use the patch, nevertheless thanks for submitting it!

      Greetings,
      Jin